Skip to content

fix: correct etherscan and sourcify verification commands#477

Open
jonaprieto wants to merge 1 commit intomainfrom
fix-verification-commands
Open

fix: correct etherscan and sourcify verification commands#477
jonaprieto wants to merge 1 commit intomainfrom
fix-verification-commands

Conversation

@jonaprieto
Copy link
Collaborator

Work-in-progress investigation.

Closes #472

When ETHERSCAN_API_KEY is set, forge verify-contract --verifier sourcify silently reroutes to Etherscan because forge auto-populates the -e flag from the env var. Additionally, without an [etherscan] section in foundry.toml, forge may fail to resolve the correct explorer URL for L2 chains.

Changes:

  • Strip ETHERSCAN_API_KEY from the contracts-verify-sourcify recipe environment via env -u so forge respects --verifier sourcify
  • Add [etherscan] section to contracts/foundry.toml with per-chain API key config (a single Etherscan V2 key works across all chains)
  • Rewrite the README verification section to document both Sourcify and Etherscan verification
  • Add ETHERSCAN_API_KEY to .env-example

Upstream Foundry issues: foundry-rs/foundry#6192, foundry-rs/foundry#7466, foundry-rs/foundry#7699.

@jonaprieto jonaprieto requested a review from cwgoes February 22, 2026 00:44
@jonaprieto jonaprieto marked this pull request as ready for review February 22, 2026 00:45
@jonaprieto jonaprieto requested a review from agureev February 24, 2026 14:55
@jonaprieto jonaprieto added the bug Something isn't working label Feb 24, 2026
Strip `ETHERSCAN_API_KEY` from the sourcify recipe's environment so that
`forge verify-contract --verifier sourcify` is not silently rerouted to
Etherscan. Add an `[etherscan]` section to `foundry.toml` with explicit
per-chain config so forge can resolve explorer URLs on L2 chains. Update
the README verification section to document both providers and add
`ETHERSCAN_API_KEY` to `.env-example`.

Upstream Foundry issues: #6192, #7466, #7699.

Closes #472
@jonaprieto jonaprieto force-pushed the fix-verification-commands branch from 851fab2 to 8b12c69 Compare February 25, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate what the right etherscan / sourcify verification commands are and fix the justfile

1 participant