Skip to content

Commit b34157d

Browse files
authored
Implement audit notes (#294)
1 parent 4bfc0c8 commit b34157d

File tree

9 files changed

+20
-13
lines changed

9 files changed

+20
-13
lines changed

contracts/GnosisSafe.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ contract GnosisSafe is
102102
}
103103

104104
/// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.
105-
/// Note: The fees are always transfered, even if the user transaction fails.
105+
/// Note: The fees are always transferred, even if the user transaction fails.
106106
/// @param to Destination address of Safe transaction.
107107
/// @param value Ether value of Safe transaction.
108108
/// @param data Data payload of Safe transaction.

contracts/GnosisSafeL2.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ contract GnosisSafeL2 is GnosisSafe {
2626
event SafeModuleTransaction(address module, address to, uint256 value, bytes data, Enum.Operation operation);
2727

2828
/// @dev Allows to execute a Safe transaction confirmed by required number of owners and then pays the account that submitted the transaction.
29-
/// Note: The fees are always transfered, even if the user transaction fails.
29+
/// Note: The fees are always transferred, even if the user transaction fails.
3030
/// @param to Destination address of Safe transaction.
3131
/// @param value Ether value of Safe transaction.
3232
/// @param data Data payload of Safe transaction.

contracts/base/FallbackManager.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ contract FallbackManager is SelfAuthorized {
2525
internalSetFallbackHandler(handler);
2626
}
2727

28+
// solhint-disable-next-line payable-fallback,no-complex-fallback
2829
fallback() external {
2930
bytes32 slot = FALLBACK_HANDLER_STORAGE_SLOT;
3031
// solhint-disable-next-line no-inline-assembly

contracts/base/OwnerManager.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ contract OwnerManager is SelfAuthorized {
1313
address internal constant SENTINEL_OWNERS = address(0x1);
1414

1515
mapping(address => address) internal owners;
16-
uint256 ownerCount;
16+
uint256 internal ownerCount;
1717
uint256 internal threshold;
1818

1919
/// @dev Setup function sets initial storage of contract.

contracts/common/SecuredTokenTransfer.sol

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,15 @@ contract SecuredTokenTransfer {
1717
bytes memory data = abi.encodeWithSelector(0xa9059cbb, receiver, amount);
1818
// solhint-disable-next-line no-inline-assembly
1919
assembly {
20-
let success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0)
21-
let ptr := mload(0x40)
22-
mstore(0x40, add(ptr, returndatasize()))
23-
returndatacopy(ptr, 0, returndatasize())
20+
// We write the return value to scratch space.
21+
// See https://docs.soliditylang.org/en/v0.7.6/internals/layout_in_memory.html#layout-in-memory
22+
let success := call(sub(gas(), 10000), token, 0, add(data, 0x20), mload(data), 0, 0x20)
2423
switch returndatasize()
2524
case 0 {
2625
transferred := success
2726
}
2827
case 0x20 {
29-
transferred := iszero(or(iszero(success), iszero(mload(ptr))))
28+
transferred := iszero(or(iszero(success), iszero(mload(0))))
3029
}
3130
default {
3231
transferred := 0

contracts/common/StorageAccessible.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ contract StorageAccessible {
1313
function getStorageAt(uint256 offset, uint256 length) public view returns (bytes memory) {
1414
bytes memory result = new bytes(length * 32);
1515
for (uint256 index = 0; index < length; index++) {
16+
// solhint-disable-next-line no-inline-assembly
1617
assembly {
1718
let word := sload(add(offset, index))
1819
mstore(add(add(result, 0x20), mul(index, 0x20)), word)

contracts/guards/DelegateCallTransactionGuard.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ contract DelegateCallTransactionGuard is Guard {
1212
allowedTarget = target;
1313
}
1414

15+
// solhint-disable-next-line payable-fallback
1516
fallback() external {
1617
// We don't revert on fallback to avoid issues in case of a Safe upgrade
1718
// E.g. The expected check method might change and then the Safe would be locked.
@@ -26,6 +27,7 @@ contract DelegateCallTransactionGuard is Guard {
2627
uint256,
2728
uint256,
2829
address,
30+
// solhint-disable-next-line no-unused-vars
2931
address payable,
3032
bytes memory,
3133
address

contracts/handler/CompatibilityFallbackHandler.sol

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,13 @@ contract CompatibilityFallbackHandler is DefaultCallbackHandler, ISignatureValid
6363
* @param targetContract Address of the contract containing the code to execute.
6464
* @param calldataPayload Calldata that should be sent to the target contract (encoded method name and arguments).
6565
*/
66-
function simulate(
67-
address targetContract, // solhint-disable-line no-unused-var
68-
bytes calldata calldataPayload // solhint-disable-line no-unused-var
69-
) public returns (bytes memory response) {
66+
function simulate(address targetContract, bytes calldata calldataPayload) external returns (bytes memory response) {
67+
// Suppress compiler warnings about not using parameters, while allowing
68+
// parameters to keep names for documentation purposes. This does not
69+
// generate code.
70+
targetContract;
71+
calldataPayload;
72+
7073
// solhint-disable-next-line no-inline-assembly
7174
assembly {
7275
let internalCalldata := mload(0x40)
@@ -87,7 +90,7 @@ contract CompatibilityFallbackHandler is DefaultCallbackHandler, ISignatureValid
8790
pop(
8891
call(
8992
gas(),
90-
// address() has been changed to caller() to use the implemtation of the Safe
93+
// address() has been changed to caller() to use the implementation of the Safe
9194
caller(),
9295
0,
9396
internalCalldata,

contracts/handler/HandlerContext.sol

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ contract HandlerContext {
1010
/// When using this functionality make sure that the linked _manager (aka msg.sender) supports this.
1111
function _msgSender() internal pure returns (address sender) {
1212
// The assembly code is more direct than the Solidity version using `abi.decode`.
13+
// solhint-disable-next-line no-inline-assembly
1314
assembly {
1415
sender := shr(96, calldataload(sub(calldatasize(), 20)))
1516
}

0 commit comments

Comments
 (0)