access_manager_AccessManager.sol.patch 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. --- access/manager/AccessManager.sol 2023-10-04 11:20:52.802378968 +0200
  2. +++ access/manager/AccessManager.sol 2023-10-04 14:49:43.126279234 +0200
  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. @@ -48,7 +47,8 @@
  11. * mindful of the danger associated with functions such as {{Ownable-renounceOwnership}} or
  12. * {{AccessControl-renounceRole}}.
  13. */
  14. -contract AccessManager is Context, Multicall, IAccessManager {
  15. +// NOTE: The FV version of this contract doesn't include Multicall because CVL HAVOCs on any `delegatecall`.
  16. +contract AccessManager is Context, IAccessManager {
  17. using Time for *;
  18. // Structure that stores the details for a target contract.
  19. @@ -93,7 +93,7 @@
  20. mapping(bytes32 operationId => Schedule) private _schedules;
  21. // This should be transient storage when supported by the EVM.
  22. - bytes32 private _executionId;
  23. + bytes32 internal _executionId; // private → internal for FV
  24. /**
  25. * @dev Check that the caller is authorized to perform the operation, following the restrictions encoded in
  26. @@ -185,6 +185,11 @@
  27. return _targets[target].adminDelay.get();
  28. }
  29. + // Exposed for FV
  30. + function _getTargetAdminDelayFull(address target) internal view virtual returns (uint32, uint32, uint48) {
  31. + return _targets[target].adminDelay.getFull();
  32. + }
  33. +
  34. /**
  35. * @dev Get the id of the role that acts as an admin for given role.
  36. *
  37. @@ -213,6 +218,11 @@
  38. return _roles[roleId].grantDelay.get();
  39. }
  40. + // Exposed for FV
  41. + function _getRoleGrantDelayFull(uint64 roleId) internal view virtual returns (uint32, uint32, uint48) {
  42. + return _roles[roleId].grantDelay.getFull();
  43. + }
  44. +
  45. /**
  46. * @dev Get the access details for a given account for a given role. These details include the timepoint at which
  47. * membership becomes active, and the delay applied to all operation by this user that requires this permission
  48. @@ -749,7 +759,7 @@
  49. /**
  50. * @dev Hashing function for execute protection
  51. */
  52. - function _hashExecutionId(address target, bytes4 selector) private pure returns (bytes32) {
  53. + function _hashExecutionId(address target, bytes4 selector) internal pure returns (bytes32) { // private → internal for FV
  54. return keccak256(abi.encode(target, selector));
  55. }
  56. @@ -769,7 +779,7 @@
  57. /**
  58. * @dev Check if the current call is authorized according to admin logic.
  59. */
  60. - function _checkAuthorized() private {
  61. + function _checkAuthorized() internal virtual { // private → internal virtual for FV
  62. address caller = _msgSender();
  63. (bool immediate, uint32 delay) = _canCallSelf(caller, _msgData());
  64. if (!immediate) {
  65. @@ -792,7 +802,7 @@
  66. */
  67. function _getAdminRestrictions(
  68. bytes calldata data
  69. - ) private view returns (bool restricted, uint64 roleAdminId, uint32 executionDelay) {
  70. + ) internal view returns (bool restricted, uint64 roleAdminId, uint32 executionDelay) { // private → internal for FV
  71. if (data.length < 4) {
  72. return (false, 0, 0);
  73. }
  74. @@ -847,7 +857,7 @@
  75. address caller,
  76. address target,
  77. bytes calldata data
  78. - ) private view returns (bool immediate, uint32 delay) {
  79. + ) internal view returns (bool immediate, uint32 delay) { // private → internal for FV
  80. if (target == address(this)) {
  81. return _canCallSelf(caller, data);
  82. } else {
  83. @@ -901,7 +911,7 @@
  84. /**
  85. * @dev Extracts the selector from calldata. Panics if data is not at least 4 bytes
  86. */
  87. - function _checkSelector(bytes calldata data) private pure returns (bytes4) {
  88. + function _checkSelector(bytes calldata data) internal pure returns (bytes4) { // private → internal for FV
  89. return bytes4(data[0:4]);
  90. }
  91. }