Skip to content

chore(l1): clear forge-lint warnings under Foundry 1.8.5 - #25605

Draft
AztecBot wants to merge 3 commits into
cb/foundry-1.8.5from
cb/foundry-1.8.5-lint
Draft

AztecBot wants to merge 3 commits into
cb/foundry-1.8.5from
cb/foundry-1.8.5-lint

Conversation

@AztecBot

@AztecBot AztecBot commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Stacked on #25602 (base branch cb/foundry-1.8.5). Brings forge lint under Foundry 1.8.5 from 245 warnings to zero in l1-contracts, without changing any deployed bytecode.

Where Count before What this PR does
test/ + script/ (environment-read-across-mutation) 85 Real fix: the flagged block.timestamp / block.number reads in functions that also vm.warp / vm.roll now use vm.getBlockTimestamp() / vm.getBlockNumber(), which is what the lint asks for (the optimizer may reuse an environment read across the cheatcode). 84 lines in 33 files.
src/ policy lints (block-timestamp, require-revert-in-loop, calls-loop, reentrancy-events, missing-zero-check) 109 Excluded in foundry.toml [lint], each with a one-line reason: slot timing is timestamp-based by design; committee loops check and call per member on purpose; events are emitted after the calls they describe with state already settled; the zero-address sites are constructor/governance wiring.
src/ correctness lints (unsafe-typecast 25, unused-return 10, uninitialized-local 11, empty-block 3, erc20-unchecked-transfer 2, reentrancy-no-eth, encode-packed-collision, missing-events-* 2) 55 Reviewed one by one. Every site gets an inline // forge-lint: disable-next-item(...) preceded by a comment stating why it is safe (bounds, storage width, guard above, intentional truncation). Seven uninitialized-local sites got an explicit = 0 initialiser where that is bytecode-neutral; the four in SlashingProposer are suppressed instead because an explicit initialiser there changes the emitted code by one byte.

lint_on_build stays on, so forge build is now quiet.

Verification (Foundry 1.8.5 binaries)

  • forge lint / forge build: 0 warnings (was 245).
  • forge fmt --check: clean. All 41 directives are on their own line (fmt's comment wrapping merges a directive into a preceding long comment, which silently disables it; two such cases were caught and fixed).
  • Bytecode: built the base branch and this branch side by side and compared the creation and runtime bytecode of all 125 src/ contracts byte-by-byte. Outside CBOR metadata hashes (which change with any source text), there are no differences. The lint PR does not alter what gets deployed.
  • forge test: 1383 passed, 0 failed, 3 skipped, in six separate full runs on this tree, including one with the Osaka EVM target the base branch now uses.
  • solhint: unchanged.

Judgement calls for review

  • unused-return on approve(...) (StakingLib ×2, GSE ×2, MultiAdder): suppressed on the stated assumption that the staking asset is the protocol's OZ ERC20 (returns true or reverts). If a non-OZ asset is ever plausible, forceApprove is the real fix, at a bytecode cost.
  • encode-packed-collision in SlashingProposer._preparePayloadDataAndAddress: suppressed because validators and amounts are both sized by actionCount behind a fixed 32-byte round prefix, so the packed layout cannot be ambiguous. Worth a second pair of eyes since it is a hashing site.
  • missing-events-* (GSE.addRollup, Inbox.markProvenConsumed): suppressed rather than adding events, to keep bytecode identical. Adding events is a product decision.

Created by claudebox · group: slackbot · requested by Mike (@iAmMichaelConnor) · Slack thread

@AztecBot AztecBot added ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR. labels Oct 6, 2026
@iAmMichaelConnor
iAmMichaelConnor added this pull request to stack #25610 October 7, 2026 08:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-draft Run CI on draft PRs. ci-no-fail-fast Sets NO_FAIL_FAST in the CI so the run is not aborted on the first failure claudebox Owned by claudebox. it can push to this PR. port-to-v6 private-port-next

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant