-
-
Notifications
You must be signed in to change notification settings - Fork 130
"Invalid constructor arguments" error, running immediately after deployment #34
Comments
Hey @mcplums! That does sound weird. Could you run the command again with the |
I have tried to re-create this error and this time using the --debug flag, this time I'm getting 503 error which I assume is a problem at etherscan's end so I will try again later and report back. If I take too long to do so feel free to close 👍 I can confirm it was not a factory. I'm aware that etherscan cannot handle those just yet. |
Any news on this? |
Getting the same error. When i add
The payload to etherscan API is missing the '0x' from the beginning |
Hey @dmolina79, thanks for chipping in! That should be fine, Etherscan doesn't expect the |
Hi @rkalis sure, i've created this repo as an example https://github.com/dmolina79/yearn-truffle-verify Trying to verify this contract in rinkeby using this command:
These are the compiler settings which should be good: The plugin has worked great so far with other simpler contracts, but it bricks on this one with the constructor error for some reason. Lmk if you need anything else. |
So it looks like it somehow retrieved incorrect constructor arguments. When I ran it on my end it retrieved this as the constructor arguments: When running with the installed version v0.4.0, I did get an error because the flattened source code included multiple SPDX license identifiers. As a fix, I updated to the latest version v0.5.0 (which uses multi-file verification) and I was able to verify the contract. I was able to run migrations and accurately verify those newly deployed contracts as well. I'm still not sure why it got different constructor args on your end than on my end, but I can't reproduce the issue. Could you try updating to v0.5.0 and running compile + migrate + verify again to see if it's working for you? |
Hi, I am getting the same issue @dmolina79. When running verify it gets my contructor parameters received as: 0x00000000005d3a536e4d6dbd6114cc1ead35777bab948e3643a26469706673582212203f6b1b16b84a192fc410f2b7252382703c506f806748d5f6b2299317b56927cc64736f6c634300060c00330000000000000000000000009b142c2cdab89941e9dcd0b6c1cf6dea378a8d7c when they should be: This is a different project to @dmolina79 but we are both built off the same baseStrategy.sol |
That is so odd that it works on my end. Could you guys share your Truffle versions as well? |
Truffle v5.1.50 (core: 5.1.50) |
thanks a lot @rkalis updating the plugin to 0.5.0 did the trick, so it was not the abi constructor issue it was the mix licenses, but that worked in any case. |
I cloned @dmolina79 repo and added my contract, but still getting the same constructor error when trying to verify. Here is the repo: https://github.com/Grandthrax/yearn-truffle-verify And I am running command: |
I am using truffle-plugin-verify@0.5.0. Error is: Invalid constructor arguments provided. Please verify that they are in ABI-encoded format Constructor parameters retrieved: 0xcf6dea378a8d7c so I am now getting different constructor parameters, but still the wrong ones... |
Strange. Do you have a link to your forked repo with your contract added? |
yes here: https://github.com/Grandthrax/yearn-truffle-verify |
So looking into it a bit more it seems that 'Invalid constructor arguments provided error' just happens when the transaction data is a different length to the artifact.bytecode.length. So probably something I am doing wrong rather than an error on your end |
So the way the plugin works is it gets the contract creation transaction. The input data of that transaction is the contract bytecode + the constructor args. By splitting the input data on the bytecode length, what should be left over is the constructor args. But if the bytecode doesn't match, then it's possible that the split is wrong. So are you absolutely sure that the compile settings that you used locally are exactly the same as the ones you used when deploying? i.e.: compilers: {
solc: {
version: "0.6.12",
settings: {
optimizer: {
enabled: true,
runs: 200
},
},
}
}, |
I compiled and deployed using brownie rather than truffle. So have redeployed (0xd1da63f8ab9b8ce335f0f0e40f0e2a05c20c93bf) using truffle from the repo i linked to above. Now constructor parameters look right but verify is still failing. One thing I did have to do was edit the json build file for truffle-plugin-verify to work. I was getting "Cannot find module '/D/Source/....l'" so changed all /D/ to D:/. Would that change the result of verify? |
Which fields did you have to change the paths for in the JSON file? |
Also could you push the migration code that you used to the library? |
Closing this issue for inactivity. Feel free to open it with more information. |
Hello, I'm running:
truffle migrate --network mainnet --reset
And then I'm immediately running
truffle run verify ContractName@address --network mainnet
and I get "Invalid constructor arguments provided. Please verify that they are in ABI-encoded format".
How can they be invalid when I've only just deployed it?
Btw. I love this plugin so much :) it has worked many times in the past
The text was updated successfully, but these errors were encountered: