hardhat-zksync icon indicating copy to clipboard operation
hardhat-zksync copied to clipboard

Bytecodes differ only in last 32 bytes. The contract cannot be verified.

Open semiok opened this issue 1 year ago • 6 comments

I deployed the contract first, but the code of the deployed contract was not committed immediately, after the deployment, I clean up the code and deleted the newlines or spaces. But when i want to verify the contract, the bytecodes does not match in last 32 bytes.

Theoretically the original code should produce the same bytecodes as the code added with some blank lines, but I found that zk mainnet/testnet source code verification system rejects such changes.

I am able to compiled to a bytecodes that matched the one on-chain except the last 32 bytes. Will the zk team are able to update the validation rules for the plugin to support this case? Just similar to the validation rules of Ethereum. As more developers get into zksync, I think a lot of people will encounter this problem.

Thanks.

semiok avatar May 13 '23 11:05 semiok

I am experiencing the same issue too, the last 32 bytes should not be failing the verification process.

reednow avatar May 15 '23 06:05 reednow

+1

tonyke-bot avatar May 15 '23 08:05 tonyke-bot

wondering any updates on this issue?

AaronNan24 avatar Sep 26 '23 03:09 AaronNan24

Hi, long delay but have only seen this recently. The last 32 bytes contain the metadata. This includes code from the source files and file paths and names. The checks are strict for the plugins and on the verification service for the explorer as of this moment.

idea404 avatar Dec 13 '23 15:12 idea404

Thank you for your response. Yes, I'm aware that this is referred to as "full verification". However, Ethereum also supports "partial verification", which ignores the hash of the metadata part, as it is irrelevant to the code logic. Do you have any plans to support "partial verification"?

ethereum verifying smart contracts

reednow avatar Dec 16 '23 01:12 reednow

Hi, long delay but have only seen this recently. The last 32 bytes contain the metadata. This includes code from the source files and file paths and names. The checks are strict for the plugins and on the verification service for the explorer as of this moment.

Hello, is there a way to decode these last 32 bytes to get the metadata ? or is it just a hashed representation of it ?

clemsos avatar Feb 06 '24 16:02 clemsos