-
Use
calldata
for thetxns
parameter in theexecuteBatch()
function.
https://github.com/AmbireTech/ambire-common/blob/5c54f8005e90ad481df8e34e85718f3d2bfa2ace/contracts/AmbireAccount.sol#L217 -
Use
calldata
for thetxn
variable in theexecuteBatch()
function.
https://github.com/AmbireTech/ambire-common/blob/5c54f8005e90ad481df8e34e85718f3d2bfa2ace/contracts/AmbireAccount.sol#L220
- In
deploySafe()
the check in line 59 (addr != address(0)
) is not needed as it would be already covered by the check in line 60 (addr == expectedAddr
).
https://github.com/AmbireTech/ambire-common/blob/5c54f8005e90ad481df8e34e85718f3d2bfa2ace/contracts/AmbireAccountFactory.sol#L59
-
Usages of
readBytes32()
helper don't need to check the index parameter as all these cases are guaranteed to be within bounds due to checks in surrounding code.- Usages in line 55 and 56 are already validated by the
require
in line 54.
https://github.com/AmbireTech/ambire-common/blob/5c54f8005e90ad481df8e34e85718f3d2bfa2ace/contracts/libs/SignatureValidator.sol#L55-L56 - Usage in line 101 is already validated by the
require
in line 96.
https://github.com/AmbireTech/ambire-common/blob/5c54f8005e90ad481df8e34e85718f3d2bfa2ace/contracts/libs/SignatureValidator.sol#L101
- Usages in line 55 and 56 are already validated by the
-
The check for
signer != address(0)
in line 105 is not needed as the call towallet.isValidSignature()
would have failed if the wallet address were the zero address.
https://github.com/AmbireTech/ambire-common/blob/5c54f8005e90ad481df8e34e85718f3d2bfa2ace/contracts/libs/SignatureValidator.sol#L105 -
modeRaw
variable is already checked by Solidity to be a valid value during the casting toSignatureMode
. TheLastUnused
enum value is also unneeded. https://github.com/AmbireTech/ambire-common/blob/5c54f8005e90ad481df8e34e85718f3d2bfa2ace/contracts/libs/SignatureValidator.sol#L49-L50 -
Calls to
trimToSize()
inrecoverAddrImpl()
can be done using unchecked math in the calculation ofsig.length - 1
as the signature length has been already validated to be greater than 0.
https://github.com/AmbireTech/ambire-common/blob/5c54f8005e90ad481df8e34e85718f3d2bfa2ace/contracts/libs/SignatureValidator.sol#L69
https://github.com/AmbireTech/ambire-common/blob/5c54f8005e90ad481df8e34e85718f3d2bfa2ace/contracts/libs/SignatureValidator.sol#L84