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

Set MEV fee recipient to FeeAccumulator for Native Staking Strategies #2179

Merged
merged 6 commits into from
Aug 12, 2024

Conversation

naddison36
Copy link
Collaborator

@naddison36 naddison36 commented Aug 9, 2024

Contract Changes

  • Added setFeeRecipient to NativeStakingSSVStrategy that calls setFeeRecipientAddress on the SSVNetwork contract.
  • Added SSV approve and setFeeRecipientAddress to the Native Staking Strategy's initialize function.

Updated Processes

Update the execution rewards to show transaction priority fee go to the strategy and only the MEV rewards go to the FeeAccumulator.

oethProcesses-rewards

Updated the initialize function and required governance calls

oethProcesses-admin

Testing

Added Anyone should be able to set the MEV fee recipient test to the SSV Native Staking behaviour tests in contracts/test/behaviour/ssvStrategy.js.

Deployment

Holesky

# uncomment DEPLOYER_PK and GOVERNOR_PK in the .env file for the Holesky deployer PK

yarn run deploy:holesky

echo "module.exports = [{
  platformAddress: \"0x0000000000000000000000000000000000000000\",
  vaultAddress: \"0x19d2bAaBA949eFfa163bFB9efB53ed8701aA5dD9\",
},
\"0x94373a4919B3240D86eA41593D5eBa789FEF3848\", // WETH
\"0xad45A78180961079BFaeEe349704F411dfF947C6\", // SSV
\"0x38A4794cCEd47d3baf7370CcC43B560D3a1beEFA\", // SSVNetwork
500,
\"0x65a289f4BF934c964C942eFF6E6F83b6481BE550\", // feeAccumulator
\"0x4242424242424242424242424242424242424242\", // depositContract
]" > native-staking-args.js

npx hardhat --network holesky verify --contract contracts/strategies/NativeStaking/NativeStakingSSVStrategy.sol:NativeStakingSSVStrategy --constructor-args native-staking-args.js 0x94f150C1aA2aC65b59628a261C1Dd592785b7218

Mainnet

Added new deploy script to upgrade both the Native Staking Strategies and call setFeeRecipient.
contracts/deploy/mainnet/104_upgrade_staking_strategies.js

yarn run deploy:mainnet | tee $DEP_NUM.out

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

Added SSV approve and setFeeRecipientAddress to the Native Staking Strategy's initialize function
Correct the Natspec on how tx fees are handled.
Added fork tests to set MEV fee recipient
Removed old native staking fork test file that is no longer being used
Copy link

github-actions bot commented Aug 9, 2024

Warnings
⚠️ 👀 This PR needs at least 2 reviewers

Generated by 🚫 dangerJS against 8cec3de

Copy link

codecov bot commented Aug 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.07%. Comparing base (4effb95) to head (8cec3de).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2179      +/-   ##
==========================================
- Coverage   59.22%   59.07%   -0.16%     
==========================================
  Files          71       71              
  Lines        3505     3509       +4     
  Branches      910      687     -223     
==========================================
- Hits         2076     2073       -3     
- Misses       1426     1433       +7     
  Partials        3        3              

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

Copy link

openzeppelin-code bot commented Aug 9, 2024

Set MEV fee recipient to FeeAccumulator for Native Staking Strategies

Generated at commit: 8cec3de61e163b72ff09a60017573f907803280f

🚨 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

Comment on lines +122 to +124
ISSVNetwork(SSV_NETWORK).setFeeRecipientAddress(
FEE_ACCUMULATOR_ADDRESS
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should setFeeRecipient be made public and used here to avoid duplicate code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I thought about adding an internal _setFeeRecipient function that was called by initialize and setFeeRecipient but that seems overkill for one line. You're suggestion of a public setFeeRecipient is a better approach to the internal function. But I still think it's overkill for a single line. I think it makes it clearer what initialize does.

IERC20(SSV_TOKEN).approve(SSV_NETWORK, type(uint256).max);

// Set the FeeAccumulator as the address for SSV validators to send MEV rewards to
ISSVNetwork(SSV_NETWORK).setFeeRecipientAddress(
Copy link
Member

Choose a reason for hiding this comment

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

nit: not a big deal, but this could also be called from the constructor

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it can't as it needs to come from the proxy contract, not the implementation contract. Hence it's in the initialize function.

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.

great job LGTM

@naddison36 naddison36 merged commit 19e9095 into master Aug 12, 2024
12 of 17 checks passed
@naddison36 naddison36 deleted the nicka/mev-fees branch August 12, 2024 23:37
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