Skip to content

Commit

Permalink
feat: slight optimization to hashStruct
Browse files Browse the repository at this point in the history
  • Loading branch information
Zer0dot committed Aug 22, 2024
1 parent 2166533 commit 3400f3d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/modules/ReplaySafeWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ abstract contract ReplaySafeWrapper is ModuleEIP712 {
});
}

function _hashStruct(bytes32 hash) internal view virtual returns (bytes32) {
return keccak256(abi.encode(_REPLAY_SAFE_HASH_TYPEHASH, hash));
function _hashStruct(bytes32 hash) internal pure virtual returns (bytes32) {
bytes32 res;
assembly ("memory-safe") {
mstore(0x00, _REPLAY_SAFE_HASH_TYPEHASH)
mstore(0x20, hash)
res := keccak256(0x00, 0x40)
}
return res;
}
}

0 comments on commit 3400f3d

Please sign in to comment.