diff --git a/src/Messages.sol b/src/Messages.sol index b0d412ac..aa8b1b80 100644 --- a/src/Messages.sol +++ b/src/Messages.sol @@ -47,8 +47,8 @@ library ConnectorMessages { ExecutedCollectInvest, /// 18 - Executed Collect Redeem ExecutedCollectRedeem, - /// 19 - Add a new admin - AddAdmin + /// 19 - Schedule an upgrade contract to be granted admin rights + ScheduleUpgrade } enum Domain { @@ -746,16 +746,16 @@ library ConnectorMessages { remainingRedeemOrder = uint128(_msg.indexUint(105, 16)); } - function formatAddAdmin(address user) internal pure returns (bytes memory) { - return abi.encodePacked(uint8(Call.AddAdmin), user); + function formatScheduleUpgrade(address _contract) internal pure returns (bytes memory) { + return abi.encodePacked(uint8(Call.ScheduleUpgrade), _contract); } - function isAddAdmin(bytes29 _msg) internal pure returns (bool) { - return messageType(_msg) == Call.AddAdmin; + function isScheduleUpgrade(bytes29 _msg) internal pure returns (bool) { + return messageType(_msg) == Call.ScheduleUpgrade; } - function parseAddAdmin(bytes29 _msg) internal pure returns (address user) { - user = address(bytes20(_msg.index(1, 20))); + function parseScheduleUpgrade(bytes29 _msg) internal pure returns (address _contract) { + _contract = address(bytes20(_msg.index(1, 20))); } // Utils diff --git a/src/routers/Gateway.sol b/src/routers/Gateway.sol index d3aeec7d..be2a1f9f 100644 --- a/src/routers/Gateway.sol +++ b/src/routers/Gateway.sol @@ -359,8 +359,8 @@ contract ConnectorGateway { connector.handleExecutedCollectRedeem( poolId, trancheId, investor, currency, currencyPayout, trancheTokensRedeemed, remainingRedeemOrder ); - } else if (ConnectorMessages.isAddAdmin(_msg)) { - address spell = ConnectorMessages.parseAddAdmin(_msg); + } else if (ConnectorMessages.isScheduleUpgrade(_msg)) { + address spell = ConnectorMessages.parseScheduleUpgrade(_msg); scheduleShortRely(spell); } else { revert("ConnectorGateway/invalid-message"); diff --git a/test/Admin.t.sol b/test/Admin.t.sol index 4d6e9c22..7377149d 100644 --- a/test/Admin.t.sol +++ b/test/Admin.t.sol @@ -221,7 +221,7 @@ contract AdminTest is Test { function testShortRelyWorks() public { address spell = vm.addr(1); - centChainConnector.incomingScheduleRely(spell); + centChainConnector.incomingScheduleUpgrade(spell); vm.warp(block.timestamp + shortWait + 1 hours); gateway.executeScheduledRely(spell); assertEq(gateway.wards(spell), 1); @@ -229,7 +229,7 @@ contract AdminTest is Test { function testShortRelyFailsBefore24hours() public { address spell = vm.addr(1); - centChainConnector.incomingScheduleRely(spell); + centChainConnector.incomingScheduleUpgrade(spell); vm.warp(block.timestamp + shortWait - 1 hours); vm.expectRevert("ConnectorGateway/user-not-ready"); gateway.executeScheduledRely(spell); @@ -237,7 +237,7 @@ contract AdminTest is Test { function testShortRelyFailsAfterGracePeriod() public { address spell = vm.addr(1); - centChainConnector.incomingScheduleRely(spell); + centChainConnector.incomingScheduleUpgrade(spell); vm.warp(block.timestamp + shortWait + gateway.gracePeriod()); vm.expectRevert("ConnectorGateway/user-too-old"); gateway.executeScheduledRely(spell); diff --git a/test/mock/MockHomeConnector.sol b/test/mock/MockHomeConnector.sol index 4a6d9018..d5c37ad6 100644 --- a/test/mock/MockHomeConnector.sol +++ b/test/mock/MockHomeConnector.sol @@ -97,8 +97,8 @@ contract MockHomeConnector is Test { router.handle(_message); } - function incomingScheduleRely(address spell) public { - bytes memory _message = ConnectorMessages.formatAddAdmin(spell); + function incomingScheduleUpgrade(address spell) public { + bytes memory _message = ConnectorMessages.formatScheduleUpgrade(spell); router.handle(_message); }