From fe801e2784041802f2d4d9bb310d71f7bef9bca7 Mon Sep 17 00:00:00 2001 From: Oluchi Enebeli Date: Wed, 11 Sep 2024 18:29:42 +0400 Subject: [PATCH] Feat: update protocol version (#292) * feat: update protocol version to 1.2.1 * chore: remove redundant MockRedeemManagerV2 from test file --- contracts/src/Allowlist.1.sol | 2 +- contracts/src/CoverageFund.1.sol | 2 +- contracts/src/ELFeeRecipient.1.sol | 2 +- contracts/src/Firewall.sol | 2 +- contracts/src/OperatorsRegistry.1.sol | 2 +- contracts/src/Oracle.1.sol | 2 +- contracts/src/RedeemManager.1.sol | 2 +- contracts/src/River.1.sol | 2 +- contracts/src/Withdraw.1.sol | 2 +- contracts/test/Allowlist.1.t.sol | 2 +- contracts/test/CoverageFund.1.t.sol | 2 +- contracts/test/ELFeeRecipient.1.t.sol | 2 +- contracts/test/Firewall.t.sol | 2 +- contracts/test/OperatorsRegistry.1.t.sol | 2 +- contracts/test/Oracle.1.t.sol | 2 +- contracts/test/RedeemManager.1.t.sol | 111 +---------------------- contracts/test/River.1.t.sol | 2 +- contracts/test/Withdraw.1.t.sol | 2 +- 18 files changed, 18 insertions(+), 127 deletions(-) diff --git a/contracts/src/Allowlist.1.sol b/contracts/src/Allowlist.1.sol index ce3567fc..e280f3ea 100644 --- a/contracts/src/Allowlist.1.sol +++ b/contracts/src/Allowlist.1.sol @@ -161,6 +161,6 @@ contract AllowlistV1 is IAllowlistV1, Initializable, Administrable, IProtocolVer } function version() external pure returns (string memory) { - return "1.2.0"; + return "1.2.1"; } } diff --git a/contracts/src/CoverageFund.1.sol b/contracts/src/CoverageFund.1.sol index 7a6b154a..4fe5796a 100644 --- a/contracts/src/CoverageFund.1.sol +++ b/contracts/src/CoverageFund.1.sol @@ -74,6 +74,6 @@ contract CoverageFundV1 is Initializable, ICoverageFundV1, IProtocolVersion { } function version() external pure returns (string memory) { - return "1.2.0"; + return "1.2.1"; } } diff --git a/contracts/src/ELFeeRecipient.1.sol b/contracts/src/ELFeeRecipient.1.sol index 275dc3df..45c1f2a3 100644 --- a/contracts/src/ELFeeRecipient.1.sol +++ b/contracts/src/ELFeeRecipient.1.sol @@ -45,6 +45,6 @@ contract ELFeeRecipientV1 is Initializable, IELFeeRecipientV1, IProtocolVersion } function version() external pure returns (string memory) { - return "1.2.0"; + return "1.2.1"; } } diff --git a/contracts/src/Firewall.sol b/contracts/src/Firewall.sol index 7540ff27..50447d8d 100644 --- a/contracts/src/Firewall.sol +++ b/contracts/src/Firewall.sol @@ -119,6 +119,6 @@ contract Firewall is IFirewall, IProtocolVersion, Administrable { /// @inheritdoc IProtocolVersion function version() external pure returns (string memory) { - return "1.2.0"; + return "1.2.1"; } } diff --git a/contracts/src/OperatorsRegistry.1.sol b/contracts/src/OperatorsRegistry.1.sol index f20ea555..78082363 100644 --- a/contracts/src/OperatorsRegistry.1.sol +++ b/contracts/src/OperatorsRegistry.1.sol @@ -900,6 +900,6 @@ contract OperatorsRegistryV1 is IOperatorsRegistryV1, Initializable, Administrab } function version() external pure returns (string memory) { - return "1.2.0"; + return "1.2.1"; } } diff --git a/contracts/src/Oracle.1.sol b/contracts/src/Oracle.1.sol index ce1ed2ef..99d82468 100644 --- a/contracts/src/Oracle.1.sol +++ b/contracts/src/Oracle.1.sol @@ -283,6 +283,6 @@ contract OracleV1 is IOracleV1, Initializable, Administrable, IProtocolVersion { } function version() external pure returns (string memory) { - return "1.2.0"; + return "1.2.1"; } } diff --git a/contracts/src/RedeemManager.1.sol b/contracts/src/RedeemManager.1.sol index 33e19d54..bf9deb20 100644 --- a/contracts/src/RedeemManager.1.sol +++ b/contracts/src/RedeemManager.1.sol @@ -603,6 +603,6 @@ contract RedeemManagerV1 is Initializable, IRedeemManagerV1, IProtocolVersion { } function version() external pure returns (string memory) { - return "1.2.0"; + return "1.2.1"; } } diff --git a/contracts/src/River.1.sol b/contracts/src/River.1.sol index 880f58ec..59f00ee7 100644 --- a/contracts/src/River.1.sol +++ b/contracts/src/River.1.sol @@ -613,6 +613,6 @@ contract RiverV1 is } function version() external pure returns (string memory) { - return "1.2.0"; + return "1.2.1"; } } diff --git a/contracts/src/Withdraw.1.sol b/contracts/src/Withdraw.1.sol index aa81835e..9e96c05d 100644 --- a/contracts/src/Withdraw.1.sol +++ b/contracts/src/Withdraw.1.sol @@ -55,6 +55,6 @@ contract WithdrawV1 is IWithdrawV1, Initializable, IProtocolVersion { /// @inheritdoc IProtocolVersion function version() external pure returns (string memory) { - return "1.2.0"; + return "1.2.1"; } } diff --git a/contracts/test/Allowlist.1.t.sol b/contracts/test/Allowlist.1.t.sol index faf82b6d..fe612e39 100644 --- a/contracts/test/Allowlist.1.t.sol +++ b/contracts/test/Allowlist.1.t.sol @@ -397,6 +397,6 @@ contract AllowlistV1Tests is AllowlistV1TestBase { } function testVersion() external { - assertEq(allowlist.version(), "1.2.0"); + assertEq(allowlist.version(), "1.2.1"); } } diff --git a/contracts/test/CoverageFund.1.t.sol b/contracts/test/CoverageFund.1.t.sol index 6976550f..8aea2fa4 100644 --- a/contracts/test/CoverageFund.1.t.sol +++ b/contracts/test/CoverageFund.1.t.sol @@ -225,6 +225,6 @@ contract CoverageFundTestV1 is CoverageFundV1TestBase { } function testVersion() external { - assertEq(coverageFund.version(), "1.2.0"); + assertEq(coverageFund.version(), "1.2.1"); } } diff --git a/contracts/test/ELFeeRecipient.1.t.sol b/contracts/test/ELFeeRecipient.1.t.sol index d33208e7..75ca7664 100644 --- a/contracts/test/ELFeeRecipient.1.t.sol +++ b/contracts/test/ELFeeRecipient.1.t.sol @@ -146,6 +146,6 @@ contract ELFeeRecipientV1Test is ELFeeRecipientV1TestBase { } function testVersion() external { - assertEq(feeRecipient.version(), "1.2.0"); + assertEq(feeRecipient.version(), "1.2.1"); } } diff --git a/contracts/test/Firewall.t.sol b/contracts/test/Firewall.t.sol index ffb9e175..566532ae 100644 --- a/contracts/test/Firewall.t.sol +++ b/contracts/test/Firewall.t.sol @@ -505,6 +505,6 @@ contract FirewallTests is BytesGenerator, Test { } function testVersion() external { - assertEq(riverFirewall.version(), "1.2.0"); + assertEq(riverFirewall.version(), "1.2.1"); } } diff --git a/contracts/test/OperatorsRegistry.1.t.sol b/contracts/test/OperatorsRegistry.1.t.sol index fe763520..18d4287a 100644 --- a/contracts/test/OperatorsRegistry.1.t.sol +++ b/contracts/test/OperatorsRegistry.1.t.sol @@ -3078,6 +3078,6 @@ contract OperatorsRegistryV1TestDistribution is Test { } function testVersion() external { - assertEq(operatorsRegistry.version(), "1.2.0"); + assertEq(operatorsRegistry.version(), "1.2.1"); } } diff --git a/contracts/test/Oracle.1.t.sol b/contracts/test/Oracle.1.t.sol index 6d5c7e6a..827440bd 100644 --- a/contracts/test/Oracle.1.t.sol +++ b/contracts/test/Oracle.1.t.sol @@ -744,6 +744,6 @@ contract OracleV1Tests is OracleV1TestBase { } function testVersion() external { - assertEq(oracle.version(), "1.2.0"); + assertEq(oracle.version(), "1.2.1"); } } diff --git a/contracts/test/RedeemManager.1.t.sol b/contracts/test/RedeemManager.1.t.sol index eafd6386..62ccf868 100644 --- a/contracts/test/RedeemManager.1.t.sol +++ b/contracts/test/RedeemManager.1.t.sol @@ -1919,7 +1919,7 @@ contract RedeemManagerV1Tests is RedeeManagerV1TestBase { } function testVersion() external { - assertEq(redeemManager.version(), "1.2.0"); + assertEq(redeemManager.version(), "1.2.1"); } } @@ -2084,115 +2084,6 @@ contract MockRedeemManagerV1_2 is MockRedeemManagerV1Base { } } -contract MockRedeemManagerV2 is MockRedeemManagerV1Base { - function initializeRedeemManagerV1_2(address[] calldata _prevInitiators) external init(1) { - _redeemQueueMigrationV1_2(_prevInitiators); - } - - function _redeemQueueMigrationV1_2(address[] memory _prevInitiators) internal { - RedeemQueueV1.RedeemRequest[] memory initialQueue = RedeemQueueV1.get(); - RedeemQueueV1_2.RedeemRequest[] memory currentQueue = RedeemQueueV1_2.get(); //TODO: Remove after dev upgrade, not needed for staging/prod - uint256 currentQueueLen = currentQueue.length; - RedeemQueueV2.RedeemRequest[] storage newQueue = RedeemQueueV2.get(); - - if (currentQueue.length == 0) { - return; - } - - //TODO: Remove after dev upgrade, not needed for staging/prod - if (_prevInitiators.length != 7) { - revert IncompatibleArrayLengths(); - } - - //TODO: Remove after dev upgrade, not needed for staging/prod - for (uint256 i = 0; i < 7;) { - newQueue[i] = RedeemQueueV2.RedeemRequest({ - amount: initialQueue[i].amount, - maxRedeemableEth: initialQueue[i].maxRedeemableEth, - recipient: initialQueue[i].recipient, - height: initialQueue[i].height, - initiator: _prevInitiators[i] // Assign the provided initiators - }); - - unchecked { - ++i; - } - } - - uint256 heightDeficit = initialQueue[6].height + initialQueue[6].amount; - for (uint256 i = 7; i < currentQueueLen;) { - newQueue[i] = RedeemQueueV2.RedeemRequest({ - amount: currentQueue[i].amount, - maxRedeemableEth: currentQueue[i].maxRedeemableEth, - recipient: currentQueue[i].recipient, - height: currentQueue[i].height + heightDeficit, - initiator: currentQueue[i].initiator // Reuse the initiator from the current queue - }); - - unchecked { - ++i; - } - } - } - - function getRedeemRequestCount() external view returns (uint256) { - return RedeemQueueV2.get().length; - } - - function getRedeemRequestDetails(uint32 _redeemRequestId) - external - view - returns (RedeemQueueV2.RedeemRequest memory) - { - return RedeemQueueV2.get()[_redeemRequestId]; - } - - function requestRedeem(uint256 _lsETHAmount, address _recipient) - external - onlyRedeemerOrRiver - returns (uint32 redeemRequestId) - { - IRiverV1 river = _castedRiver(); - if (IAllowlistV1(river.getAllowlist()).isDenied(_recipient)) { - revert RecipientIsDenied(); - } - return _requestRedeem(_lsETHAmount, _recipient); - } - - function _requestRedeem(uint256 _lsETHAmount, address _recipient) internal returns (uint32 redeemRequestId) { - LibSanitize._notZeroAddress(_recipient); - if (_lsETHAmount == 0) { - revert InvalidZeroAmount(); - } - if (!_castedRiver().transferFrom(msg.sender, address(this), _lsETHAmount)) { - revert TransferError(); - } - RedeemQueueV2.RedeemRequest[] storage redeemRequests = RedeemQueueV2.get(); - redeemRequestId = uint32(redeemRequests.length); - uint256 height = 0; - if (redeemRequestId != 0) { - RedeemQueueV2.RedeemRequest memory previousRedeemRequest = redeemRequests[redeemRequestId - 1]; - height = previousRedeemRequest.height + previousRedeemRequest.amount; - } - - uint256 maxRedeemableEth = _castedRiver().underlyingBalanceFromShares(_lsETHAmount); - - redeemRequests.push( - RedeemQueueV2.RedeemRequest({ - height: height, - amount: _lsETHAmount, - recipient: _recipient, - initiator: msg.sender, - maxRedeemableEth: maxRedeemableEth - }) - ); - - _setRedeemDemand(RedeemDemand.get() + _lsETHAmount); - - emit RequestedRedeem(_recipient, height, _lsETHAmount, maxRedeemableEth, redeemRequestId); - } -} - contract InitializeRedeemManagerV1_2Test is RedeeManagerV1TestBase { address[] public prevInitiators; address public admin = address(0x123); diff --git a/contracts/test/River.1.t.sol b/contracts/test/River.1.t.sol index be6c249c..57fc5518 100644 --- a/contracts/test/River.1.t.sol +++ b/contracts/test/River.1.t.sol @@ -200,7 +200,7 @@ contract RiverV1Tests is RiverV1TestBase { } function testVersion() external { - assertEq(river.version(), "1.2.0"); + assertEq(river.version(), "1.2.1"); } function testOnlyAdminCanSetKeeper() public { diff --git a/contracts/test/Withdraw.1.t.sol b/contracts/test/Withdraw.1.t.sol index 400f2609..135da59b 100644 --- a/contracts/test/Withdraw.1.t.sol +++ b/contracts/test/Withdraw.1.t.sol @@ -166,6 +166,6 @@ contract WithdrawV1Tests is WithdrawV1TestBase { } function testVersion() external { - assertEq(withdraw.version(), "1.2.0"); + assertEq(withdraw.version(), "1.2.1"); } }