Fun Pear Mantis
Medium
Inconsistent EIP-712 type hash definition for Fixed6 amount in Take.sol
and RelayedTake.sol
will lead to signature verification failures due to nested struct propagation
Inconsistent type hash definition where Fixed6 amount is defined as int256 in the STRUCT_HASH will cause signature verification failures for users, as the nested struct propagation in RelayedTake compounds the EIP-712 type hash mismatch from the base Take contract.
In Take.sol
, the STRUCT_HASH defines the amount field as int256
while the actual struct uses Fixed6
. This type mismatch is then propagated into RelayedTake.sol
STRUCT_HASH through its nested Take struct definition:
Take.sol:
struct Take {
Fixed6 amount; // Uses Fixed6
address referrer;
Common common;
}
bytes32 constant public STRUCT_HASH = keccak256(
"Take(int256 amount,address referrer,Common common)" // Defines as int256
...
);
RelayedTake.sol:
struct RelayedTake {
Take take; // Embeds Take struct
Action action;
}
bytes32 constant public STRUCT_HASH = keccak256(
"RelayedTake(Take take,Action action)"
...
"Take(int256 amount,address referrer,Common common)" // Propagates incorrect type
);
- User creates a signed Take message with a Fixed6 amount value
- The message is processed through either:
- Take contract directly, or
- RelayedTake contract which nests the Take struct
Not applicable. The vulnerability stems purely from the internal type mismatch between Fixed6 and int256 in the EIP-712 type hash definitions, and how this mismatch propagates through the nested struct implementation between Take.sol
and RelayedTake.sol
.
- User creates a Take with a Fixed6 amount
- The Fixed6 amount is internally scaled by 1e6 (BASE) as defined in Fixed6Lib
- When hashing for signature verification:
- In Take: The struct uses Fixed6 (scaled) but STRUCT_HASH expects int256 (unscaled)
- In RelayedTake: The nested Take struct inherits this mismatch, propagating it to the top-level signature verification
- Signature verification fails in both cases due to type mismatch and value scaling inconsistency
Users cannot execute signed Take operations as signature verifications will fail due to the type mismatch between Fixed6 and int256 in the EIP-712 domain separator. This impact is compounded because:
- The issue exists in both:
- Base Take contract (direct impact)
- RelayedTake contract (propagated impact through nested struct)
- All signed messages involving amounts will fail verification regardless of entry point
- This breaks the intended permissionless nature of the protocol for signed operations
- The nested struct relationship means fixing the issue requires coordinated updates to maintain consistency across both contracts
The architectural choice to nest the Take struct in RelayedTake.sol
while maintaining inconsistent type definitions amplifies the impact of this vulnerability across the protocol's signature verification system.
No response
No response