Vanilla validator compounding staking strategy#2905
Conversation
Refactored CompoundingStakingSSVStrategy to inherit CompoundingStakingStrategy. Removed ConsolidationController. Removed migrateClusterToETH.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## nicka/initial-deposit-32 #2905 +/- ##
============================================================
+ Coverage 50.92% 50.95% +0.03%
============================================================
Files 110 110
Lines 4882 4914 +32
Branches 1356 1358 +2
============================================================
+ Hits 2486 2504 +18
- Misses 2392 2406 +14
Partials 4 4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add registerSsvValidators and stakeEth forwarding functions to the old NativeStakingStrategy
… stored initialDepositAmountWei
…icka/vanilla-staking
Added withdrawSsvClusterEth to the NativeStakingStrategy and CompoundingStakingSSVStrategy Deploy script now upgrades old NativeStakingStrategy and CompoundingStakingSSVStrategy
sparrowDom
left a comment
There was a problem hiding this comment.
I think there is another approach to vanilla staking where the risk of not being able to fully verify the deposit on-chain is transferred from trusting the node operator's honesty to trusting our strategist's honesty.
| currentState == ValidatorState.NON_REGISTERED || | ||
| currentState == ValidatorState.VERIFIED || | ||
| currentState == ValidatorState.ACTIVE, | ||
| "Not registered or verified" |
There was a problem hiding this comment.
nit: we are mixing reverts with error messages with reverts throwing error objects ("CompoundingStakingSSVStrategy"). Are we hitting contract size limits and need to use error objects because of that?
There was a problem hiding this comment.
yes, we are hitting size limits
| { | ||
| ValidatorState currentState = validator[pubKeyHash].state; | ||
| require( | ||
| currentState == ValidatorState.NON_REGISTERED || |
There was a problem hiding this comment.
As per this comment we could allow for currentState == ValidatorState.STAKED to also admit a stake. This way we can:
- do an initial deposit of 1 ETH
- verify on beaconChain that it has been deposited
- reset the first deposit (ideally via a strategist action)
- deposit remaining 2029 ETH
We can not get front-run this way by the node operator. Extra risk is carried by the strategist though. I guess we are to decide who we can trust more.
There was a problem hiding this comment.
the problem with doing a 1 ETH deposit first is it currently takes 55 days for the deposit to be processed on the beacon chain. That's needed before the validator and deposit can be verified. It then takes another 55 days for the second 2029 ETH deposit to be processed. So that's 110 days if no yield.
While we have a large amount of ETH to deposit, we are taking on the risk that a large validator deposit could be front-run by the node operator.
There was a problem hiding this comment.
Agreed, the point I am trying to make is that we can do 1ETH & 2029ETH deposits both in 1 day. The verification that we aren't front ran can be done off-chain without waiting for the deposit to be processed by the beacon chain.
|
Claude's review 🔴 Blocker — 1. New implementation exceeds the EIP-170 size limit; migration 196 will fail to deploy on mainnet
Tests/compile pass locally only because Worth chasing: the committed config produces 25,077 bytes locally, yet the deployed mainnet artifact is only 24,223 bytes (854 smaller) — implying the Action: Before queuing 196, compile under the exact production profile and confirm runtime bytecode < 24,576 ( 🟠 High — 2. Off-chain
|
|
Thanks for your review @sparrowDom
|
Summary
This PR splits the compounding staking strategy into a deployable vanilla strategy and an SSV-specific extension, then wires the deployment flow for migrating away from the old compounding SSV strategy.
CompoundingStakingStrategyCompoundingStakingSSVStrategyCompoundingStakingStrategyProxyfor staking to vanilla compounding validatorsCompoundingStakingStrategyViewConsolidationControllerto target the new vanilla compounding strategywithdrawSsvClusterEthsupport to SSV strategies so empty SSV cluster ETH can be recoveredresetFirstDepositto be called by either Governor or StrategistDetails
CompoundingStakingStrategynow contains the shared compounding validator logic:CompoundingStakingSSVStrategynow only contains SSV-specific behavior:registerSsvValidatorremoveSsvValidatorwithdrawSsvClusterEthREGISTEREDstateThe vanilla strategy allows the first deposit to an unregistered validator:
NON_REGISTERED -> STAKEDVERIFIEDorACTIVEThe initial validator deposit amount can be configured up to
2048 ETH, and first deposits are allowed up to the storedinitialDepositAmountWei.First Deposit Reset
resetFirstDepositcan now be called by either:This lets the Strategist clear the first-deposit guard after the pending first deposit has been reviewed/handled, while still rejecting regular users.
SSV Cluster ETH Withdrawal
withdrawSsvClusterEthwas added to both:NativeStakingSSVStrategyCompoundingStakingSSVStrategyThe function is governor-only and withdraws ETH from an empty SSV cluster. Any ETH held by the strategy is wrapped to WETH and transferred back to the OETH Vault.
Consolidation
ConsolidationControllernow targets the newCompoundingStakingStrategyand only supportsnativeStakingStrategy2as a source strategy.It forwards old native staking operations through to
nativeStakingStrategy2, including:registerSsvValidatorsstakeEthdoAccountingexitSsvValidatorremoveSsvValidatorIt also forwards target strategy operations needed during consolidation:
snapBalancesverifyBalancesvalidatorWithdrawalstakeEthDeploy Script
196_deploy_compounding_staking_strategy.js:CompoundingStakingSSVStrategyimplementationNativeStakingSSVStrategy2implementationCompoundingStakingStrategyProxyCompoundingStakingStrategy2030 ETHinitial validator deposit amountBeaconProofsCompoundingStakingStrategyViewConsolidationControllerGovernance proposal actions:
CompoundingStakingSSVStrategyProxyNativeStakingSSVStrategy2ProxynativeStakingStrategy2registrator to the controllerOn fork tests, the deploy script skips the SSV cluster withdrawal and old strategy removal when the old compounding SSV cluster is not yet empty.
Testing
19382671998612Dependencies
This change is dependent on:
Verification
pnpm prettier:solpnpm prettier:jspnpm hardhat compilepnpm test test/strategies/compoundingStaking.jspnpm test test/strategies/compoundingSSVStaking.js197_deploy_compounding_staking_strategy.jsagainst a mainnet fork; deployment and governance proposal execution completed successfully.Code Change Checklist
To be completed before internal review begins:
Internal review: