diff --git a/README.md b/README.md index 8ddcb63..3bcfea6 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,11 @@ Executors serve as admins of the bridged domain instances of the protocol.
T ![Architecture Diagram](/diagram.png) ## 🤝 Contribution Guidelines In order to add governance relay infrastructure for a new domain, perform the following steps: -1. Go to [XChain Helpers](https://github.com/marsfoundation/xchain-helpers) repository and add: - 1. A domain helper abstracting away the process of passing messages between host domain and your bridged domain. - 2. A helper function to the XChainForwarders library abstracting away host domain interactions with the bridge. -2. Add `BridgeExecutor` to the `/src/executors` directory. Follow currently used naming convention. -3. Add a new test file for your domain to the `/test` directory. Inherit `CrosschainTestBase` and add tests specific to your domain to the test suite. All of the tests have to pass. Follow linting and naming convention used in other test files. -4. Use proper labeling for your open PR (always set adequate priority and status) -5. Get an approving review from at least one of three designated reviewers - **@hexonaut**, **@lucas-manuel** or **@barrutko** -6. Enjoy governance messages being passed through the bridge to your domain! 🎉 +1. Go to [XChain Helpers](https://github.com/marsfoundation/xchain-helpers) repository and complete the process for adding a new domain. +2. Add a new test file for your domain to the `/test` directory. Inherit `CrosschainTestBase` and add tests specific to your domain to the test suite. All of the tests have to pass. Follow linting and naming convention used in other test files. +3. Use proper labeling for your open PR (always set adequate priority and status) +4. Get an approving review from at least one of three designated reviewers - **@hexonaut**, **@lucas-manuel** or **@barrutko** +5. Enjoy governance messages being passed through the bridge to your domain! 🎉 *** *The IP in this repository was assigned to Mars SPC Limited in respect of the MarsOne SP* diff --git a/src/executors/BridgeExecutorBase.sol b/src/Executor.sol similarity index 86% rename from src/executors/BridgeExecutorBase.sol rename to src/Executor.sol index 90602ce..036e70d 100644 --- a/src/executors/BridgeExecutorBase.sol +++ b/src/Executor.sol @@ -1,18 +1,17 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.10; -import { Address } from "lib/openzeppelin-contracts/contracts/utils/Address.sol"; +import { AccessControl } from "openzeppelin-contracts/contracts/access/AccessControl.sol"; +import { Address } from "openzeppelin-contracts/contracts/utils/Address.sol"; -import { IExecutorBase } from 'src/interfaces/IExecutorBase.sol'; +import { IExecutor } from './interfaces/IExecutor.sol'; /** - * @title BridgeExecutorBase + * @title Executor * @author Aave - * @notice Abstract contract that implements basic executor functionality - * @dev It does not implement an external `queue` function. This should instead be done in the inheriting - * contract with proper access control + * @notice Executor which queues up message calls and executes them after an optional delay */ -abstract contract BridgeExecutorBase is IExecutorBase { +contract Executor is IExecutor, AccessControl { using Address for address; @@ -68,9 +67,71 @@ abstract contract BridgeExecutorBase is IExecutorBase { _updateDelay(delay); _updateGracePeriod(gracePeriod); _updateGuardian(guardian); + + _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor + function queue( + address[] memory targets, + uint256[] memory values, + string[] memory signatures, + bytes[] memory calldatas, + bool[] memory withDelegatecalls + ) external override onlyRole(DEFAULT_ADMIN_ROLE) { + if (targets.length == 0) revert EmptyTargets(); + uint256 targetsLength = targets.length; + if ( + targetsLength != values.length || + targetsLength != signatures.length || + targetsLength != calldatas.length || + targetsLength != withDelegatecalls.length + ) revert InconsistentParamsLength(); + + uint256 actionsSetId = _actionsSetCounter; + uint256 executionTime = block.timestamp + _delay; + unchecked { + ++_actionsSetCounter; + } + + for (uint256 i = 0; i < targetsLength; ) { + bytes32 actionHash = keccak256( + abi.encode( + targets[i], + values[i], + signatures[i], + calldatas[i], + executionTime, + withDelegatecalls[i] + ) + ); + if (isActionQueued(actionHash)) revert DuplicateAction(); + _queuedActions[actionHash] = true; + unchecked { + ++i; + } + } + + ActionsSet storage actionsSet = _actionsSets[actionsSetId]; + actionsSet.targets = targets; + actionsSet.values = values; + actionsSet.signatures = signatures; + actionsSet.calldatas = calldatas; + actionsSet.withDelegatecalls = withDelegatecalls; + actionsSet.executionTime = executionTime; + + emit ActionsSetQueued( + actionsSetId, + targets, + values, + signatures, + calldatas, + withDelegatecalls, + executionTime + ); + } + + /// @inheritdoc IExecutor function execute(uint256 actionsSetId) external payable override { if (getCurrentState(actionsSetId) != ActionsSetState.Queued) revert OnlyQueuedActions(); @@ -98,7 +159,7 @@ abstract contract BridgeExecutorBase is IExecutorBase { emit ActionsSetExecuted(actionsSetId, msg.sender, returnedData); } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function cancel(uint256 actionsSetId) external override onlyGuardian { if (getCurrentState(actionsSetId) != ActionsSetState.Queued) revert OnlyQueuedActions(); @@ -123,23 +184,23 @@ abstract contract BridgeExecutorBase is IExecutorBase { emit ActionsSetCanceled(actionsSetId); } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function updateGuardian(address guardian) external override onlyThis { _updateGuardian(guardian); } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function updateDelay(uint256 delay) external override onlyThis { _updateDelay(delay); } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function updateGracePeriod(uint256 gracePeriod) external override onlyThis { if (gracePeriod < MINIMUM_GRACE_PERIOD) revert GracePeriodTooShort(); _updateGracePeriod(gracePeriod); } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function executeDelegateCall(address target, bytes calldata data) external payable @@ -150,30 +211,30 @@ abstract contract BridgeExecutorBase is IExecutorBase { return target.functionDelegateCall(data); } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function receiveFunds() external payable override {} - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function getDelay() external view override returns (uint256) { return _delay; } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function getGracePeriod() external view override returns (uint256) { return _gracePeriod; } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function getGuardian() external view override returns (address) { return _guardian; } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function getActionsSetCount() external view override returns (uint256) { return _actionsSetCounter; } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function getActionsSetById(uint256 actionsSetId) external view @@ -183,7 +244,7 @@ abstract contract BridgeExecutorBase is IExecutorBase { return _actionsSets[actionsSetId]; } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function getCurrentState(uint256 actionsSetId) public view override returns (ActionsSetState) { if (_actionsSetCounter <= actionsSetId) revert InvalidActionsSetId(); ActionsSet storage actionsSet = _actionsSets[actionsSetId]; @@ -198,7 +259,7 @@ abstract contract BridgeExecutorBase is IExecutorBase { } } - /// @inheritdoc IExecutorBase + /// @inheritdoc IExecutor function isActionQueued(bytes32 actionHash) public view override returns (bool) { return _queuedActions[actionHash]; } @@ -218,74 +279,6 @@ abstract contract BridgeExecutorBase is IExecutorBase { _gracePeriod = gracePeriod; } - /** - * @notice Queue an ActionsSet - * @dev If a signature is empty, calldata is used for the execution, calldata is appended to signature otherwise - * @param targets Array of targets to be called by the actions set - * @param values Array of values to pass in each call by the actions set - * @param signatures Array of function signatures to encode in each call (can be empty) - * @param calldatas Array of calldata to pass in each call (can be empty) - * @param withDelegatecalls Array of whether to delegatecall for each call - **/ - function _queue( - address[] memory targets, - uint256[] memory values, - string[] memory signatures, - bytes[] memory calldatas, - bool[] memory withDelegatecalls - ) internal { - if (targets.length == 0) revert EmptyTargets(); - uint256 targetsLength = targets.length; - if ( - targetsLength != values.length || - targetsLength != signatures.length || - targetsLength != calldatas.length || - targetsLength != withDelegatecalls.length - ) revert InconsistentParamsLength(); - - uint256 actionsSetId = _actionsSetCounter; - uint256 executionTime = block.timestamp + _delay; - unchecked { - ++_actionsSetCounter; - } - - for (uint256 i = 0; i < targetsLength; ) { - bytes32 actionHash = keccak256( - abi.encode( - targets[i], - values[i], - signatures[i], - calldatas[i], - executionTime, - withDelegatecalls[i] - ) - ); - if (isActionQueued(actionHash)) revert DuplicateAction(); - _queuedActions[actionHash] = true; - unchecked { - ++i; - } - } - - ActionsSet storage actionsSet = _actionsSets[actionsSetId]; - actionsSet.targets = targets; - actionsSet.values = values; - actionsSet.signatures = signatures; - actionsSet.calldatas = calldatas; - actionsSet.withDelegatecalls = withDelegatecalls; - actionsSet.executionTime = executionTime; - - emit ActionsSetQueued( - actionsSetId, - targets, - values, - signatures, - calldatas, - withDelegatecalls, - executionTime - ); - } - function _executeTransaction( address target, uint256 value, diff --git a/src/executors/AuthBridgeExecutor.sol b/src/executors/AuthBridgeExecutor.sol deleted file mode 100644 index 2772574..0000000 --- a/src/executors/AuthBridgeExecutor.sol +++ /dev/null @@ -1,47 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0 -pragma solidity ^0.8.10; - -import { AccessControl } from 'lib/openzeppelin-contracts/contracts/access/AccessControl.sol'; - -import { IAuthBridgeExecutor } from 'src/interfaces/IAuthBridgeExecutor.sol'; -import { BridgeExecutorBase } from './BridgeExecutorBase.sol'; - -/** - * @title AuthBridgeExecutor - * @notice Queue up proposals from an authorized bridge. - */ -contract AuthBridgeExecutor is IAuthBridgeExecutor, AccessControl, BridgeExecutorBase { - - /** - * @dev Constructor - * - * @param delay The delay before which an actions set can be executed - * @param gracePeriod The time period after a delay during which an actions set can be executed - * @param guardian The address of the guardian, which can cancel queued proposals (can be zero) - */ - constructor( - uint256 delay, - uint256 gracePeriod, - address guardian - ) - BridgeExecutorBase( - delay, - gracePeriod, - guardian - ) - { - _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); - } - - /// @inheritdoc IAuthBridgeExecutor - function queue( - address[] memory targets, - uint256[] memory values, - string[] memory signatures, - bytes[] memory calldatas, - bool[] memory withDelegatecalls - ) external onlyRole(DEFAULT_ADMIN_ROLE) { - _queue(targets, values, signatures, calldatas, withDelegatecalls); - } - -} diff --git a/src/interfaces/IAuthBridgeExecutor.sol b/src/interfaces/IAuthBridgeExecutor.sol deleted file mode 100644 index 9c8bbcb..0000000 --- a/src/interfaces/IAuthBridgeExecutor.sol +++ /dev/null @@ -1,31 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0 -pragma solidity ^0.8.10; - -import { IAccessControl } from 'lib/openzeppelin-contracts/contracts/access/IAccessControl.sol'; - -import { IExecutorBase } from './IExecutorBase.sol'; - -/** - * @title IAuthBridgeExecutor - * @notice Defines the basic interface for the AuthBridgeExecutor contract. - */ -interface IAuthBridgeExecutor is IAccessControl, IExecutorBase { - - /** - * @notice Queue an ActionsSet - * @dev If a signature is empty, calldata is used for the execution, calldata is appended to signature otherwise - * @param targets Array of targets to be called by the actions set - * @param values Array of values to pass in each call by the actions set - * @param signatures Array of function signatures to encode in each call by the actions (can be empty) - * @param calldatas Array of calldata to pass in each call by the actions set - * @param withDelegatecalls Array of whether to delegatecall for each call of the actions set - **/ - function queue( - address[] memory targets, - uint256[] memory values, - string[] memory signatures, - bytes[] memory calldatas, - bool[] memory withDelegatecalls - ) external; - -} diff --git a/src/interfaces/IExecutorBase.sol b/src/interfaces/IExecutor.sol similarity index 87% rename from src/interfaces/IExecutorBase.sol rename to src/interfaces/IExecutor.sol index d7290b0..707c256 100644 --- a/src/interfaces/IExecutorBase.sol +++ b/src/interfaces/IExecutor.sol @@ -1,12 +1,15 @@ // SPDX-License-Identifier: AGPL-3.0 -pragma solidity ^0.8.10; +pragma solidity >=0.8.0; + +import { IAccessControl } from 'openzeppelin-contracts/contracts/access/IAccessControl.sol'; /** - * @title IExecutorBase + * @title IExecutor * @author Aave - * @notice Defines the basic interface for the ExecutorBase abstract contract + * @notice Defines the interface for the Executor */ -interface IExecutorBase { +interface IExecutor is IAccessControl { + error InvalidInitParams(); error NotGuardian(); error OnlyCallableByThis(); @@ -115,6 +118,23 @@ interface IExecutorBase { **/ event GracePeriodUpdate(uint256 oldGracePeriod, uint256 newGracePeriod); + /** + * @notice Queue an ActionsSet + * @dev If a signature is empty, calldata is used for the execution, calldata is appended to signature otherwise + * @param targets Array of targets to be called by the actions set + * @param values Array of values to pass in each call by the actions set + * @param signatures Array of function signatures to encode in each call by the actions (can be empty) + * @param calldatas Array of calldata to pass in each call by the actions set + * @param withDelegatecalls Array of whether to delegatecall for each call of the actions set + **/ + function queue( + address[] memory targets, + uint256[] memory values, + string[] memory signatures, + bytes[] memory calldatas, + bool[] memory withDelegatecalls + ) external; + /** * @notice Execute the ActionsSet * @param actionsSetId The id of the ActionsSet to execute @@ -208,4 +228,5 @@ interface IExecutorBase { * @return True if the underlying action of actionHash is queued, false otherwise **/ function isActionQueued(bytes32 actionHash) external view returns (bool); + } diff --git a/test/ArbitrumOneCrosschainTest.t.sol b/test/ArbitrumOneCrosschainTest.t.sol index 6cc3d06..4ed26e2 100644 --- a/test/ArbitrumOneCrosschainTest.t.sol +++ b/test/ArbitrumOneCrosschainTest.t.sol @@ -43,7 +43,7 @@ contract ArbitrumOneCrosschainTest is CrosschainTestBase { ); bridge.destination.selectFork(); - bridgeExecutor = new AuthBridgeExecutor( + bridgeExecutor = new Executor( defaultL2BridgeExecutorArgs.delay, defaultL2BridgeExecutorArgs.gracePeriod, defaultL2BridgeExecutorArgs.guardian diff --git a/test/BaseChainCrosschainTest.t.sol b/test/BaseChainCrosschainTest.t.sol index b87f747..51c6f50 100644 --- a/test/BaseChainCrosschainTest.t.sol +++ b/test/BaseChainCrosschainTest.t.sol @@ -41,7 +41,7 @@ contract BaseChainCrosschainTest is CrosschainTestBase { ); bridge.destination.selectFork(); - bridgeExecutor = new AuthBridgeExecutor( + bridgeExecutor = new Executor( defaultL2BridgeExecutorArgs.delay, defaultL2BridgeExecutorArgs.gracePeriod, defaultL2BridgeExecutorArgs.guardian diff --git a/test/CrosschainTestBase.sol b/test/CrosschainTestBase.sol index 7249ec5..99e55a5 100644 --- a/test/CrosschainTestBase.sol +++ b/test/CrosschainTestBase.sol @@ -6,9 +6,8 @@ import 'forge-std/Test.sol'; import { Bridge } from 'lib/xchain-helpers/src/testing/Bridge.sol'; import { DomainHelpers } from 'lib/xchain-helpers/src/testing/Domain.sol'; -import { IAuthBridgeExecutor } from 'src/interfaces/IAuthBridgeExecutor.sol'; -import { IExecutorBase } from 'src/interfaces/IExecutorBase.sol'; -import { AuthBridgeExecutor } from 'src/executors/AuthBridgeExecutor.sol'; +import { IExecutor } from 'src/interfaces/IExecutor.sol'; +import { Executor } from 'src/Executor.sol'; import { IL1Executor } from './interfaces/IL1Executor.sol'; import { IPayload } from './interfaces/IPayload.sol'; @@ -48,7 +47,7 @@ abstract contract CrosschainPayload is IPayload { withDelegatecalls[0] = true; return abi.encodeWithSelector( - IAuthBridgeExecutor.queue.selector, + IExecutor.queue.selector, targets, values, signatures, @@ -78,8 +77,8 @@ abstract contract CrosschainTestBase is Test { Bridge public bridge; - AuthBridgeExecutor public bridgeExecutor; - address public bridgeReceiver; + Executor public bridgeExecutor; + address public bridgeReceiver; function deployCrosschainPayload(IPayload targetPayload, address bridgeReceiver) public virtual returns (IPayload); function relayMessagesAcrossBridge() internal virtual; @@ -132,7 +131,7 @@ abstract contract CrosschainTestBase is Test { skip(delay); - vm.expectRevert(IExecutorBase.OnlyQueuedActions.selector); + vm.expectRevert(IExecutor.OnlyQueuedActions.selector); bridgeExecutor.execute(0); } @@ -143,7 +142,7 @@ abstract contract CrosschainTestBase is Test { skip(delay); - vm.expectRevert(IExecutorBase.TimelockNotFinished.selector); + vm.expectRevert(IExecutor.TimelockNotFinished.selector); bridgeExecutor.execute(0); } @@ -197,7 +196,7 @@ abstract contract CrosschainTestBase is Test { vm.prank(defaultL2BridgeExecutorArgs.guardian); bridgeExecutor.cancel(0); - vm.expectRevert(IExecutorBase.OnlyQueuedActions.selector); + vm.expectRevert(IExecutor.OnlyQueuedActions.selector); vm.prank(defaultL2BridgeExecutorArgs.guardian); bridgeExecutor.cancel(0); } @@ -209,7 +208,7 @@ abstract contract CrosschainTestBase is Test { bridgeExecutor.execute(0); - vm.expectRevert(IExecutorBase.OnlyQueuedActions.selector); + vm.expectRevert(IExecutor.OnlyQueuedActions.selector); vm.prank(defaultL2BridgeExecutorArgs.guardian); bridgeExecutor.cancel(0); } @@ -219,7 +218,7 @@ abstract contract CrosschainTestBase is Test { skip(defaultL2BridgeExecutorArgs.delay + defaultL2BridgeExecutorArgs.gracePeriod + 1); - vm.expectRevert(IExecutorBase.OnlyQueuedActions.selector); + vm.expectRevert(IExecutor.OnlyQueuedActions.selector); vm.prank(defaultL2BridgeExecutorArgs.guardian); bridgeExecutor.cancel(0); } @@ -232,7 +231,7 @@ abstract contract CrosschainTestBase is Test { vm.prank(defaultL2BridgeExecutorArgs.guardian); bridgeExecutor.cancel(0); - vm.expectRevert(IExecutorBase.OnlyQueuedActions.selector); + vm.expectRevert(IExecutor.OnlyQueuedActions.selector); bridgeExecutor.execute(0); } diff --git a/test/AuthBridgeExecutor.t.sol b/test/Executor.t.sol similarity index 94% rename from test/AuthBridgeExecutor.t.sol rename to test/Executor.t.sol index d7fb049..93451aa 100644 --- a/test/AuthBridgeExecutor.t.sol +++ b/test/Executor.t.sol @@ -3,8 +3,8 @@ pragma solidity ^0.8.0; import 'forge-std/Test.sol'; -import { AuthBridgeExecutor } from 'src/executors/AuthBridgeExecutor.sol'; -import { IExecutorBase } from 'src/interfaces/IExecutorBase.sol'; +import { IExecutor } from 'src/interfaces/IExecutor.sol'; +import { Executor } from 'src/Executor.sol'; contract DefaultPayload { event TestEvent(); @@ -26,7 +26,7 @@ contract RevertingPayload { } } -contract AuthBridgeExecutorTestBase is Test { +contract ExecutorTestBase is Test { struct Action { address[] targets; @@ -62,10 +62,10 @@ contract AuthBridgeExecutorTestBase is Test { address bridge = makeAddr("bridge"); address guardian = makeAddr("guardian"); - AuthBridgeExecutor executor; + Executor executor; function setUp() public { - executor = new AuthBridgeExecutor({ + executor = new Executor({ delay: DELAY, gracePeriod: GRACE_PERIOD, guardian: guardian @@ -137,7 +137,7 @@ contract AuthBridgeExecutorTestBase is Test { } function _assertActionSet(uint256 id, bool executed, bool canceled, uint256 executionTime, Action memory action) internal view { - IExecutorBase.ActionsSet memory actionsSet = executor.getActionsSetById(id); + IExecutor.ActionsSet memory actionsSet = executor.getActionsSetById(id); assertEq(actionsSet.targets, action.targets); assertEq(actionsSet.values, action.values); assertEq(actionsSet.signatures, action.signatures); @@ -150,17 +150,17 @@ contract AuthBridgeExecutorTestBase is Test { } -contract AuthBridgeExecutorConstructorTests is AuthBridgeExecutorTestBase { +contract ExecutorConstructorTests is ExecutorTestBase { function test_constructor_invalidInitParams_boundary() public { vm.expectRevert(abi.encodeWithSignature("InvalidInitParams()")); - executor = new AuthBridgeExecutor({ + executor = new Executor({ delay: DELAY, gracePeriod: 10 minutes - 1, guardian: guardian }); - executor = new AuthBridgeExecutor({ + executor = new Executor({ delay: DELAY, gracePeriod: 10 minutes, guardian: guardian @@ -174,7 +174,7 @@ contract AuthBridgeExecutorConstructorTests is AuthBridgeExecutorTestBase { emit GracePeriodUpdate(0, GRACE_PERIOD); vm.expectEmit(); emit GuardianUpdate(address(0), guardian); - executor = new AuthBridgeExecutor({ + executor = new Executor({ delay: DELAY, gracePeriod: GRACE_PERIOD, guardian: guardian @@ -189,7 +189,7 @@ contract AuthBridgeExecutorConstructorTests is AuthBridgeExecutorTestBase { } -contract AuthBridgeExecutorQueueTests is AuthBridgeExecutorTestBase { +contract ExecutorQueueTests is ExecutorTestBase { function test_queue_onlyDefaultAdmin() public { vm.expectRevert(abi.encodeWithSignature("AccessControlUnauthorizedAccount(address,bytes32)", address(this), executor.DEFAULT_ADMIN_ROLE())); @@ -292,7 +292,7 @@ contract AuthBridgeExecutorQueueTests is AuthBridgeExecutorTestBase { } -contract AuthBridgeExecutorExecuteTests is AuthBridgeExecutorTestBase { +contract ExecutorExecuteTests is ExecutorTestBase { function test_execute_actionsSetIdTooHigh_boundary() public { assertEq(executor.getActionsSetCount(), 0); @@ -439,7 +439,7 @@ contract AuthBridgeExecutorExecuteTests is AuthBridgeExecutorTestBase { assertEq(executor.isActionQueued(actionHash), true); assertEq(executor.getActionsSetById(0).executed, false); - assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutorBase.ActionsSetState.Queued)); + assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutor.ActionsSetState.Queued)); bytes[] memory returnedData = new bytes[](1); returnedData[0] = ""; @@ -451,7 +451,7 @@ contract AuthBridgeExecutorExecuteTests is AuthBridgeExecutorTestBase { assertEq(executor.isActionQueued(actionHash), false); assertEq(executor.getActionsSetById(0).executed, true); - assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutorBase.ActionsSetState.Executed)); + assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutor.ActionsSetState.Executed)); } function test_execute_call() public { @@ -463,7 +463,7 @@ contract AuthBridgeExecutorExecuteTests is AuthBridgeExecutorTestBase { assertEq(executor.isActionQueued(actionHash), true); assertEq(executor.getActionsSetById(0).executed, false); - assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutorBase.ActionsSetState.Queued)); + assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutor.ActionsSetState.Queued)); bytes[] memory returnedData = new bytes[](1); returnedData[0] = ""; @@ -475,7 +475,7 @@ contract AuthBridgeExecutorExecuteTests is AuthBridgeExecutorTestBase { assertEq(executor.isActionQueued(actionHash), false); assertEq(executor.getActionsSetById(0).executed, true); - assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutorBase.ActionsSetState.Executed)); + assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutor.ActionsSetState.Executed)); } function test_execute_delegateCallWithCalldata() public { @@ -488,7 +488,7 @@ contract AuthBridgeExecutorExecuteTests is AuthBridgeExecutorTestBase { assertEq(executor.isActionQueued(actionHash), true); assertEq(executor.getActionsSetById(0).executed, false); - assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutorBase.ActionsSetState.Queued)); + assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutor.ActionsSetState.Queued)); bytes[] memory returnedData = new bytes[](1); returnedData[0] = ""; @@ -500,7 +500,7 @@ contract AuthBridgeExecutorExecuteTests is AuthBridgeExecutorTestBase { assertEq(executor.isActionQueued(actionHash), false); assertEq(executor.getActionsSetById(0).executed, true); - assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutorBase.ActionsSetState.Executed)); + assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutor.ActionsSetState.Executed)); } function test_execute_callWithCalldata() public { @@ -514,7 +514,7 @@ contract AuthBridgeExecutorExecuteTests is AuthBridgeExecutorTestBase { assertEq(executor.isActionQueued(actionHash), true); assertEq(executor.getActionsSetById(0).executed, false); - assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutorBase.ActionsSetState.Queued)); + assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutor.ActionsSetState.Queued)); bytes[] memory returnedData = new bytes[](1); returnedData[0] = ""; @@ -526,12 +526,12 @@ contract AuthBridgeExecutorExecuteTests is AuthBridgeExecutorTestBase { assertEq(executor.isActionQueued(actionHash), false); assertEq(executor.getActionsSetById(0).executed, true); - assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutorBase.ActionsSetState.Executed)); + assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutor.ActionsSetState.Executed)); } } -contract AuthBridgeExecutorCancelTests is AuthBridgeExecutorTestBase { +contract ExecutorCancelTests is ExecutorTestBase { function test_cancel_notGuardian() public { _queueAction(); @@ -597,7 +597,7 @@ contract AuthBridgeExecutorCancelTests is AuthBridgeExecutorTestBase { assertEq(executor.isActionQueued(actionHash), true); assertEq(executor.getActionsSetById(0).canceled, false); - assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutorBase.ActionsSetState.Queued)); + assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutor.ActionsSetState.Queued)); vm.expectEmit(address(executor)); emit ActionsSetCanceled(0); @@ -606,12 +606,12 @@ contract AuthBridgeExecutorCancelTests is AuthBridgeExecutorTestBase { assertEq(executor.isActionQueued(actionHash), false); assertEq(executor.getActionsSetById(0).canceled, true); - assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutorBase.ActionsSetState.Canceled)); + assertEq(uint8(executor.getCurrentState(0)), uint8(IExecutor.ActionsSetState.Canceled)); } } -contract AuthBridgeExecutorUpdateTests is AuthBridgeExecutorTestBase { +contract ExecutorUpdateTests is ExecutorTestBase { function test_updateGuardian_notSelf() public { vm.expectRevert(abi.encodeWithSignature("OnlyCallableByThis()")); @@ -674,7 +674,7 @@ contract AuthBridgeExecutorUpdateTests is AuthBridgeExecutorTestBase { } -contract AuthBridgeExecutorMiscTests is AuthBridgeExecutorTestBase { +contract ExecutorMiscTests is ExecutorTestBase { function test_executeDelegateCall_notSelf() public { vm.expectRevert(abi.encodeWithSignature("OnlyCallableByThis()")); diff --git a/test/GnosisCrosschainTest.t.sol b/test/GnosisCrosschainTest.t.sol index 1707e8e..202a419 100644 --- a/test/GnosisCrosschainTest.t.sol +++ b/test/GnosisCrosschainTest.t.sol @@ -40,7 +40,7 @@ contract GnosisCrosschainTest is CrosschainTestBase { ); bridge.destination.selectFork(); - bridgeExecutor = new AuthBridgeExecutor( + bridgeExecutor = new Executor( defaultL2BridgeExecutorArgs.delay, defaultL2BridgeExecutorArgs.gracePeriod, defaultL2BridgeExecutorArgs.guardian diff --git a/test/OptimismCrosschainTest.t.sol b/test/OptimismCrosschainTest.t.sol index 6895e1e..eeb6a1d 100644 --- a/test/OptimismCrosschainTest.t.sol +++ b/test/OptimismCrosschainTest.t.sol @@ -41,7 +41,7 @@ contract OptimismCrosschainTest is CrosschainTestBase { ); bridge.destination.selectFork(); - bridgeExecutor = new AuthBridgeExecutor( + bridgeExecutor = new Executor( defaultL2BridgeExecutorArgs.delay, defaultL2BridgeExecutorArgs.gracePeriod, defaultL2BridgeExecutorArgs.guardian diff --git a/test/mocks/ReconfigurationPayload.sol b/test/mocks/ReconfigurationPayload.sol index 74f0100..107ba4c 100644 --- a/test/mocks/ReconfigurationPayload.sol +++ b/test/mocks/ReconfigurationPayload.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.10; -import { IExecutorBase } from '../../src/interfaces/IExecutorBase.sol'; +import { IExecutor } from 'src/interfaces/IExecutor.sol'; import { IPayload } from '../interfaces/IPayload.sol'; @@ -25,9 +25,9 @@ contract ReconfigurationPayload is IPayload { } function execute() external override { - IExecutorBase(address(this)).updateDelay(getNewDelay()); - IExecutorBase(address(this)).updateGracePeriod(getNewGracePeriod()); - IExecutorBase(address(this)).updateGuardian(getNewGuardian()); + IExecutor(address(this)).updateDelay(getNewDelay()); + IExecutor(address(this)).updateGracePeriod(getNewGracePeriod()); + IExecutor(address(this)).updateGuardian(getNewGuardian()); } function getNewDelay() public view returns (uint256) {