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

feat: healthy ratio #955

Merged
merged 7 commits into from
Feb 24, 2025
Merged

feat: healthy ratio #955

merged 7 commits into from
Feb 24, 2025

Conversation

tamtamchik
Copy link
Member

@tamtamchik tamtamchik commented Feb 20, 2025

This pull request includes significant updates to the VaultHub contract, focusing on improving the handling of vault health and the process of disconnecting vaults. Additionally, it includes updates to the corresponding tests.

Key Changes:

Vault Health and Rebalancing:

  • Renamed the isVaultBalanced function to isHealthy and updated its logic to check if the vault's valuation minus required reserves is sufficient to cover the current value of minted shares.
  • Added a new internal function _requireUnhealthy to check if a vault is unhealthy before allowing certain operations.
  • Updated the forceRebalance function to use _requireUnhealthy instead of checking the threshold directly.
  • Simplified the forceValidatorExit function by removing redundant checks and using _requireUnhealthy.

Vault Disconnection:

  • Replaced the isDisconnected flag with pendingDisconnect to better reflect the state of a vault awaiting disconnection.
  • Updated various parts of the code to use pendingDisconnect instead of isDisconnected.

Event and Error Handling:

  • Renamed the VaultForceWithdrawalTriggered event to ForceValidatorExitTriggered for clarity.
  • Updated the AlreadyBalanced error to AlreadyHealthy to align with the new terminology.

Test Updates:

  • Updated the test cases to reflect the changes in the VaultHub contract, particularly the renaming of isDisconnected to pendingDisconnect.
  • Adjusted imports and deployment logic in accounting.test.ts to remove unused variables and correct contract names.

Copy link

github-actions bot commented Feb 20, 2025

badge

Hardhat Unit Tests Coverage Summary

Filename                                                       Stmts    Miss  Cover    Missing
-----------------------------------------------------------  -------  ------  -------  -----------------------------------------------------------------------------------
contracts/0.4.24/Lido.sol                                        201       6  97.01%   741, 746, 787-789, 946-947
contracts/0.4.24/StETH.sol                                        79       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                   512       0  100.00%
contracts/0.4.24/oracle/LegacyOracle.sol                          72       0  100.00%
contracts/0.4.24/utils/Pausable.sol                                9       0  100.00%
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/Accounting.sol                                   90       5  94.44%   123-126, 352, 378
contracts/0.8.25/interfaces/IDepositContract.sol                   0       0  100.00%
contracts/0.8.25/interfaces/ILido.sol                              0       0  100.00%
contracts/0.8.25/interfaces/IOracleReportSanityChecker.sol         0       0  100.00%
contracts/0.8.25/interfaces/IPostTokenRebaseReceiver.sol           0       0  100.00%
contracts/0.8.25/interfaces/IStakingRouter.sol                     0       0  100.00%
contracts/0.8.25/interfaces/IWithdrawalQueue.sol                   0       0  100.00%
contracts/0.8.25/utils/AccessControlConfirmable.sol               30       0  100.00%
contracts/0.8.25/utils/PausableUntilWithRoles.sol                  3       0  100.00%
contracts/0.8.25/vaults/Dashboard.sol                             85       0  100.00%
contracts/0.8.25/vaults/Delegation.sol                            40       0  100.00%
contracts/0.8.25/vaults/Permissions.sol                           32       0  100.00%
contracts/0.8.25/vaults/StakingVault.sol                         133       0  100.00%
contracts/0.8.25/vaults/VaultFactory.sol                          45       0  100.00%
contracts/0.8.25/vaults/VaultHub.sol                             160      31  80.63%   260, 310-354, 490-499, 505-513
contracts/0.8.25/vaults/interfaces/IStakingVault.sol               0       0  100.00%
contracts/0.8.4/WithdrawalsManagerProxy.sol                       61       0  100.00%
contracts/0.8.9/BeaconChainDepositor.sol                          21       2  90.48%   48, 51
contracts/0.8.9/Burner.sol                                        72       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                                   20       0  100.00%
contracts/0.8.9/OracleDaemonConfig.sol                            28       0  100.00%
contracts/0.8.9/StakingRouter.sol                                316       0  100.00%
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                               40       0  100.00%
contracts/0.8.9/lib/Math.sol                                       4       0  100.00%
contracts/0.8.9/lib/PositiveTokenRebaseLimiter.sol                22      22  0.00%    88-172
contracts/0.8.9/lib/UnstructuredRefStorage.sol                     2       0  100.00%
contracts/0.8.9/oracle/AccountingOracle.sol                      190       2  98.95%   154-155
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/ValidatorsExitBusOracle.sol                91       2  97.80%   138, 315
contracts/0.8.9/proxy/OssifiableProxy.sol                         17       0  100.00%
contracts/0.8.9/sanity_checks/OracleReportSanityChecker.sol      218      50  77.06%   195, 232, 273-286, 306-324, 413-441, 495, 558-561, 569, 578, 586, 697, 702-747, 802
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%
contracts/testnets/sepolia/SepoliaDepositAdapter.sol              21      21  0.00%    49-100
TOTAL                                                           3667     143  96.10%

