Skip to content

forge script --verifier sourcify is ignored when ETHERSCAN_API_KEY env var is defined #10000

@RaoulSchaffranek

Description

@RaoulSchaffranek

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge Version: 1.0.0-stable

What version of Foundryup are you on?

foundryup: 0.3.1

What command(s) is the bug in?

forge script

Operating System

Linux

Describe the bug

We're trying to verify a contract on Sourcify, but the forge script attempts to verify on Etherscan instead. This only happens when the ETHERSCAN_API_KEY environment variable is defined. It's unexpected that the variable would take precedence over the --verifier sourcify flag. When I delete the environment variable, Foundry correctly verifies against Sourcify.

I set up a simple example repository to reproduce the issue at https://github.com/runtimeverification/buildbear-verifiy

This fails:

export ETHERSCAN_API_KEY="some-api-key"
forge script script/Counter.s.sol \
    --rpc-url buildbear \
    --verify \
    --verifier sourcify \
    --verifier-url "https://rpc.buildbear.io/verify/sourcify/server/raoul" \
    -vvvv \
    --broadcast \
    --slow

It looks like the error was introduced in this PR:
https://github.com/foundry-rs/foundry/pull/9630/files#diff-83809d8e219fe52b39eed2ae2f638def658f8a8d2121e298bf48cb8c39af6fdfR173

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Completed

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions