Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support eth_signTypedData_v4 in Anvil #2458

Closed
sunwrobert opened this issue Jul 24, 2022 · 2 comments · Fixed by #2472
Closed

Support eth_signTypedData_v4 in Anvil #2458

sunwrobert opened this issue Jul 24, 2022 · 2 comments · Fixed by #2472
Assignees
Labels
C-anvil Command: anvil T-feature Type: feature
Milestone

Comments

@sunwrobert
Copy link

Component

Anvil

Describe the feature you would like

Anvil seems to be missing a pretty key feature that Hardhat supports that makes it hard to replace Hardhat with Anvil. This is the method eth_signTypedData_v4. Without this we can't test a lot of flows that require message signing that we were able to do using Hardhat, at least using the provided dev accounts.

How to repro:

  1. Run anvil anvil --fork-url="https://eth-mainnet.alchemyapi.io/v2/XXXXXXX" --fork-block-number=15187941 --port=8545 --block-time=5 --chain-id=1
  2. Execute this in another process:
curl -X POST http://localhost:8545 -d '{"jsonrpc": "2.0", "method": "eth_signTypedData_v4", "params": ["0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", "{\"types\":{\"EIP712Domain\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"version\",\"type\":\"string\"},{\"name\":\"chainId\",\"type\":\"uint256\"},{\"name\":\"verifyingContract\",\"type\":\"address\"}],\"OrderComponents\":[{\"name\":\"offerer\",\"type\":\"address\"},{\"name\":\"zone\",\"type\":\"address\"},{\"name\":\"offer\",\"type\":\"OfferItem[]\"},{\"name\":\"consideration\",\"type\":\"ConsiderationItem[]\"},{\"name\":\"orderType\",\"type\":\"uint8\"},{\"name\":\"startTime\",\"type\":\"uint256\"},{\"name\":\"endTime\",\"type\":\"uint256\"},{\"name\":\"zoneHash\",\"type\":\"bytes32\"},{\"name\":\"salt\",\"type\":\"uint256\"},{\"name\":\"conduitKey\",\"type\":\"bytes32\"},{\"name\":\"counter\",\"type\":\"uint256\"}],\"OfferItem\":[{\"name\":\"itemType\",\"type\":\"uint8\"},{\"name\":\"token\",\"type\":\"address\"},{\"name\":\"identifierOrCriteria\",\"type\":\"uint256\"},{\"name\":\"startAmount\",\"type\":\"uint256\"},{\"name\":\"endAmount\",\"type\":\"uint256\"}],\"ConsiderationItem\":[{\"name\":\"itemType\",\"type\":\"uint8\"},{\"name\":\"token\",\"type\":\"address\"},{\"name\":\"identifierOrCriteria\",\"type\":\"uint256\"},{\"name\":\"startAmount\",\"type\":\"uint256\"},{\"name\":\"endAmount\",\"type\":\"uint256\"},{\"name\":\"recipient\",\"type\":\"address\"}]},\"primaryType\":\"OrderComponents\",\"domain\":{\"name\":\"Seaport\",\"version\":\"1.1\",\"chainId\":\"1\",\"verifyingContract\":\"0x00000000006c3852cbEf3e08E8dF289169EdE581\"},\"message\":{\"offerer\":\"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266\",\"offer\":[{\"itemType\":\"3\",\"token\":\"0xA604060890923Ff400e8c6f5290461A83AEDACec\",\"identifierOrCriteria\":\"110194434039389003190498847789203126033799499726478230611233094448886344768909\",\"startAmount\":\"1\",\"endAmount\":\"1\"}],\"consideration\":[{\"itemType\":\"0\",\"token\":\"0x0000000000000000000000000000000000000000\",\"identifierOrCriteria\":\"0\",\"startAmount\":\"487500000000000000\",\"endAmount\":\"487500000000000000\",\"recipient\":\"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266\"},{\"itemType\":\"0\",\"token\":\"0x0000000000000000000000000000000000000000\",\"identifierOrCriteria\":\"0\",\"startAmount\":\"12500000000000000\",\"endAmount\":\"12500000000000000\",\"recipient\":\"0x8De9C5A032463C561423387a9648c5C7BCC5BC90\"}],\"startTime\":\"1658645591\",\"endTime\":\"1659250386\",\"orderType\":\"3\",\"zone\":\"0x004C00500000aD104D7DBd00e3ae0A5C00560C00\",\"zoneHash\":\"0x0000000000000000000000000000000000000000000000000000000000000000\",\"salt\":\"16178208897136618\",\"conduitKey\":\"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000\",\"totalOriginalConsiderationItems\":\"2\",\"counter\":\"0\"}}"], "id": "1"}' -H "Content-Type: application/json"
  1. Notice that {"jsonrpc":"2.0","id":"1","error":{"code":-32601,"message":"Method not found"}}% is returned.

If I run the same using Hardhat, I get the following response:
{"jsonrpc":"2.0","id":"1","result":"0xedb0fa55ac67e3ca52b6bd6ee3576b193731adc2aff42151f67826932fa9f6191261ebdecc2c650204ff7625752b033293fb67ef5cfca78e16de359200040b761b"}%

Additional context

No response

@sunwrobert sunwrobert added the T-feature Type: feature label Jul 24, 2022
@gakonst gakonst added this to Foundry Jul 24, 2022
@gakonst gakonst moved this to Todo in Foundry Jul 24, 2022
@sunwrobert sunwrobert changed the title Support eth_signTypedData_v4 in Anvil. Support eth_signTypedData_v4 in Anvil Jul 24, 2022
@onbjerg onbjerg added the C-anvil Command: anvil label Jul 24, 2022
@tynes
Copy link
Contributor

tynes commented Jul 25, 2022

This seems like a very high leverage feature to add to anvil

@onbjerg onbjerg added this to the v1.0.0 milestone Jul 25, 2022
@mattsse
Copy link
Member

mattsse commented Jul 25, 2022

currently implementing this, writing tests now, should land shortly

@onbjerg onbjerg moved this from Todo to In Progress in Foundry Jul 25, 2022
Repository owner moved this from In Progress to Done in Foundry Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-feature Type: feature
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants