Skip to content

Commit 519184c

Browse files
authored
Configure Foundry linter (#5859)
1 parent 4a67c6f commit 519184c

File tree

13 files changed

+44
-35
lines changed

13 files changed

+44
-35
lines changed
Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
--- access/manager/AccessManager.sol 2023-10-05 12:17:09.694051809 -0300
2-
+++ access/manager/AccessManager.sol 2023-10-05 12:26:18.498688718 -0300
3-
@@ -6,7 +6,6 @@
1+
--- access/manager/AccessManager.sol 2025-08-16 15:15:34
2+
+++ access/manager/AccessManager.sol 2025-08-16 15:17:51
3+
@@ -7,7 +7,6 @@
44
import {IAccessManaged} from "./IAccessManaged.sol";
55
import {Address} from "../../utils/Address.sol";
66
import {Context} from "../../utils/Context.sol";
77
-import {Multicall} from "../../utils/Multicall.sol";
88
import {Math} from "../../utils/math/Math.sol";
99
import {Time} from "../../utils/types/Time.sol";
10-
11-
@@ -57,7 +56,8 @@
12-
* mindful of the danger associated with functions such as {{Ownable-renounceOwnership}} or
13-
* {{AccessControl-renounceRole}}.
10+
import {Hashes} from "../../utils/cryptography/Hashes.sol";
11+
@@ -59,7 +58,8 @@
12+
* mindful of the danger associated with functions such as {Ownable-renounceOwnership} or
13+
* {AccessControl-renounceRole}.
1414
*/
1515
-contract AccessManager is Context, Multicall, IAccessManager {
1616
+// NOTE: The FV version of this contract doesn't include Multicall because CVL HAVOCs on any `delegatecall`.
1717
+contract AccessManager is Context, IAccessManager {
1818
using Time for *;
1919

2020
// Structure that stores the details for a target contract.
21-
@@ -105,7 +105,7 @@
21+
@@ -115,7 +115,7 @@
2222

2323
// Used to identify operations that are currently being executed via {execute}.
2424
// This should be transient storage when supported by the EVM.
2525
- bytes32 private _executionId;
2626
+ bytes32 internal _executionId; // private → internal for FV
2727

2828
/**
29-
* @dev Check that the caller is authorized to perform the operation, following the restrictions encoded in
30-
@@ -253,6 +253,11 @@
29+
* @dev Check that the caller is authorized to perform the operation.
30+
@@ -263,6 +263,11 @@
3131
_setGrantDelay(roleId, newDelay);
3232
}
3333

@@ -39,28 +39,28 @@
3939
/**
4040
* @dev Internal version of {grantRole} without access control. Returns true if the role was newly granted.
4141
*
42-
@@ -287,6 +292,11 @@
43-
return newMember;
44-
}
42+
@@ -295,6 +300,11 @@
4543

44+
emit RoleGranted(roleId, account, executionDelay, since, newMember);
45+
return newMember;
46+
+ }
47+
+
4648
+ // Exposed for FV
4749
+ function _getRoleGrantDelayFull(uint64 roleId) internal view virtual returns (uint32, uint32, uint48) {
4850
+ return _roles[roleId].grantDelay.getFull();
49-
+ }
50-
+
51-
/**
52-
* @dev Internal version of {revokeRole} without access control. This logic is also used by {renounceRole}.
53-
* Returns true if the role was previously granted.
54-
@@ -586,7 +596,7 @@
51+
}
52+
5553
/**
56-
* @dev Check if the current call is authorized according to admin logic.
54+
@@ -596,7 +606,7 @@
55+
*
56+
* WARNING: Carefully review the considerations of {AccessManaged-restricted} since they apply to this modifier.
5757
*/
5858
- function _checkAuthorized() private {
5959
+ function _checkAuthorized() internal virtual { // private → internal virtual for FV
6060
address caller = _msgSender();
6161
(bool immediate, uint32 delay) = _canCallSelf(caller, _msgData());
6262
if (!immediate) {
63-
@@ -609,7 +619,7 @@
63+
@@ -619,7 +629,7 @@
6464
*/
6565
function _getAdminRestrictions(
6666
bytes calldata data
@@ -69,7 +69,7 @@
6969
if (data.length < 4) {
7070
return (false, 0, 0);
7171
}
72-
@@ -662,7 +672,7 @@
72+
@@ -672,7 +682,7 @@
7373
address caller,
7474
address target,
7575
bytes calldata data
@@ -78,7 +78,7 @@
7878
if (target == address(this)) {
7979
return _canCallSelf(caller, data);
8080
} else {
81-
@@ -716,14 +726,14 @@
81+
@@ -728,14 +738,14 @@
8282
/**
8383
* @dev Extracts the selector from calldata. Panics if data is not at least 4 bytes
8484
*/
@@ -92,6 +92,6 @@
9292
*/
9393
- function _hashExecutionId(address target, bytes4 selector) private pure returns (bytes32) {
9494
+ function _hashExecutionId(address target, bytes4 selector) internal pure returns (bytes32) { // private → internal for FV
95-
return keccak256(abi.encode(target, selector));
95+
return Hashes.efficientKeccak256(bytes32(uint256(uint160(target))), selector);
9696
}
9797
}

contracts/access/manager/AccessManager.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {Context} from "../../utils/Context.sol";
1010
import {Multicall} from "../../utils/Multicall.sol";
1111
import {Math} from "../../utils/math/Math.sol";
1212
import {Time} from "../../utils/types/Time.sol";
13+
import {Hashes} from "../../utils/cryptography/Hashes.sol";
1314

1415
/**
1516
* @dev AccessManager is a central contract to store the permissions of a system.
@@ -735,6 +736,6 @@ contract AccessManager is Context, Multicall, IAccessManager {
735736
* @dev Hashing function for execute protection
736737
*/
737738
function _hashExecutionId(address target, bytes4 selector) private pure returns (bytes32) {
738-
return keccak256(abi.encode(target, selector));
739+
return Hashes.efficientKeccak256(bytes32(uint256(uint160(target))), selector);
739740
}
740741
}

contracts/account/extensions/draft-AccountERC7579.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import {ERC7579Utils, Mode, CallType, ExecType} from "../../account/utils/draft-
1919
import {EnumerableSet} from "../../utils/structs/EnumerableSet.sol";
2020
import {Bytes} from "../../utils/Bytes.sol";
2121
import {Packing} from "../../utils/Packing.sol";
22-
import {Address} from "../../utils/Address.sol";
2322
import {Calldata} from "../../utils/Calldata.sol";
2423
import {Account} from "../Account.sol";
2524

contracts/mocks/account/AccountMock.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {AccountERC7579} from "../../account/extensions/draft-AccountERC7579.sol"
77
import {AccountERC7579Hooked} from "../../account/extensions/draft-AccountERC7579Hooked.sol";
88
import {ERC721Holder} from "../../token/ERC721/utils/ERC721Holder.sol";
99
import {ERC1155Holder} from "../../token/ERC1155/utils/ERC1155Holder.sol";
10-
import {ERC4337Utils} from "../../account/utils/draft-ERC4337Utils.sol";
1110
import {ERC7739} from "../../utils/cryptography/signers/draft-ERC7739.sol";
1211
import {ERC7821} from "../../account/extensions/draft-ERC7821.sol";
1312
import {MODULE_TYPE_VALIDATOR} from "../../interfaces/draft-IERC7579.sol";

contracts/mocks/governance/GovernorNoncesKeyedMock.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {Governor, Nonces} from "../../governance/Governor.sol";
66
import {GovernorSettings} from "../../governance/extensions/GovernorSettings.sol";
77
import {GovernorCountingSimple} from "../../governance/extensions/GovernorCountingSimple.sol";
88
import {GovernorVotesQuorumFraction} from "../../governance/extensions/GovernorVotesQuorumFraction.sol";
9-
import {GovernorProposalGuardian} from "../../governance/extensions/GovernorProposalGuardian.sol";
109
import {GovernorNoncesKeyed} from "../../governance/extensions/GovernorNoncesKeyed.sol";
1110

1211
abstract contract GovernorNoncesKeyedMock is

contracts/mocks/token/ERC20BridgeableMock.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
pragma solidity ^0.8.20;
44

5-
import {ERC20, ERC20Bridgeable} from "../../token/ERC20/extensions/draft-ERC20Bridgeable.sol";
5+
import {ERC20Bridgeable} from "../../token/ERC20/extensions/draft-ERC20Bridgeable.sol";
66

77
abstract contract ERC20BridgeableMock is ERC20Bridgeable {
88
address private _bridge;

contracts/mocks/token/ERC20NoReturnMock.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ import {ERC20} from "../../token/ERC20/ERC20.sol";
66

77
abstract contract ERC20NoReturnMock is ERC20 {
88
function transfer(address to, uint256 amount) public override returns (bool) {
9+
// forge-lint: disable-next-line(erc20-unchecked-transfer)
910
super.transfer(to, amount);
1011
assembly {
1112
return(0, 0)
1213
}
1314
}
1415

1516
function transferFrom(address from, address to, uint256 amount) public override returns (bool) {
17+
// forge-lint: disable-next-line(erc20-unchecked-transfer)
1618
super.transferFrom(from, to, amount);
1719
assembly {
1820
return(0, 0)

contracts/mocks/utils/cryptography/ERC7739Mock.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
pragma solidity ^0.8.24;
44

5-
import {ECDSA} from "../../../utils/cryptography/ECDSA.sol";
65
import {ERC7739} from "../../../utils/cryptography/signers/draft-ERC7739.sol";
76
import {SignerECDSA} from "../../../utils/cryptography/signers/SignerECDSA.sol";
87
import {SignerP256} from "../../../utils/cryptography/signers/SignerP256.sol";

contracts/token/ERC721/extensions/ERC721Wrapper.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ abstract contract ERC721Wrapper is ERC721, IERC721Receiver {
3636
// This is an "unsafe" transfer that doesn't call any hook on the receiver. With underlying() being trusted
3737
// (by design of this contract) and no other contracts expected to be called from there, we are safe.
3838
// slither-disable-next-line reentrancy-no-eth
39-
underlying().transferFrom(_msgSender(), address(this), tokenId);
39+
underlying().transferFrom(_msgSender(), address(this), tokenId); // forge-lint: disable-line(erc20-unchecked-transfer)
4040
_safeMint(account, tokenId);
4141
}
4242

contracts/utils/cryptography/draft-ERC7739Utils.sol

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
pragma solidity ^0.8.20;
55

66
import {Calldata} from "../Calldata.sol";
7+
import {Hashes} from "./Hashes.sol";
78

89
/**
910
* @dev Utilities to process https://ercs.ethereum.org/ERCS/erc-7739[ERC-7739] typed data signatures
@@ -101,7 +102,7 @@ library ERC7739Utils {
101102
* This is used to simulates the `personal_sign` RPC method in the context of smart contracts.
102103
*/
103104
function personalSignStructHash(bytes32 contents) internal pure returns (bytes32) {
104-
return keccak256(abi.encode(PERSONAL_SIGN_TYPEHASH, contents));
105+
return Hashes.efficientKeccak256(PERSONAL_SIGN_TYPEHASH, contents);
105106
}
106107

107108
/**

0 commit comments

Comments
 (0)