-
Notifications
You must be signed in to change notification settings - Fork 28
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
[Certora][H-02] NFT Withdrawal Price Finalization #158
base: staging-2.5
Are you sure you want to change the base?
Conversation
fyi, The failing unit tests on the last run are from Eigenpod changes from the PEPE upgrade |
/// Stores the cached share price at the time of finalization for each batch | ||
/// For a checkpoint index i, this batch includes requests: | ||
/// `finalizationCheckpoints[i-1].lastFinalizedRequestId < requestId <= finalizationCheckpoints[i].lastFinalizedRequestId` | ||
FinalizationCheckpoint[] public finalizationCheckpoints; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can get rid of binary search and just use a map, m, of lastFinalizedRequestId -> finalizedPrice
and add lastFinalizedRequestId in WithdrawRequest. This might simplify everything. Let me know what you think and then I will re-review.
Ie. if someone wants to claim we find their WithdrawRequest get the lastFinalizedRequestId and then find the price in the map m to find the finalizedPrice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a situation that breaks this approach:
- Let's say we have request A and request B created during the same oracle report period; they will be created with the same
lastFinalizedRequestId
value - Later request A is finalized as the last request in a batch and request B isn't finalized till the next batch
- Both request A and B will incorrectly map to the same
finalizedPrice
f979658
to
71f70ae
Compare
Motivation
This pr addresses the concerns with the withdrawal flow raised by the certora team during the audit:
Features
EthAmountLockedForWithdrawal
in the new flowMigration
lastFinalizedRequestId
will be reset to 0 and the oracle will re-finalize all withdrawals with the new logic. It will be much to expensive to callcalculateTotalPendingAmount
on 30,000ish withdrawals. We will have to calculate the amount needed to re-finalized all the withdrawals off-chain and pass it on-chain withfinalizeRequests(uint256 lastRequestId, uint256 totalAmount)
. The ability to withdrawal will be temporary paused to maintain correct accounting