rkalis / truffle-plugin-verify

✅ Verify your smart contracts on Etherscan from the Truffle CLI
https://kalis.me/verify-truffle-smart-contracts-etherscan/
MIT License
467 stars 130 forks source link

custom deployed proxy verification issue fix #166

Closed akshaydevh closed 2 years ago

akshaydevh commented 2 years ago

Fix for the issue in verifying proxy contracts.

An optional --implementation flag has been added. This flag can be used for passing the implementation smartcontract name. If this flag is not passed, the implementation verification will be skipped and proxy verification will continue.

Changes

fixes #150

rkalis commented 2 years ago

Thanks @akshaydevh, I made some small changes (mostly formatting). It seems to be working on my end, but I'd appreciate it, @hellwolf if you could take a look at this and try it out to see if this fixes your issues before I merge + release it.

hellwolf commented 2 years ago

I will test it on Monday

hellwolf commented 2 years ago
$ npm ls truffle-plugin-verify
@superfluid-finance/protocol-monorepo@0.0.0 /home/hellwolf/Projects/superfluid/protocol-monorepo_releases
└─┬ @superfluid-finance/ethereum-contracts@1.2.1 -> ./packages/ethereum-contracts
  └── truffle-plugin-verify@0.5.25 (git+ssh://git@github.com/akshaydevh/truffle-plugin-verify.git#181d985d8e37524ee2fc8563e322243dcb894814)
$ npx truffle --network matic run etherscan SuperToken@0x1305F6B6Df9Dc47159D12Eb7aC2804d4A33173c2  --implementation SuperToken
Verifying SuperToken@0x1305F6B6Df9Dc47159D12Eb7aC2804d4A33173c2
Verifying SuperToken at 0xc304cef3bb75b2638633aec178df09fd058a0f9c
Cannot set property 'address' of undefined
Failed to verify 1 contract(s): SuperToken@0x1305F6B6Df9Dc47159D12Eb7aC2804d4A33173c2
dev $ npx truffle --network matic run etherscan --implementation SuperToken@0x1305F6B6Df9Dc47159D12Eb7aC2804d4A33173c2  
No contract name(s) specified
hellwolf commented 2 years ago

How to use it?

rkalis commented 2 years ago

Should be

truffle run verify <ProxyContractName> -- implementation SuperToken --network matic
hellwolf commented 2 years ago

e.g. https://polygonscan.com/address/0x1305F6B6Df9Dc47159D12Eb7aC2804d4A33173c2#code

$ npx truffle --network matic run etherscan UUPSProxy@0x1305F6B6Df9Dc47159D12Eb7aC2804d4A33173c2  
Verifying UUPSProxy@0x1305F6B6Df9Dc47159D12Eb7aC2804d4A33173c2
No implimentation contract found, skipping implementation verification.
Verifying Proxy Contract
Already Verified: https://polygonscan.com/address/0x1305F6B6Df9Dc47159D12Eb7aC2804d4A33173c2#code
Successfully verified 1 contract(s).

^--- the message looks confusing "No implimentation contract found, skipping implementation verification.", should be more like "implementation found, but choosing not to verify it".

$ npx truffle --network matic run etherscan UUPSProxy@0x1305F6B6Df9Dc47159D12Eb7aC2804d4A33173c2  --implementation SuperToken 
Verifying UUPSProxy@0x1305F6B6Df9Dc47159D12Eb7aC2804d4A33173c2
Verifying SuperToken at 0xc304cef3bb75b2638633aec178df09fd058a0f9c
Cannot set property 'address' of undefined
Failed to verify 1 contract(s): UUPSProxy@0x1305F6B6Df9Dc47159D12Eb7aC2804d4A33173c2

^---- this failed.

rkalis commented 2 years ago

Thanks for testing. Great point about the comment. This made me realise that this update also breaks the "automatic" proxy verification for OZ proxies, since you now have to submit an implementation. We'll need to restructure some things to do properly.

hellwolf commented 2 years ago

Yes, it will break out pipeline too, but happy to adapt in any case. I will watch this issue. No issues!

akshaydevh commented 2 years ago

Gotcha, Thanks @hellwolf @rkalis. I'll try to fix the issues mentioned above

d10r commented 2 years ago

I gave it a shot and was able to fix it - at least for the case described. Created a new PR for it at https://github.com/rkalis/truffle-plugin-verify/pull/173, but feel free to add and merge here!

rkalis commented 2 years ago

I just merged #173, which supersedes this PR. Thanks so much @akshaydevh and @d10r 💪