Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove legacy role, update error #53

Merged
merged 4 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions script/GenerateAccessManagerCallData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { console } from "forge-std/console.sol";
import { PufferVaultV2 } from "../src/PufferVaultV2.sol";
import { PufferDepositorV2 } from "../src/PufferDepositorV2.sol";
import { PufferDepositor } from "../src/PufferDepositor.sol";
import { PUBLIC_ROLE, ROLE_ID_DAO, ROLE_ID_PUFFER_PROTOCOL, ADMIN_ROLE, ROLE_ID_OPERATIONS } from "./Roles.sol";
import { PUBLIC_ROLE, ROLE_ID_DAO, ROLE_ID_PUFFER_PROTOCOL, ROLE_ID_OPERATIONS } from "./Roles.sol";

/**
* @title GenerateAccessManagerCallData
Expand All @@ -21,15 +21,14 @@ import { PUBLIC_ROLE, ROLE_ID_DAO, ROLE_ID_PUFFER_PROTOCOL, ADMIN_ROLE, ROLE_ID_
*/
contract GenerateAccessManagerCallData is Script {
function run(address pufferVaultProxy, address pufferDepositorProxy) public pure returns (bytes memory) {
bytes[] memory calldatas = new bytes[](6);
bytes[] memory calldatas = new bytes[](5);

// Combine the two calldatas
calldatas[0] = _getPublicSelectorsCalldata({ pufferVaultProxy: pufferVaultProxy });
calldatas[1] = _getDaoSelectorsCalldataCalldata({ pufferVaultProxy: pufferVaultProxy });
calldatas[2] = _getProtocolSelectorsCalldata({ pufferVaultProxy: pufferVaultProxy });
calldatas[3] = _getOperationsSelectorsCalldata({ pufferVaultProxy: pufferVaultProxy });
calldatas[4] = _removeOutdatedSelectorsCalldata({ pufferDepositorProxy: pufferDepositorProxy });
calldatas[5] = _getPublicSelectorsForDepositor({ pufferDepositorProxy: pufferDepositorProxy });
calldatas[4] = _getPublicSelectorsForDepositor({ pufferDepositorProxy: pufferDepositorProxy });

bytes memory encodedMulticall = abi.encodeCall(Multicall.multicall, (calldatas));

Expand Down Expand Up @@ -96,17 +95,4 @@ contract GenerateAccessManagerCallData is Script {
AccessManager.setTargetFunctionRole.selector, pufferDepositorProxy, publicSelectorsDepositor, PUBLIC_ROLE
);
}

function _removeOutdatedSelectorsCalldata(address pufferDepositorProxy) internal pure returns (bytes memory) {
// Remove outdated selectors (restrict to admin role only)
bytes4[] memory outdatedSelectors = new bytes4[](4);
outdatedSelectors[0] = PufferDepositor.swapAndDeposit.selector;
outdatedSelectors[1] = PufferDepositor.swapAndDepositWithPermit.selector;
outdatedSelectors[2] = PufferDepositor.swapAndDepositWithPermit1Inch.selector;
outdatedSelectors[3] = PufferDepositor.swapAndDeposit1Inch.selector;

return abi.encodeWithSelector(
AccessManager.setTargetFunctionRole.selector, pufferDepositorProxy, outdatedSelectors, ADMIN_ROLE
);
}
}
2 changes: 1 addition & 1 deletion script/Roles.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ uint64 constant ROLE_ID_OPERATIONS = 22;
uint64 constant ROLE_ID_PUFFER_PROTOCOL = 1234;
uint64 constant ROLE_ID_DAO = 77;
uint64 constant ROLE_ID_GUARDIANS = 88;
uint64 constant ROLE_ID_PAUSER = 999;
uint64 constant ROLE_ID_PUFFER_ORACLE = 999;

// Public role (defined in AccessManager.sol)
uint64 constant PUBLIC_ROLE = type(uint64).max;
Expand Down
6 changes: 3 additions & 3 deletions src/interface/IPufferOracleV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { IPufferOracle } from "./IPufferOracle.sol";
*/
interface IPufferOracleV2 is IPufferOracle {
/**
* @notice Thrown if proof-of-reserves is submitted outside of the acceptable window
* @dev Signature "0xf93417f7"
* @notice Thrown if length of the modules and the amounts are not equal
* @dev Signature "0x3e50a94a"
*/
error OutsideUpdateWindow();
error InvalidOracleUpdate();

/**
* @notice Emitted when the proof-of-reserves updates the PufferVault's state
Expand Down
4 changes: 0 additions & 4 deletions test/mocks/MockPufferOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ contract MockPufferOracle is IPufferOracleV2 {
uint24 totalNumberOfValidators,
bytes[] calldata
) external {
if ((block.number - lastUpdate) < _UPDATE_INTERVAL) {
revert OutsideUpdateWindow();
}

lockedETH = newLockedETH;
lastUpdate = blockNumber;
numberOfActiveValidators = numberOfActivePufferValidators;
Expand Down
Loading