diff --git a/src/helpers/ERC7739ReplaySafeWrapper.sol b/src/helpers/ERC7739ReplaySafeWrapper.sol index 26600c1ea..e5a0afff6 100644 --- a/src/helpers/ERC7739ReplaySafeWrapper.sol +++ b/src/helpers/ERC7739ReplaySafeWrapper.sol @@ -88,12 +88,10 @@ library ERC7739ReplaySafeWrapper { digest := keccak256(m, 0xa0) //domain separator // Hash typed data - mstore(0x00, 0x1901000000000000) // Store "\x19\x01". - mstore(0x1a, digest) // Store the domain separator. - mstore(0x3a, structHash) // Store the struct hash. - digest := keccak256(0x18, 0x42) - // Restore the part of the free memory slot that was overwritten. - mstore(0x3a, 0) + mstore(m, 0x1901) // Store "\x19\x01". + mstore(add(m, 0x20), digest) // Store the domain separator. + mstore(add(m, 0x40), structHash) // Store the struct hash. + digest := keccak256(add(m, 0x1e), 0x42) } } @@ -167,12 +165,10 @@ library ERC7739ReplaySafeWrapper { digest := keccak256(m, 0xa0) //domain separator // Hash typed data - mstore(0x00, 0x1901000000000000) // Store "\x19\x01". - mstore(0x1a, digest) // Store the domain separator. - mstore(0x3a, structHash) // Store the struct hash. - digest := keccak256(0x18, 0x42) - // Restore the part of the free memory slot that was overwritten. - mstore(0x3a, 0) + mstore(m, 0x1901) // Store "\x19\x01". + mstore(add(m, 0x20), digest) // Store the domain separator. + mstore(add(m, 0x40), structHash) // Store the struct hash. + digest := keccak256(add(m, 0x1e), 0x42) } }