access_manager_AccessManager.sol.patch 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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. @@ -57,7 +56,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. @@ -105,7 +105,7 @@
  20. // Used to identify operations that are currently being executed via {execute}.
  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. @@ -253,6 +253,11 @@
  27. _setGrantDelay(roleId, newDelay);
  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 Internal version of {grantRole} without access control. Returns true if the role was newly granted.
  36. *
  37. @@ -287,6 +292,11 @@
  38. return newMember;
  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 Internal version of {revokeRole} without access control. This logic is also used by {renounceRole}.
  47. * Returns true if the role was previously granted.
  48. @@ -586,7 +596,7 @@
  49. /**
  50. * @dev Check if the current call is authorized according to admin logic.
  51. */
  52. - function _checkAuthorized() private {
  53. + function _checkAuthorized() internal virtual { // private → internal virtual for FV
  54. address caller = _msgSender();
  55. (bool immediate, uint32 delay) = _canCallSelf(caller, _msgData());
  56. if (!immediate) {
  57. @@ -609,7 +619,7 @@
  58. */
  59. function _getAdminRestrictions(
  60. bytes calldata data
  61. - ) private view returns (bool adminRestricted, uint64 roleAdminId, uint32 executionDelay) {
  62. + ) internal view returns (bool adminRestricted, uint64 roleAdminId, uint32 executionDelay) { // private → internal for FV
  63. if (data.length < 4) {
  64. return (false, 0, 0);
  65. }
  66. @@ -662,7 +672,7 @@
  67. address caller,
  68. address target,
  69. bytes calldata data
  70. - ) private view returns (bool immediate, uint32 delay) {
  71. + ) internal view returns (bool immediate, uint32 delay) { // private → internal for FV
  72. if (target == address(this)) {
  73. return _canCallSelf(caller, data);
  74. } else {
  75. @@ -716,14 +726,14 @@
  76. /**
  77. * @dev Extracts the selector from calldata. Panics if data is not at least 4 bytes
  78. */
  79. - function _checkSelector(bytes calldata data) private pure returns (bytes4) {
  80. + function _checkSelector(bytes calldata data) internal pure returns (bytes4) { // private → internal for FV
  81. return bytes4(data[0:4]);
  82. }
  83. /**
  84. * @dev Hashing function for execute protection
  85. */
  86. - function _hashExecutionId(address target, bytes4 selector) private pure returns (bytes32) {
  87. + function _hashExecutionId(address target, bytes4 selector) internal pure returns (bytes32) { // private → internal for FV
  88. return keccak256(abi.encode(target, selector));
  89. }
  90. }