-
Notifications
You must be signed in to change notification settings - Fork 90
New Compounding Staking Strategy post Pectra upgrade #2559
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
base: master
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #2559 +/- ##
==========================================
+ Coverage 38.26% 40.54% +2.28%
==========================================
Files 112 121 +9
Lines 5331 5628 +297
Branches 1412 1494 +82
==========================================
+ Hits 2040 2282 +242
- Misses 3289 3344 +55
Partials 2 2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol
Show resolved
Hide resolved
Collect rewards now picked up ETH from tx priority
contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol
Outdated
Show resolved
Hide resolved
* WIP: adjust test for compoundingSSVStrategy * fix: type conversion for deposit amount in CompoundingValidatorManager * Revert "fix: type conversion for deposit amount in CompoundingValidatorManager" This reverts commit 0e49f91. * fix: type conversion for deposit amount in CompoundingValidatorManager * refactor: clean up unused variables and comments in compoundingSSVStaking tests * test: fix test for initial setup * test: update tests for adding source strategy and governor interactions * test: add unit tests for removing validators in Compounding SSV Staking Strategy * test: add deposit and withdraw functionality tests for Compounding SSV Staking Strategy * test: add unit tests for pausing strategy and withdrawing assets in Compounding SSV Staking Strategy * test: add unit test for collecting rewards in Compounding SSV Staking Strategy
* Setup Hoodi network * lint
Stripped out redundant unit tests
* enough WETH to add it up to 32 so it can be staked. For that reason the check is left out. | ||
* | ||
* WETH sitting on the strategy won't interfere with the accounting since accounting only operates on ETH. | ||
*/ | ||
emit Deposit(_asset, address(0), _amount); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this simplification 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments inline. Also 1 other issue to address that might be lost in the thread previously
contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingStakingSSVStrategy.sol
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol
Outdated
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol
Show resolved
Hide resolved
contracts/contracts/strategies/NativeStaking/CompoundingValidatorManager.sol
Show resolved
Hide resolved
Just a heads up in case it was missed. There are a couple of chats not yet resolved: |
Also updated the comments when lastSnapTimestamp is reset to zero in _convertEthToWeth and _convertWethToEth
A new staking strategy that uses merkle proofs to verify the operations of validators running on the beacon chain.
Objectives
Links
Relevant Pectra Release changes
Contracts
The scope of the contracts of this build is
CompoundingStakingSSVStrategy
is the new staking contract.CompoundingValidatorManager
is inherited byCompoundingStakingSSVStrategy
BeaconProofs
called fromCompoundingValidatorManager
The following libraries have also be built
BeaconRoots
BeaconProofsLib
PartialWithdrawal
Merkle
Endian
Hoodi
States
Beacon chain data
Beacon Container Specs
To get the consolidate beacon chain specification for the last Pectra release
build/lib/eth2spec/electra/mainnet.py
will have the full, consolidated changes. This includes all the beacon chain container definitions. eg BeaconBlock, BeaconBlockBody, BeaconState, Validator...Processes
Register a SSV validator
Initial deposit to a new validator
Deposit more to existing validator
Verify validator
Verify deposit to validator
Update strategy balances
Withdrawals
Admin
Build
Keeping the contract under 24Kb has been a problem during development. The following will show the contract size of the compile contracts including
CompoundingStakingSSVStrategy
.export CONTRACT_SIZE=true npx hardhat compile
Testing
Unit Tests
Are main strategy unit tests in
contracts/test/strategies/compoundingSSVStaking.js
There are also unit tests of the beacon merkle proofs in
contracts/test/beacon/beaconProofs.js
yarn test
Fork Tests
There are no fork tests of the strategy as its hard to mock the beacon chain. But there are fork tests of various beacon chain contracts and libraries. These includes:
Hoodi Testnet
Hoodi faucet: https://hoodi-faucet.pk910.de/
SSV faucet: https://faucet.ssv.network/
Contracts have been deployed to Hoodi with deployment scripts in
contracts/deploy/hoodi
Hoodi testing using Hardhat tasks
Deployment
Hoodi
Code Change Checklist
To be completed before internal review begins:
Internal review: