-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Cmd-forge-verifyCommand: forge verify-contract/checkCommand: forge verify-contract/checkT-bugType: bugType: bug
Description
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
forge 0.3.0 (55badd4 2025-01-17T00:21:10.590438000Z)
What version of Foundryup are you on?
No response
What command(s) is the bug in?
forge script --verify
Operating System
macOS (Apple Silicon)
Describe the bug
I'm specifically compiling one file with minimal optimization runs, as it's from an external repo and is bloated.
[profile.default]
optimizer = true
optimizer_runs = 10000
additional_compiler_profiles = [
{ name = "optimizer-10runs", optimizer_runs = 10 },
]
compilation_restrictions = [
{ paths = "src/BloatedContract.sol", optimizer_runs = 10 },
]
This compiles and deploys fine - however verification is failing for one of the common dependent contracts which BloatedContract.sol imports as well as other non-bloated contracts (eg there is both a MockERC20.default.json and MockERC20.optimizer-10runs.json):
$ forge script --fork-url $HOLESKY_RPC_URL scripts/DeployBloatedContract.s.sol --broadcast ... --resume --verify
Start verifying contract `0xXXX` deployed on holesky
Compiler version: 0.8.22
Optimizations: 10000
Constructor args:
Submitting verification for [src/MockERC20.sol:MockERC20.optimizer-10runs] 0xXXX
Submitted contract for verification:
Response: `OK`
GUID: `xxx`
URL: https://holesky.etherscan.io/address/0xXXX
Contract verification status:
Response: `NOTOK`
Details: `Pending in queue`
Warning: Verification is still pending...; waiting 15 seconds before trying again (7 tries remaining)
Contract verification status:
Response: `NOTOK`
Details: `Fail - Unable to verify. Unable to locate a contract with the name 'src/MockERC20.sol:MockERC20.optimizer-10runs', did you specify the correct Contract Name?`
Error: Failed to verify contract: Checking verification result failed: Contract failed to verify.
So it appears that it's not using the correct artefact details while verifying. The metadata in the log suggest it's trying to verify the version with optimisation_runs = 10000 incorrectly
Metadata
Metadata
Assignees
Labels
Cmd-forge-verifyCommand: forge verify-contract/checkCommand: forge verify-contract/checkT-bugType: bugType: bug
Type
Projects
Status
Completed