From 5d87857b1ef33eac1c377a9a65c6ae1445ea7118 Mon Sep 17 00:00:00 2001 From: Akshay Date: Thu, 4 Jul 2024 16:03:38 +0200 Subject: [PATCH] [#754] Use calldataload instruction --- modules/4337/contracts/Safe4337Module.sol | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/modules/4337/contracts/Safe4337Module.sol b/modules/4337/contracts/Safe4337Module.sol index 6c2bc7414..42f77904c 100644 --- a/modules/4337/contracts/Safe4337Module.sol +++ b/modules/4337/contracts/Safe4337Module.sol @@ -213,8 +213,6 @@ contract Safe4337Module is IAccount, HandlerContext, CompatibilityFallbackHandle /** * @dev Checks if the signatures length is correct and does not contain addtional bytes. - * The code uses scratch space to store s and v values of the signatures. - * 0x00 stores s value and 0x20 stores v value. * As checkSignatures is expected to check whether signature length is aleast threshold * 0x41, it is skipped here. * @param signatures signatures data * @param threshold Indicates the number of iterations to perform in the loop. @@ -228,10 +226,8 @@ contract Safe4337Module is IAccount, HandlerContext, CompatibilityFallbackHandle /// @solidity memory-safe-assembly assembly { let signaturePos := mul(0x41, i) - calldatacopy(0x00, add(signatures.offset, add(signaturePos, 0x20)), 0x20) - let s := mload(0x00) - calldatacopy(0x20, add(signatures.offset, add(signaturePos, 0x40)), 0x20) - let v := byte(0, mload(0x20)) + let s:= calldataload(add(signatures.offset, add(signaturePos, 0x20))) + let v := byte(0, calldataload(add(signatures.offset, add(signaturePos, 0x40)))) if iszero(v) { // Require that the signature data pointer is pointing to the expected location, at the end of processed contract signatures.