Diff against master

Filename                                                       Stmts    Miss  Cover
-----------------------------------------------------------  -------  ------  --------
contracts/0.4.24/Lido.sol                                        -11      +6  -2.99%
contracts/0.4.24/StETH.sol                                        +7       0  +100.00%
contracts/0.8.25/Accounting.sol                                  +90      +5  +94.44%
contracts/0.8.25/interfaces/IDepositContract.sol                   0       0  +100.00%
contracts/0.8.25/interfaces/ILido.sol                              0       0  +100.00%
contracts/0.8.25/interfaces/IOracleReportSanityChecker.sol         0       0  +100.00%
contracts/0.8.25/interfaces/IPostTokenRebaseReceiver.sol           0       0  +100.00%
contracts/0.8.25/interfaces/IStakingRouter.sol                     0       0  +100.00%
contracts/0.8.25/interfaces/IWithdrawalQueue.sol                   0       0  +100.00%
contracts/0.8.25/utils/AccessControlConfirmable.sol              +30       0  +100.00%
contracts/0.8.25/utils/PausableUntilWithRoles.sol                 +3       0  +100.00%
contracts/0.8.25/vaults/Dashboard.sol                            +85       0  +100.00%
contracts/0.8.25/vaults/Delegation.sol                           +40       0  +100.00%
contracts/0.8.25/vaults/Permissions.sol                          +32       0  +100.00%
contracts/0.8.25/vaults/StakingVault.sol                        +133       0  +100.00%
contracts/0.8.25/vaults/VaultFactory.sol                         +45       0  +100.00%
contracts/0.8.25/vaults/VaultHub.sol                            +160     +31  +80.63%
contracts/0.8.25/vaults/interfaces/IStakingVault.sol               0       0  +100.00%
contracts/0.8.9/Burner.sol                                        +1       0  +100.00%
contracts/0.8.9/LidoLocator.sol                                   +2       0  +100.00%
contracts/0.8.9/WithdrawalVault.sol                              +19       0  +100.00%
contracts/0.8.9/lib/PositiveTokenRebaseLimiter.sol                 0     +22  -100.00%
contracts/0.8.9/oracle/ValidatorsExitBusOracle.sol                 0     -89  +97.80%
contracts/0.8.9/sanity_checks/OracleReportSanityChecker.sol      -14     +50  -22.94%
contracts/common/utils/PausableUntil.sol                         +29       0  +100.00%
TOTAL                                                           +651     +25  +0.01%

Results for commit: 91eb54c

Minimum allowed coverage is 90%

♻️ This comment has been updated with latest results

@tamtamchik tamtamchik changed the title Feat/healthy feat: healthy ratio Feb 21, 2025
@tamtamchik tamtamchik marked this pull request as ready for review February 21, 2025 12:17
@tamtamchik tamtamchik requested a review from a team as a code owner February 21, 2025 12:17
Copy link
Member Author

@tamtamchik tamtamchik 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 merged commit 9c22cdf into feat/vaults-triggerable-exits Feb 24, 2025
9 checks passed
@tamtamchik tamtamchik deleted the feat/healthy branch February 24, 2025 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants