wevm / viem

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

fix: erc6492 verification #2552

Closed wilsoncusack closed 1 month ago

wilsoncusack commented 1 month ago

DeploylessUniversalSigValidator.sol behavior does not currently match the spec, in that it does not call the factory if the account is already deployed.

According to the EIP, for the signer

... If the contract is deployed but not ready to verify using ERC-1271, wrap the signature as follows: concat(abi.encode((prepareTo, prepareData, originalERC1271Signature), (address, bytes, bytes)), magicBytes); prepareTo and prepareData must contain the necessary transaction that will make the contract ready to verify using ERC-1271 (e.g. a call to migrate or update)

and the verifier should call this "factory" with the calldata if the magic bytes are present

check if the signature ends with magic bytes, in which case do an eth_call to a multicall contract that will call the factory first with the factoryCalldata and deploy the contract if it isn’t already deployed; Then, call contract.isValidSignature as usual with the unwrapped signature

This PR currently just attempting to creating a broken test demonstrating the issue.


PR-Codex overview

Summary

Fixes ERC6492 verification and prepares for user operation gas estimation.

Detailed summary

The following files were skipped due to too many changes: src/constants/contracts.ts, src/account-abstraction/actions/bundler/prepareUserOperation.test.ts

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

changeset-bot[bot] commented 1 month ago

🦋 Changeset detected

Latest commit: fcde67777cef1a211edae2d308c7e547d3cebe09

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---- | ----- | | viem | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

vercel[bot] commented 1 month ago

@wilsoncusack is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.