Add EIP-712 support for Account v2#21
Add EIP-712 support for Account v2#210xyanc wants to merge 9 commits intotokenbound:jw/account-v2from
Conversation
jaydenwindle
left a comment
There was a problem hiding this comment.
Awesome stuff @0xyanc! A few small change requests for you, then would love to merge this in
src/Account.sol
Outdated
| constructor(address _guardian, address entryPoint_) { | ||
| if (_guardian == address(0) || entryPoint_ == address(0)) | ||
| constructor(address _guardian, address entryPoint_, string memory _name, string memory _version) | ||
| EIP712(_name, _version) |
There was a problem hiding this comment.
Can we make the name and version fields constant instead of passed as constructor arguments? Makes it easier to reason about when deploying :)
src/Account.sol
Outdated
| userOp.preVerificationGas, | ||
| userOp.maxFeePerGas, | ||
| userOp.maxPriorityFeePerGas, | ||
| userOp.paymasterAndData |
There was a problem hiding this comment.
Can we include userOpHash in the typed data fields?
There was a problem hiding this comment.
This userOpHash would be the hash returned by the EntryPoint?
There was a problem hiding this comment.
Yep! Also passed into the _validateSignature function as a parameter
There was a problem hiding this comment.
Had to copy the UserOperation in memory as I get "Stack too deep" error otherwise
test/AccountERC4337.t.sol
Outdated
| assertEq(accountAddress.balance, 1 ether); | ||
| } | ||
|
|
||
| function _buildOpHash( |
There was a problem hiding this comment.
Can we expose this as a public getter on the account contract? So that it can be accessed easily by clients.
There was a problem hiding this comment.
Exposed buildUserOp712Hash(UserOperation memory op, bytes32 opHash) in Account.sol
src/Account.sol
Outdated
| ) == IERC1271.isValidSignature.selector; | ||
| bytes32 hashStruct = keccak256( | ||
| abi.encode( | ||
| keccak256( |
There was a problem hiding this comment.
Can we make the hash of this typed data a public constant?
There was a problem hiding this comment.
Made an immutable variable so the hash is not computed each time
Co-authored-by: Jayden Windle <jaydenwindle@gmail.com>
… into account-v2-eip712
No description provided.