-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix redeem queue struct changes - PE-50 (#289)
* fix: update redeem queue structure in state to prevent storage corruption * chore: update redeemManager test to reflect changes * chore: add migration test on mainnet and testnet fork * chore: added some logs for testing * chore: some code cleanup * chore: add deployment file for redeemManager upgrade * chore: natspec upgrade * fix: introduce redeemQueueV1_2 structure for migrstion on dev * chore: update redeemManager migration test * chore: update deployment file for redeemManager upgrade * chore: fix formatting * chore: add unit tests for InitializeRedeemManagerV1_2 * chore: update InitializeRedeemManagerV1_2 test * chore: improve formatting
- Loading branch information
1 parent
7f7a245
commit 77d0670
Showing
17 changed files
with
1,179 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.20; | ||
|
||
/// @title Redeem Manager Redeem Queue storage | ||
/// @notice Utility to manage the Redeem Queue in the Redeem Manager | ||
library RedeemQueueV1_2 { | ||
/// @notice Storage slot of the Redeem Queue | ||
bytes32 internal constant REDEEM_QUEUE_ID_SLOT = bytes32(uint256(keccak256("river.state.redeemQueue")) - 1); | ||
|
||
/// @notice The updated V1_2 Redeemer structure represents the redeem request made by a user | ||
struct RedeemRequest { | ||
/// @custom:attribute The amount of the redeem request in LsETH | ||
uint256 amount; | ||
/// @custom:attribute The maximum amount of ETH redeemable by this request | ||
uint256 maxRedeemableEth; | ||
/// @custom:attribute The recipient of the redeem request | ||
address recipient; | ||
/// @custom:attribute The initiator of the redeem request | ||
address initiator; | ||
/// @custom:attribute The height is the cumulative sum of all the sizes of preceding redeem requests | ||
uint256 height; | ||
} | ||
|
||
/// @notice Retrieve the Redeem Queue array storage pointer | ||
/// @return data The Redeem Queue array storage pointer | ||
function get() internal pure returns (RedeemRequest[] storage data) { | ||
bytes32 position = REDEEM_QUEUE_ID_SLOT; | ||
assembly { | ||
data.slot := position | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
//SPDX-License-Identifier: BUSL-1.1 | ||
pragma solidity 0.8.20; | ||
|
||
/// @title Redeem Manager Redeem Queue storage | ||
/// @notice Utility to manage the Redeem Queue in the Redeem Manager | ||
library RedeemQueueV2 { | ||
/// @notice Storage slot of the Redeem Queue | ||
bytes32 internal constant REDEEM_QUEUE_ID_SLOT = bytes32(uint256(keccak256("river.state.redeemQueue")) - 1); | ||
|
||
/// @notice The updated V1_2 Redeemer structure represents the redeem request made by a user | ||
struct RedeemRequest { | ||
/// @custom:attribute The amount of the redeem request in LsETH | ||
uint256 amount; | ||
/// @custom:attribute The maximum amount of ETH redeemable by this request | ||
uint256 maxRedeemableEth; | ||
/// @custom:attribute The recipient of the redeem request | ||
address recipient; | ||
/// @custom:attribute The height is the cumulative sum of all the sizes of preceding redeem requests | ||
uint256 height; | ||
/// @custom:attribute The initiator of the redeem request | ||
address initiator; | ||
} | ||
|
||
/// @notice Retrieve the Redeem Queue array storage pointer | ||
/// @return data The Redeem Queue array storage pointer | ||
function get() internal pure returns (RedeemRequest[] storage data) { | ||
bytes32 position = REDEEM_QUEUE_ID_SLOT; | ||
assembly { | ||
data.slot := position | ||
} | ||
} | ||
} |
Oops, something went wrong.