Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

etherscan-verify consistently fails on rinkeby without the --solc-input option #263

Open
ClementWalter opened this issue Jan 24, 2022 · 12 comments

Comments

@ClementWalter
Copy link

ClementWalter commented Jan 24, 2022

Describe the bug
When using the etherscan-verify task of this plugin, only using the solc-input option makes it work.

However, when using the base @nomiclabs/hardhat-etherscan with the arguments I find in the deployments/rinkeby/xxx.json it works well.

To Reproduce
Steps to reproduce the behavior:

Not sure how to share this right now

Expected behavior

There is no reason @nomiclabs/hardhat-verify and not etherscan-verify.

versions

  • hardhat-deploy [e.g. 0.9.14] : 0.9.24
  • hardhat : 2.8.0
  • nodejs : v17.3.0
  • @nomiclabs/hardhat-etherscan : 2.1.8

Additional context

The contracts can be found on rinkeby at:

https://rinkeby.etherscan.io/address/0x35fF8bAC5D584fF34Ea899f133D62c10706c2E8A
https://rinkeby.etherscan.io/address/0xEE0451Abc83D1971956da4b1647DC8187178Cd4F
https://rinkeby.etherscan.io/address/0x651534a85763beB8b6D04b86C96BE724a2D3b8cf
https://rinkeby.etherscan.io/address/0x79cfaa14901045e4564A5DAdb34DE81dC9efB871
https://rinkeby.etherscan.io/address/0xF00A0FEaaDfD42224a700f15E1Af2E2a71aa9D8b

@wighawag
Copy link
Owner

Thanks for the report

If I understand you correctly, it actally works, you just need to put --solc-input ?
I guess hardhat-etherscan does the same, hence why it works there

If that is the case, I would sugesst you contact etherscan so they support metadata as input

You can also try if the sourcify command works: hardhat sourcify

As for the one failing both case, would be better to create a different issue, because the way this issue is formulated it pertains to the issue above about the need for --solc-input param

@ClementWalter
Copy link
Author

ok thanks, so I can edit this one to keep only the cases working with --solc-input and create another one with the lat one.
Btw, Sourcify fails for all of my contracts with

{"error":"Recompilation error (probably caused by invalid metadata)"}

@ClementWalter ClementWalter changed the title etherscan-verify consistently fails on rinkeby while base verify task does succeed etherscan-verify consistently fails on rinkeby without the --solc-input option Jan 25, 2022
@wighawag
Copy link
Owner

Btw, Sourcify fails for all of my contracts with

{"error":"Recompilation error (probably caused by invalid metadata)"}

Ok, that's interesting, it means something could be wrong with the metadata save, but could also be sourcify failing for some reason, any idea @FabijanC ?

@FabijanC
Copy link

Can you take over @kuzdogan ?

@ClementWalter
Copy link
Author

Also sometimes I feel like something is going wrong with deployments data and I just rm -rf deployments/rinkeby to start over

@kuzdogan
Copy link

I wasn't able to reproduce the error. I cloned https://github.com/ClementWalter/light-runners and npm installed but encountering

tasks/chain-runners/getLayers.ts:1:10 - error TS2305: Module '"@dethcrypto/eth-sdk-client"' has no exported member 'getMainnetSdk'.

Can you maybe share the hardhat output in artifacts/build-info/ so that I can debug what's wrong with the Sourcify verification?

@ClementWalter
Copy link
Author

this doesn't come from this repo indeed but another one I'm working on and we will publish very soon. I have four files in this folder, do you want me to paste them here or should I send them to you by another medium?

@ClementWalter
Copy link
Author

build-info.zip

@kuzdogan
Copy link

kuzdogan commented Jan 26, 2022

Thanks for the file. I debugged on Sourcify and sure enough, when recompiling CandyShop.sol the Solidity compiler outputs this:

{
  "errors": [
    {
      "component": "general",
      "formattedMessage": "Unknown key \"inliner\"",
      "message": "Unknown key \"inliner\"",
      "severity": "error",
      "type": "JSONError"
    }
  ]
}

This seems to be a known issue on version 0.8.4: ethereum/solidity#11418. Actually between versions 0.8.4 - 0.8.2 when the inliner was introduced.

I see that the metadata files of the compiled contracts contain inliner: true but it is not found in the json-input which I think explains why it only works with --solc-input.

This bug might be affecting other contracts being verified on Sourcify so good that we found it out.

@ClementWalter
Copy link
Author

first of all thanks for this awesome plugin! not sure I am good enough yet to help but don't hesitate to assign me somewhere if you mind it

@wighawag
Copy link
Owner

Thanks @ClementWalter and @kuzdogan for looking deeper.
This seems to be a solidity issue and the sourcify team will be making a workaround for it.
This means that for the sourcify part, we are on a good track.
As for etherscan, it might be a good idea to contact them as the issue you encounter with their api is probably the same

@ClementWalter
Copy link
Author

In any cases, I can confirm that updating the compiler version to 0.8.8 solved the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants