foundry icon indicating copy to clipboard operation
foundry copied to clipboard

Failed to decode constructor arguments

Open 0xPhaze opened this issue 1 year ago • 3 comments

Component

Forge

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

  • [X] Foundry
  • [X] Foundryup

What version of Foundry are you on?

forge 0.2.0 (359dd77 2022-09-15T00:04:51.833948Z)

What command(s) is the bug in?

forge script

Operating System

macOS (Apple Silicon)

Describe the bug

I'm getting the following error when deploying via forge script.

Error: 
Transaction failed when running the on-chain simulation. Check the trace above for more information.

Context:
- Failed to decode constructor arguments for contract Some("ERC1967Proxy"): constructor(address,bytes)
        bytecode="608060405260405161037e38038061037e833981016040819052610022916101f8565b61002c8282610033565b50506102fb565b816001600160a01b03163b60000361005e576040516309ee12d560e01b815260040160405180910390fd5b60008051602061035e83398151915260001b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100d291906102c6565b146100f0576040516303ed501d60e01b815260040160405180910390fd5b805115610166576000826001600160a01b03168260405161011191906102df565b600060405180830381855af49150503d806000811461014c576040519150601f19603f3d011682016040523d82523d6000602084013e610151565b606091505b5050905080610164573d6000803e3d6000fd5b505b60008051602061035e83398151915280546001600160a01b0319166001600160a01b0384169081179091556040517fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a25050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156101ef5781810151838201526020016101d7565b50506000910152565b6000806040838503121561020b57600080fd5b82516001600160a01b038116811461022257600080fd5b60208401519092506001600160401b038082111561023f57600080fd5b818501915085601f83011261025357600080fd5b815181811115610265576102656101be565b604051601f8201601f19908116603f0116810190838211818310171561028d5761028d6101be565b816040528281528860208487010111156102a657600080fd5b6102b78360208301602088016101d4565b80955050505050509250929050565b6000602082840312156102d857600080fd5b5051919050565b600082516102f18184602087016101d4565b9190910192915050565b6055806103096000396000f3fe608060405236600080376000803660007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc545af43d6000803e80156042573d6000f35b503d6000fdfea164736f6c6343000810000a360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc00000000000000000000000004d7478fdf318c3c22cece62da9d78ff94807d77000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c47029144c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000064d79204e4654000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044e4654580000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"

This only happens when passing in an --rpc-url. Tested on mumbai testnet, but also anvil.

I tried creating a minimum reproducible example from a completely clean repo, but couldn't get it to work. The closest I got to was using this repository:

git clone [email protected]:0xPhaze/upgrade-scripts
cd upgrade-scripts/example
forge install
forge script deploy --rpc-url http://127.0.0.1:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 -vvv --ffi

0xPhaze avatar Sep 15 '22 19:09 0xPhaze

I'm also running into this issue, using forge 0.2.0 (7dda095 2022-09-17T00:17:33.315742Z)

The issue can be reproduced by running the IdRegistry or NameRegistry deploy scripts here using the command: forge script script/IdRegistry.s.sol:IdRegistryScript --rpc-url $GOERLI_RPC_URL --private-key $GOERLI_PRIVATE_KEY --broadcast --verify --etherscan-api-key $ETHERSCAN_KEY -vvvv

It produces the error:

ERROR foundry_cli::cmd::forge::script::transaction: Failed to extract constructor args from CREATE data constructor="constructor(address)" contract=Some("IdRegistry") bytecode="...."

varunsrin avatar Sep 17 '22 19:09 varunsrin

Could this be what is causing my contract etherscan verifications to fail? (I'm getting the same errors)

Thanks :pray:

JasoonS avatar Sep 19 '22 13:09 JasoonS

likely, I'm about to fix this properly.

mattsse avatar Sep 19 '22 13:09 mattsse

this should be fixed now, if you encounter this again, please reopen

mattsse avatar Sep 23 '22 15:09 mattsse

confirming, fixed for me

varunsrin avatar Sep 23 '22 16:09 varunsrin