Skip to content

Commit 53319a3

Browse files
committed
remove superfluous test and fix 712 hashing issue
1 parent 7efeddf commit 53319a3

File tree

2 files changed

+1
-23
lines changed

2 files changed

+1
-23
lines changed

src/CowEvcBaseWrapper.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ abstract contract CowEvcBaseWrapper is CowWrapper, PreApprovedHashes {
121121

122122
// Build digest = keccak256("\x19\x01" || domainSeparator || structHash)
123123
let ptr := mload(0x40)
124+
mstore(ptr, "\x19\x01")
124125
mstore(add(ptr, 0x02), separator)
125126
mstore(add(ptr, 0x22), structHash)
126127
digest := keccak256(ptr, 0x42)

test/unit/CowEvcOpenPositionWrapper.unit.t.sol

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -176,29 +176,6 @@ contract CowEvcOpenPositionWrapperUnitTest is Test {
176176
assertNotEq(hash1, hash3, "Hash should differ for different params");
177177
}
178178

179-
function test_GetApprovalHash_MatchesEIP712() public view {
180-
CowEvcOpenPositionWrapper.OpenPositionParams memory params = _getDefaultParams();
181-
182-
// EIP-712 compliant structHash must include the TYPE_HASH
183-
bytes32 structHash = keccak256(
184-
abi.encode(
185-
wrapper.OPEN_POSITION_PARAMS_TYPE_HASH(),
186-
params.owner,
187-
params.account,
188-
params.deadline,
189-
params.collateralVault,
190-
params.borrowVault,
191-
params.collateralAmount,
192-
params.borrowAmount
193-
)
194-
);
195-
196-
bytes32 expectedDigest = keccak256(abi.encodePacked("\x19\x01", wrapper.DOMAIN_SEPARATOR(), structHash));
197-
bytes32 actualDigest = wrapper.getApprovalHash(params);
198-
199-
assertEq(actualDigest, expectedDigest, "Hash should match EIP-712 format");
200-
}
201-
202179
/*//////////////////////////////////////////////////////////////
203180
GET SIGNED CALLDATA TESTS
204181
//////////////////////////////////////////////////////////////*/

0 commit comments

Comments
 (0)