|
| 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 @@ |
| 4 | + import {IAccessManaged} from "./IAccessManaged.sol"; |
| 5 | + import {Address} from "../../utils/Address.sol"; |
| 6 | + import {Context} from "../../utils/Context.sol"; |
| 7 | +-import {Multicall} from "../../utils/Multicall.sol"; |
| 8 | + import {Math} from "../../utils/math/Math.sol"; |
| 9 | + 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}}. |
| 14 | + */ |
| 15 | +-contract AccessManager is Context, Multicall, IAccessManager { |
| 16 | ++// NOTE: The FV version of this contract doesn't include Multicall because CVL HAVOCs on any `delegatecall`. |
| 17 | ++contract AccessManager is Context, IAccessManager { |
| 18 | + using Time for *; |
| 19 | + |
| 20 | + // Structure that stores the details for a target contract. |
| 21 | +@@ -105,7 +105,7 @@ |
| 22 | + |
| 23 | + // Used to identify operations that are currently being executed via {execute}. |
| 24 | + // This should be transient storage when supported by the EVM. |
| 25 | +- bytes32 private _executionId; |
| 26 | ++ bytes32 internal _executionId; // private → internal for FV |
| 27 | + |
| 28 | + /** |
| 29 | + * @dev Check that the caller is authorized to perform the operation, following the restrictions encoded in |
| 30 | +@@ -253,6 +253,11 @@ |
| 31 | + _setGrantDelay(roleId, newDelay); |
| 32 | + } |
| 33 | + |
| 34 | ++ // Exposed for FV |
| 35 | ++ function _getTargetAdminDelayFull(address target) internal view virtual returns (uint32, uint32, uint48) { |
| 36 | ++ return _targets[target].adminDelay.getFull(); |
| 37 | ++ } |
| 38 | ++ |
| 39 | + /** |
| 40 | + * @dev Internal version of {grantRole} without access control. Returns true if the role was newly granted. |
| 41 | + * |
| 42 | +@@ -287,6 +292,11 @@ |
| 43 | + return newMember; |
| 44 | + } |
| 45 | + |
| 46 | ++ // Exposed for FV |
| 47 | ++ function _getRoleGrantDelayFull(uint64 roleId) internal view virtual returns (uint32, uint32, uint48) { |
| 48 | ++ 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 @@ |
| 55 | + /** |
| 56 | + * @dev Check if the current call is authorized according to admin logic. |
| 57 | + */ |
| 58 | +- function _checkAuthorized() private { |
| 59 | ++ function _checkAuthorized() internal virtual { // private → internal virtual for FV |
| 60 | + address caller = _msgSender(); |
| 61 | + (bool immediate, uint32 delay) = _canCallSelf(caller, _msgData()); |
| 62 | + if (!immediate) { |
| 63 | +@@ -609,7 +619,7 @@ |
| 64 | + */ |
| 65 | + function _getAdminRestrictions( |
| 66 | + bytes calldata data |
| 67 | +- ) private view returns (bool restricted, uint64 roleAdminId, uint32 executionDelay) { |
| 68 | ++ ) internal view returns (bool restricted, uint64 roleAdminId, uint32 executionDelay) { // private → internal for FV |
| 69 | + if (data.length < 4) { |
| 70 | + return (false, 0, 0); |
| 71 | + } |
| 72 | +@@ -662,7 +672,7 @@ |
| 73 | + address caller, |
| 74 | + address target, |
| 75 | + bytes calldata data |
| 76 | +- ) private view returns (bool immediate, uint32 delay) { |
| 77 | ++ ) internal view returns (bool immediate, uint32 delay) { // private → internal for FV |
| 78 | + if (target == address(this)) { |
| 79 | + return _canCallSelf(caller, data); |
| 80 | + } else { |
| 81 | +@@ -716,14 +726,14 @@ |
| 82 | + /** |
| 83 | + * @dev Extracts the selector from calldata. Panics if data is not at least 4 bytes |
| 84 | + */ |
| 85 | +- function _checkSelector(bytes calldata data) private pure returns (bytes4) { |
| 86 | ++ function _checkSelector(bytes calldata data) internal pure returns (bytes4) { // private → internal for FV |
| 87 | + return bytes4(data[0:4]); |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * @dev Hashing function for execute protection |
| 92 | + */ |
| 93 | +- function _hashExecutionId(address target, bytes4 selector) private pure returns (bytes32) { |
| 94 | ++ function _hashExecutionId(address target, bytes4 selector) internal pure returns (bytes32) { // private → internal for FV |
| 95 | + return keccak256(abi.encode(target, selector)); |
| 96 | + } |
| 97 | + } |
0 commit comments