Skip to content

Conversation

tamtamchik
Copy link
Member

@tamtamchik tamtamchik commented Nov 17, 2024

❗ 🚧 Under construction 🚧 ❗

Staking Vaults

New way of isolated staking, through separate vaults, with optional stETH liquidity

  • Support minting external backed stETH in Lido contract
  • Extract protocol accounting to separate contract (two-step, better precision)
  • StakingVault + VaultHub
  • Dashboard
  • VaultFactory
  • OperatorGrid
  • PredepositGuarantee
  • LazyOracle

@folkyatina folkyatina changed the base branch from master to develop November 27, 2024 07:48
@folkyatina folkyatina changed the base branch from develop to master November 27, 2024 07:48
@TheDZhon TheDZhon self-requested a review November 27, 2024 08:05
Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

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

πŸ‘€

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

Slither found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link

github-actions bot commented Nov 27, 2024

badge

Hardhat Unit Tests Coverage Summary

Filename                                                                Stmts    Miss  Cover    Missing
--------------------------------------------------------------------  -------  ------  -------  --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
contracts/0.4.24/Lido.sol                                                 240      12  95.00%   769-787, 867-879, 1007-1008
contracts/0.4.24/StETH.sol                                                 82       0  100.00%
contracts/0.4.24/StETHPermit.sol                                           15       0  100.00%
contracts/0.4.24/lib/Packed64x4.sol                                         5       0  100.00%
contracts/0.4.24/lib/SigningKeys.sol                                       36       0  100.00%
contracts/0.4.24/lib/StakeLimitUtils.sol                                   37       0  100.00%
contracts/0.4.24/nos/NodeOperatorsRegistry.sol                            435       0  100.00%
contracts/0.4.24/utils/Pausable.sol                                         9       0  100.00%
contracts/0.4.24/utils/UnstructuredStorageUint128.sol                      14       1  92.86%   49
contracts/0.4.24/utils/Versioned.sol                                        5       0  100.00%
contracts/0.6.12/WstETH.sol                                                17       0  100.00%
contracts/0.8.25/ValidatorExitDelayVerifier.sol                            64       0  100.00%
contracts/0.8.25/utils/AccessControlConfirmable.sol                         2       0  100.00%
contracts/0.8.25/utils/Confirmable2Addresses.sol                            5       0  100.00%
contracts/0.8.25/utils/Confirmations.sol                                   37       0  100.00%
contracts/0.8.25/utils/PausableUntilWithRoles.sol                           3       0  100.00%
contracts/0.8.25/vaults/LazyOracle.sol                                     84      67  20.24%   144-145, 155-226, 262-360, 371-379, 389-393
contracts/0.8.25/vaults/OperatorGrid.sol                                  149       0  100.00%
contracts/0.8.25/vaults/PinnedBeaconProxy.sol                               5       0  100.00%
contracts/0.8.25/vaults/StakingVault.sol                                   98       0  100.00%
contracts/0.8.25/vaults/ValidatorConsolidationRequests.sol                 56       2  96.43%   100, 187
contracts/0.8.25/vaults/VaultFactory.sol                                   30       0  100.00%
contracts/0.8.25/vaults/VaultHub.sol                                      391     168  57.03%   231-232, 245-262, 274-308, 321-329, 416-479, 535-536, 573-670, 693-712, 749-758, 775-870, 893-944, 1015, 1089, 1118-1126, 1154, 1275, 1281-1282, 1402, 1410-1424, 1438-1442, 1473-1476, 1517, 1529
contracts/0.8.25/vaults/dashboard/Dashboard.sol                           120       0  100.00%
contracts/0.8.25/vaults/dashboard/NodeOperatorFee.sol                      70       0  100.00%
contracts/0.8.25/vaults/dashboard/Permissions.sol                          50       0  100.00%
contracts/0.8.25/vaults/interfaces/IPredepositGuarantee.sol                 0       0  100.00%
contracts/0.8.25/vaults/interfaces/IStakingVault.sol                        0       0  100.00%
contracts/0.8.25/vaults/lib/PinnedBeaconUtils.sol                           6       0  100.00%
contracts/0.8.25/vaults/lib/RefSlotCache.sol                               22      17  22.73%   31-42, 60-61, 77-97
contracts/0.8.25/vaults/predeposit_guarantee/CLProofVerifier.sol           16       1  93.75%   214
contracts/0.8.25/vaults/predeposit_guarantee/MeIfNobodyElse.sol             3       0  100.00%
contracts/0.8.25/vaults/predeposit_guarantee/PredepositGuarantee.sol      159       0  100.00%
contracts/0.8.9/Accounting.sol                                             83       2  97.59%   297-298
contracts/0.8.9/BeaconChainDepositor.sol                                   21       2  90.48%   48, 51
contracts/0.8.9/Burner.sol                                                 92       0  100.00%
contracts/0.8.9/DepositSecurityModule.sol                                 128       0  100.00%
contracts/0.8.9/EIP712StETH.sol                                            16       0  100.00%
contracts/0.8.9/LidoExecutionLayerRewardsVault.sol                         16       0  100.00%
contracts/0.8.9/LidoLocator.sol                                            26       0  100.00%
contracts/0.8.9/OracleDaemonConfig.sol                                     28       0  100.00%
contracts/0.8.9/StakingRouter.sol                                         305       0  100.00%
contracts/0.8.9/TriggerableWithdrawalsGateway.sol                          54       1  98.15%   274
contracts/0.8.9/WithdrawalQueue.sol                                        88       0  100.00%
contracts/0.8.9/WithdrawalQueueBase.sol                                   146       0  100.00%
contracts/0.8.9/WithdrawalQueueERC721.sol                                  89       0  100.00%
contracts/0.8.9/WithdrawalVault.sol                                        32       0  100.00%
contracts/0.8.9/WithdrawalVaultEIP7002.sol                                 21       0  100.00%
contracts/0.8.9/lib/ExitLimitUtils.sol                                     31       0  100.00%
contracts/0.8.9/lib/Math.sol                                                4       0  100.00%
contracts/0.8.9/lib/PositiveTokenRebaseLimiter.sol                         22       0  100.00%
contracts/0.8.9/lib/UnstructuredRefStorage.sol                              2       0  100.00%
contracts/0.8.9/oracle/AccountingOracle.sol                               173       2  98.84%   123-124
contracts/0.8.9/oracle/BaseOracle.sol                                      89       1  98.88%   397
contracts/0.8.9/oracle/HashConsensus.sol                                  263       1  99.62%   1005
contracts/0.8.9/oracle/ValidatorsExitBus.sol                              136      10  92.65%   440-453, 516
contracts/0.8.9/oracle/ValidatorsExitBusOracle.sol                         53       1  98.11%   232
contracts/0.8.9/proxy/OssifiableProxy.sol                                  17       0  100.00%
contracts/0.8.9/proxy/WithdrawalsManagerProxy.sol                          60       0  100.00%
contracts/0.8.9/sanity_checks/OracleReportSanityChecker.sol               216       1  99.54%   860
contracts/0.8.9/utils/DummyEmptyContract.sol                                0       0  100.00%
contracts/0.8.9/utils/PausableUntil.sol                                    31       0  100.00%
contracts/0.8.9/utils/Versioned.sol                                        11       0  100.00%
contracts/0.8.9/utils/access/AccessControl.sol                             23       0  100.00%
contracts/0.8.9/utils/access/AccessControlEnumerable.sol                    9       0  100.00%
contracts/common/utils/PausableUntil.sol                                   29       0  100.00%
TOTAL                                                                    4579     289  93.69%

