OriginProtocol / origin-dollar

OUSD and OETH are stablecoins that passively accrue yield while you are holding it
https://originprotocol.com
MIT License
112 stars 73 forks source link

Lido withdraw strategy #2080

Closed naddison36 closed 1 month ago

naddison36 commented 1 month ago

Contract changes

Dependencies

Security

If you made a contract change, make sure to complete the checklist below before merging it in master.

Refer to our documentation for more details about contract security best practices.

Contract change checklist:

github-actions[bot] commented 1 month ago
Warnings
:warning: :eyes: This PR needs at least 2 reviewers

Generated by :no_entry_sign: dangerJS against 8afcb1df5b29289ee59adb366506706797eabe5d

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 30.43478% with 48 lines in your changes missing coverage. Please review.

Project coverage is 61.86%. Comparing base (c96032b) to head (8afcb1d).

Files Patch % Lines
...ts/contracts/strategies/LidoWithdrawalStrategy.sol 30.43% 48 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## sparrowDom/nativeStaking #2080 +/- ## ============================================================ - Coverage 62.52% 61.86% -0.67% ============================================================ Files 65 66 +1 Lines 3253 3322 +69 Branches 844 649 -195 ============================================================ + Hits 2034 2055 +21 - Misses 1216 1264 +48 Partials 3 3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

openzeppelin-code[bot] commented 1 month ago

Lido withdraw strategy

Generated at commit: 84250d688f45901d2410281d411840680651b3a0

🚨 Report Summary

Severity Level Results
Contracts Critical
High
Medium
Low
Note
Total
3
3
0
18
42
66
Dependencies Critical
High
Medium
Low
Note
Total
0
0
0
0
0
0

For more details view the full report in OpenZeppelin Code Inspector

notion-workspace[bot] commented 2 weeks ago

withdraw stETH from the Lido withdrawal queue

shahthepro commented 1 week ago

Since https://github.com/OriginProtocol/origin-dollar/pull/2097 deployed 097 already and this PR seems to be update that, we need a different deployment file

sparrowDom commented 1 week ago

@shahthepro yeah the diff on 097 deployment file is pretty terrible :) there is a clean 098 deployment file in master that is ok.

shahthepro commented 1 week ago

Requirements

The strategy should interact with Lido Withdrawal Queue and should be able to redeem stETH.

Easy Checks

Authentication

Ethereum

Cryptographic code

Gas problems

Black magic

Overflow

Proxy

Events

Medium Checks

Rounding

Dependencies

External calls

Tests

Deploy

Strategy Specific

Remove this section if the code being reviewed is not a strategy.

Strategy checks

Downstream

Thinking

Logic

Deployment Considerations

Deployment seems to be split and moved to a different file on master, so leaving it out of this review

Internal State

Everything seems about right. The contract depends on outstandingWithdrawals for all withdrawal accounting.

Attack

Doesn't seem to be vulnerable to common attacks.

Flavor

Code is simple and elegant. Doesn't seem to have any vulnerability

sparrowDom commented 6 days ago

Requirements

The strategy contract is interacting with Lido withdrawal queue to natively redeem stETH for ETH.

Easy Checks

Authentication

Ethereum

Cryptographic code

Gas problems

Black magic

Overflow

Proxy

Events

Medium Checks

Rounding

Dependencies

External calls

Tests

Deploy

Strategy Specific

Strategy checks

Downstream

Thinking

Logic

Deployment Considerations

No this is a pretty straight forward deploy.

Internal State

Does this code do that? Yes

Attack

What could the impacts of code failure in this code be. If someone would be able to influence the amount returned in checkBalance. Or interfere with the Lido's withdrawal queue lifecycle.

What conditions could cause this code to fail if they were not true. If Lido's withdrawal queue wouldn't be permissioned. If code in our contract would read the balance of tokens instead of keeping its own accounting that is immune to unexpected transfers

Does this code successfully block all attacks. yes

Flavor

Code is very clean and simple.

naddison36 commented 6 days ago

I mistakenly merged this PR to master when I merged the soETH changes.

I'll create a new branch for post merge changes nicka/lido-withdraw-strategy2.

sparrowDom commented 6 days ago

Yeah I know. I've left some comments in the code, though those 2 comments that are actionable are really nitpicky. I don't think you need to do any changes.