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

hardhat-etherscan breaks on hardhat/console.sol #1117

Closed
ldub opened this issue Dec 20, 2020 · 23 comments · Fixed by #4128
Closed

hardhat-etherscan breaks on hardhat/console.sol #1117

ldub opened this issue Dec 20, 2020 · 23 comments · Fixed by #4128
Assignees
Labels
status:ready This issue is ready to be worked on type:bug Something isn't working

Comments

@ldub
Copy link

ldub commented Dec 20, 2020

when running

npx hardhat verify --network mainnet

i was getting the error

[Error: ENOENT: no such file or directory, open '/Users/lev/dev/ldub/token-2/artifacts/build-info/4e7389b25e253b27f945b011dc8f896b.json'] {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/lev/dev/ldub/token-2/artifacts/build-info/4e7389b25e253b27f945b011dc8f896b.json'
}

this was being thrown by const buildInfo = await artifacts.getBuildInfo(fqName); on line https://github.com/nomiclabs/hardhat/blob/master/packages/hardhat-etherscan/src/solc/bytecode.ts#L97 when fqName was hardhat/console.sol:console.

i added

if (fqName === "hardhat/console.sol:console") continue

in token-2/node_modules/@nomiclabs/hardhat-etherscan/dist/src/solc/bytecode.js and then the script verified just fine

I am new to hardhat and dont know the root cause of why its even looking at the console but i hope this is sufficient information for @ItsNickBarry or someone else to fix :)

Thanks for the awesome tools all!

@ldub
Copy link
Author

ldub commented Dec 20, 2020

i should note that i used the hardhat-dependency-compiler plugin and it could be that plugin's bug

@alcuadrado
Copy link
Member

Hey @ldub, can you create a repo to reproduce this? Thanks!

@fvictorio fvictorio added the status:needs-more-info There's not enough information to start working on this issue label Dec 21, 2020
@SirLancelot-OG
Copy link

For anyone running into the same issue, npx hardhat clean resolve the problem for me.

@fvictorio
Copy link
Member

Closing this for lack of more info. Please re-open if you can give us instructions on how to reproduce it.

@mindqaugas
Copy link

I had the smae issue "npx hardhat clean" resolved my problem

@ru19wu06
Copy link

@SirLancelot-OG help me a lot!!

@MZubairLohar
Copy link

I had the smae issue "npx hardhat clean" resolved my problem

it worked for me as well ! thanks dude

@alcuadrado
Copy link
Member

I'm reopening this issue and it seems to be pretty common.

@alcuadrado alcuadrado reopened this Oct 18, 2021
@fvictorio fvictorio added status:needs-research and removed status:needs-more-info There's not enough information to start working on this issue labels Oct 19, 2021
@Decentra-Ecosystem
Copy link

For anyone running into the same issue, npx hardhat clean resolve the problem for me.

Thank you thank you thank you!!!!

@chefpickle
Copy link

npx hardhat clean works for me . thank you @SirLancelot-OG

@fvictorio
Copy link
Member

I think I know how to reproduce this:

  1. Create the basic sample project
  2. Install @nomiclabs/hardhat-etherscan and add it to the hardhat config.
  3. Add a valid rinkeby network and a valid etherscan API key to the config.
  4. Deploy the contract to Rinkeby hh run --network rinkeby scripts/sample-script.js
  5. Go to Greeter.sol and rename the contract Greeter to Foo. Do not compile the project.
  6. Try to verify the file with hh verify --network rinkeby <address>

@magic990619
Copy link

npx hardhat clean works for me. thanks a lot.

@Huge
Copy link

Huge commented Feb 6, 2022

Hello, new year here, so glad I've found the #1117 (comment) here, finally got past the few-hour debugging headache with this!-)

@masudrehman
Copy link

to reproduce this error:
1- compile a contract with constructor arguments and deploy it to testnet
2- Install @nomiclabs/hardhat-etherscan and add it to the hardhat config.
3- try verifying the contract now, it will throw error
4- npx hardhat clean fixes this error

@vedant-11
Copy link

for me npx hardhat clean worked

@jikdo
Copy link

jikdo commented Feb 24, 2022

npx hardhat clean works , wish i knew how this error is thrown though

@fvictorio
Copy link
Member

Copying here what @morgansliman found out in #2507:

The core problem being fixed is that when we change the contract name (or presumably make any change to the contract), the verification pipeline recompiles only that contract and not console.sol.
This results in the existing artifact debug file for console.sol pointing to the old hash of the contracts/Greeter.sol:Greeter build-info and not the newly recompiled contracts/Greeter.sol:Foo hash and causing the error from the original issue.

@asardon
Copy link

asardon commented Mar 31, 2022

run into the same issue, thank you @SirLancelot-OG!

@SomeJoker
Copy link

same

Nice. fix my problem

@olivermen
Copy link

I used npx hardhat clean, but I hadn't solved the problem.
Please help me.

@fvictorio fvictorio added status:ready This issue is ready to be worked on and removed priority:high labels Dec 30, 2022
@itsanishjain
Copy link

For anyone running into the same issue, npx hardhat clean resolve the problem for me.

Thank you so much

@alvinChristianto
Copy link

Thankyou that save me !

@fvictorio
Copy link
Member

We finally fixed this in Hardhat v2.17.0. The npx hardhat clean workaround should no longer be necessary.

If someone is using v2.17.0 or later and runs into this problem, please let us know!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status:ready This issue is ready to be worked on type:bug Something isn't working
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.