Diff against master

Filename                                                                Stmts    Miss  Cover
--------------------------------------------------------------------  -------  ------  --------
contracts/0.4.24/Lido.sol                                                 +28     +12  -5.00%
contracts/0.4.24/StETH.sol                                                +10       0  +100.00%
contracts/0.4.24/nos/NodeOperatorsRegistry.sol                            -77       0  +100.00%
contracts/0.4.24/utils/UnstructuredStorageUint128.sol                     +14      +1  +92.86%
contracts/0.8.25/ValidatorExitDelayVerifier.sol                           +64       0  +100.00%
contracts/0.8.25/utils/AccessControlConfirmable.sol                        +2       0  +100.00%
contracts/0.8.25/utils/Confirmable2Addresses.sol                           +5       0  +100.00%
contracts/0.8.25/utils/Confirmations.sol                                  +37       0  +100.00%
contracts/0.8.25/utils/PausableUntilWithRoles.sol                          +3       0  +100.00%
contracts/0.8.25/vaults/LazyOracle.sol                                    +84     +67  +20.24%
contracts/0.8.25/vaults/OperatorGrid.sol                                 +149       0  +100.00%
contracts/0.8.25/vaults/PinnedBeaconProxy.sol                              +5       0  +100.00%
contracts/0.8.25/vaults/StakingVault.sol                                  +98       0  +100.00%
contracts/0.8.25/vaults/ValidatorConsolidationRequests.sol                +56      +2  +96.43%
contracts/0.8.25/vaults/VaultFactory.sol                                  +30       0  +100.00%
contracts/0.8.25/vaults/VaultHub.sol                                     +391    +168  +57.03%
contracts/0.8.25/vaults/dashboard/Dashboard.sol                          +120       0  +100.00%
contracts/0.8.25/vaults/dashboard/NodeOperatorFee.sol                     +70       0  +100.00%
contracts/0.8.25/vaults/dashboard/Permissions.sol                         +50       0  +100.00%
contracts/0.8.25/vaults/interfaces/IPredepositGuarantee.sol                 0       0  +100.00%
contracts/0.8.25/vaults/interfaces/IStakingVault.sol                        0       0  +100.00%
contracts/0.8.25/vaults/lib/PinnedBeaconUtils.sol                          +6       0  +100.00%
contracts/0.8.25/vaults/lib/RefSlotCache.sol                              +22     +17  +22.73%
contracts/0.8.25/vaults/predeposit_guarantee/CLProofVerifier.sol          +16      +1  +93.75%
contracts/0.8.25/vaults/predeposit_guarantee/MeIfNobodyElse.sol            +3       0  +100.00%
contracts/0.8.25/vaults/predeposit_guarantee/PredepositGuarantee.sol     +159       0  +100.00%
contracts/0.8.9/Accounting.sol                                            +83      +2  +97.59%
contracts/0.8.9/Burner.sol                                                +21       0  +100.00%
contracts/0.8.9/LidoLocator.sol                                            +8       0  +100.00%
contracts/0.8.9/StakingRouter.sol                                         -11       0  +100.00%
contracts/0.8.9/TriggerableWithdrawalsGateway.sol                         +54      +1  +98.15%
contracts/0.8.9/WithdrawalVault.sol                                       +11       0  +100.00%
contracts/0.8.9/WithdrawalVaultEIP7002.sol                                +21       0  +100.00%
contracts/0.8.9/lib/ExitLimitUtils.sol                                    +31       0  +100.00%
contracts/0.8.9/oracle/AccountingOracle.sol                               -17       0  -0.11%
contracts/0.8.9/oracle/ValidatorsExitBus.sol                             +136     +10  +92.65%
contracts/0.8.9/oracle/ValidatorsExitBusOracle.sol                        -38      -1  +0.31%
contracts/0.8.9/proxy/WithdrawalsManagerProxy.sol                         +60       0  +100.00%
contracts/0.8.9/sanity_checks/OracleReportSanityChecker.sol               -16      +1  -0.46%
contracts/common/utils/PausableUntil.sol                                  +29       0  +100.00%
TOTAL                                                                   +1717    +281  -5.35%

Results for commit: fb4f7e5

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

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

πŸ‘€

Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

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

πŸ‘€

@tamtamchik tamtamchik changed the base branch from master to develop November 29, 2024 11:56
Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

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

πŸ‘€

Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

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

πŸ‘€ πŸ‘€ πŸ‘€

Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

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

πŸš›

Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

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

πŸš› πŸš› πŸš›

@tamtamchik tamtamchik added solidity Smart contract code changes next upgrade Things to pickup for the next protocol upgrade vaults Lido stVaults related changes labels Dec 12, 2024
Copy link
Contributor

@TheDZhon TheDZhon left a comment

Choose a reason for hiding this comment

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

First lap finished πŸ‘

* @param _expectedSettledGrowth The expected current settled growth
* @return bool True if correction was applied, false if awaiting confirmations
*/
function correctSettledGrowth(int256 _newSettledGrowth, int256 _expectedSettledGrowth) public returns (bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ This method may be difficult to use, since the trustless disburseFee() function allows anyone to modify the settledGrowth value after a new oracle report arrives. This may reduce the time window available for the node operator and vault owner to collect confirmations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

solidity Smart contract code changes tests When it comes to testing the code vaults Lido stVaults related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.