matter-labs / hardhat-zksync

Apache License 2.0
279 stars 227 forks source link

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

Open semiok opened 1 year ago

semiok commented 1 year ago

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.

reednow commented 1 year ago

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

tonyke-bot commented 1 year ago

+1

AaronNan24 commented 1 year ago

wondering any updates on this issue?

idea404 commented 11 months ago

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.

reednow commented 11 months ago

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

clemsos commented 9 months ago

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 ?