Skip to content
Request an audit

‹ All findings

Signatures in the SyrupRouter are not fully compatible with EIP712

Low/InfoMaple Syrup Router·by the Three Sigma team·Permissionless lending·21st May 20243S-Sy-N01

Description

EIP712 defines the digest as keccak256("\x19\x01" ‖ domainSeparator ‖ hashStruct(message)). domainSeparator is keccak256(abi.encode(TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))).

TYPE_HASH is keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); hashStruct(message)) is dependent on the application, ERC20Permit is a good example.

In this case it would be something like: ​ AUTH_TYPEHASH = keccak256("Auth(address lender,uint256 nonce,uint256 bitmap,uint256 deadline)");​ bytes32 structHash = keccak256(abi.encode(AUTH_TYPEHASH, msg.sender, nonces[msg.sender]++, bitmap, deadline);​

And the final digest is keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash).

Recommendation

To be strictly compliant, the structure above should be applied. However, signatures are signed by Maple so it has no impact on users.

Status

Acknowledged