Closed as not planned
Description
Component
Forge
Describe the feature you would like
For EIP712 testing, it would be great to have a EIP712 digest generator that creates a 32 byte digest based the types, domain, and values following the algorithm defined in the EIP712 spec, or even a fully built signedTypedData
cheatcode.
I've had a lot of headache recently with EIP712 foundry tests passing when they shouldn't have because there was no way to test if a contract is computing a digest properly.
I am not sure what cheatcodes would look like in solidity, but I imagine passing a it:
- EIP712 domain struct
- The EIP712 type def: eg:
Transaction(Person from,Person to,Asset tx)Asset(address token,uint256 amount)Person(address wallet,string name)
- The
abi.encodePacked()
values of the struct
This could be a possible interface
function generateEIP712Digest(EIP712Domain memory domain, string memory eip712Type, bytes memory structValue) public view returns (string memory);
function signTypedData(uint256 privateKey, EIP712Domain memory domain, string memory eip712Type, bytes memory structValue) public view returns (uint8 v, bytes32 r, bytes32 s);
Additional context
No response
Metadata
Metadata
Assignees
Type
Projects
Status
Done