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

Simple Harvester V2 for SSV strategies. #2363

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

Conversation

clement-ux
Copy link
Contributor

@clement-ux clement-ux commented Jan 23, 2025

Contracts

  • Modify OETH simple harvester to transfer WETH directly to FixedRateDripper instead of strategist.

Governance

  1. Deploy new simple Harvester (proxy + implementation).
  2. Change harvester on all SSV strategies.
  3. Support SSV strategies on the harvester.
  4. Sending all WETH from the OldDripper to FixedRateDripper.
  5. Update harvester on OETH AMO.
  6. Support AMO strategy on new harvester.

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 Jan 23, 2025

Warnings
⚠️ 👀 This PR needs at least 2 reviewers

Generated by 🚫 dangerJS against 2ee3f5f

Copy link

codecov bot commented Jan 23, 2025

Codecov Report

Attention: Patch coverage is 89.47368% with 2 lines in your changes missing coverage. Please review.

Project coverage is 51.53%. Comparing base (aca54e1) to head (2ee3f5f).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...ontracts/contracts/harvest/OETHHarvesterSimple.sol 89.47% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2363      +/-   ##
==========================================
+ Coverage   50.80%   51.53%   +0.72%     
==========================================
  Files          92       92              
  Lines        4513     4527      +14     
  Branches     1195     1200       +5     
==========================================
+ Hits         2293     2333      +40     
+ Misses       2217     2191      -26     
  Partials        3        3              

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

@clement-ux clement-ux marked this pull request as ready for review January 24, 2025 06:53
shahthepro
shahthepro previously approved these changes Jan 24, 2025
@clement-ux clement-ux requested a review from naddison36 January 24, 2025 09:41
shahthepro
shahthepro previously approved these changes Jan 30, 2025
////////////////////////////////////////////////////
/// --- STORAGE
////////////////////////////////////////////////////
/// @notice Gap for upgrade safety
uint256[50] private ___gap;
Copy link
Member

Choose a reason for hiding this comment

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

Usually we place the __gap after the local properties (after supportedStrategies mapping) and make it so that local variables + the gap make up a round number. In this case since the dripper takes 1 slot and supportedStrategies another one, uint256[48] private ___gap; would be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought we were using gaps to prevent reusing slots that have already been allocated in the previous implementation. That’s why I placed it at the front.

In the PR description, I included a picture showing that 7 slots are already in use. Therefore, I added a gap before introducing new storage variables to avoid any conflicts.
I’m not an expert on proxies and may not be as familiar with this as some of you. Please let me know if this doesn’t make sense!

If it does, should I consider using 41 or 43 for the gap to reach a round number?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, its important to line up the slots so they are backward compatible with the exiting OETHHarvester

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is what the slots in the current OETHHarvesterProxy contract look like

OETHHarvester

And here's the slots for the new OETHHarvesterSimple contract
OETHHarvesterSimpleStorage

Copy link
Collaborator

Choose a reason for hiding this comment

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

ok, after talking through this one. Let's not upgrade the exiting OETHHarvesterProxy. Instead we'll do what the current scripts do which is deploy and new OETHHarvesterSimpleProxy and OETHHarvesterSimple implementation. All the strategies can then be changed to use the new harvester

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the confusion.
I’ve changed the gap position and value accordingly to @sparrowDom comment: 5e7f623.

.connect(strategist)["harvestAndTransfer(address)"](nativeStakingSSVStrategy.address);

const balanceAfterWETH = await weth.balanceOf(oethFixedRateDripper.address);
expect(balanceAfterWETH).to.be.gt(balanceBeforeWETH);
Copy link
Member

Choose a reason for hiding this comment

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

If 1 ETH is sent to the fee accumulator the balanceAfterWETH should be at least:
to.be.gte(balanceBeforeWETH.add(oethUnits("1")))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed! Changed in this commit: bededf7

.connect(timelock)["harvestAndTransfer(address)"](nativeStakingSSVStrategy.address);

const balanceAfterWETH = await weth.balanceOf(oethFixedRateDripper.address);
expect(balanceAfterWETH).to.be.gt(balanceBeforeWETH);
Copy link
Member

Choose a reason for hiding this comment

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

similar comment here as a little bit above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed in this commit: bededf7

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 otherwise looks good

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