wevm / viem

TypeScript Interface for Ethereum
https://viem.sh
Other
2.55k stars 843 forks source link

Public action `verifyHash` does not work with zksync public client #2484

Closed tahos81 closed 4 months ago

tahos81 commented 4 months ago

Check existing issues

Viem Version

2.16.5

Current Behavior

When doing anything that uses verifyHash internally (like verifySiweMessage) if the public client in context is a zksync client verification fails. Reason for that is verifyHash uses erc-6492 for signature verification and has a constant called universalSignatureValidatorByteCode but regular bytecodes does not work on zksync so verification fails even when the signature is valid. This is not a problem for eoa's (you can just verify with an arbitrary public client) but it is breaking for smart contract accounts

Expected Behavior

Either a different constant bytecode should be used when the chain in context is zksync or 6492 flow should not be used and verification flow should revert to old flow (1271 + ecrecover).

Steps To Reproduce

No response

Link to Minimal Reproducible Example

https://stackblitz.com/edit/viem-getting-started-shqa8r?file=index.ts

Anything else?

No response

jxom commented 4 months ago

Unfortunately, zkSync handles contract deployments a bit differently to Ethereum, so using different bytecode / deployless verification probably won't work. :\

Can see what I can do.

jxom commented 4 months ago

Added a fallback for this scenario here: https://github.com/wevm/viem/commit/ec3b0e08f0a379249224e65092277191f1a8502b.

github-actions[bot] commented 3 months ago

This issue has been locked since it has been closed for more than 14 days.

If you found a concrete bug or regression related to it, please open a new bug report with a reproduction against the latest Viem version. If you have any questions or comments you can create a new discussion thread.