Skip to content
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

Enable async withdrawals on superOETHb #2275

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

shahthepro
Copy link
Collaborator

@shahthepro shahthepro commented Oct 12, 2024

Changes Overview

  • Removes CLAIM_DELAY constant in favour of a withdrawalClaimDelay variable
  • withdrawalClaimDelay has an hardcoded limit of 10m to 7d (to avoid accidentally or intentionally setting a huge withdrawal claim period)
  • withdrawalClaimDelay can be set to zero to disable async withdrawals. This will prevent users from making any new withdrawal requests. However, they'd be able to claim any pending withdrawals instantly after disabling it

Code Change Checklist

To be completed before internal review begins:

  • The contract code is complete
  • Executable deployment file
  • Fork tests that test after the deployment file runs
  • Unit tests *if needed
  • The owner has done a full checklist review of the code + tests

Internal review:

  • Two approvals by internal reviewers

Copy link

github-actions bot commented Oct 12, 2024

Warnings
⚠️ 👀 This PR needs at least 2 reviewers

Generated by 🚫 dangerJS against 09ece7c

Copy link

codecov bot commented Oct 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.36%. Comparing base (95ece09) to head (09ece7c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2275      +/-   ##
==========================================
+ Coverage   53.26%   53.36%   +0.09%     
==========================================
  Files          79       79              
  Lines        4089     4089              
  Branches     1074      823     -251     
==========================================
+ Hits         2178     2182       +4     
+ Misses       1908     1904       -4     
  Partials        3        3              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shahthepro shahthepro marked this pull request as ready for review October 14, 2024 08:19
sparrowDom
sparrowDom previously approved these changes Oct 14, 2024
Copy link
Member

@sparrowDom sparrowDom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of comments inline. Looks great 👍

contracts/contracts/harvest/FixedRateDripper.sol Outdated Show resolved Hide resolved
contracts/contracts/vault/VaultStorage.sol Outdated Show resolved Hide resolved
contracts/contracts/vault/VaultStorage.sol Show resolved Hide resolved
contracts/test/vault/oethb-vault.base.fork-test.js Outdated Show resolved Hide resolved
naddison36
naddison36 previously approved these changes Oct 16, 2024
Copy link
Collaborator

@naddison36 naddison36 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@@ -287,12 +288,16 @@ contract OETHVaultCore is VaultCore {
internal
returns (uint256 amount)
{
// Note: When `withdrawalClaimDelay` is set to 0, users can
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we will want to eventualy change the request.timestamp to become an end stamp rather than a start time stamp.

The current code has three awkward things:

  • If we change the claim duration, it retroactively changes the end date of inflight requests.
  • If we disable async claims by setting it to zero, it actually allows instant claims of all inflight claims.
  • If someone wrapped the governance execute() of a zero set, then they could flash loan a mint and a redeem in the same block.

However, our current upgrade on OETH will be atomically setting a value for this in the upgrade, and we don't have to use the zero value for now.

Given that the current zero value is dangerous, how about we also have the require nonzero in the claim? In this way we never accidentally give someone the ability to flashloan an 1:1 mint/redeem. We could then remove it at some future date once we've changed the code to make it safe.

*/
function setWithdrawalClaimDelay(uint256 _delay) external onlyGovernor {
require(
_delay == 0 || (_delay >= 10 minutes && _delay <= 7 days),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to set the max delay to something that's greater than the max validator withdraw time. Perhaps 10 days? (At least one LST has a 15 day timed withdraw)

_delay == 0 || (_delay >= 10 minutes && _delay <= 7 days),
"Invalid claim delay period"
);
emit WithdrawalClaimDelayUpdated(_delay);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually like doing events last, when possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants