8000 Lazy oracle unit tests by vp4242 · Pull Request #1192 · lidofinance/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Lazy oracle unit tests #1192

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

Open
wants to merge 11 commits into
base: feat/testnet-2
Choose a base branch
from
Open

Lazy oracle unit tests #1192

wants to merge 11 commits into from

Conversation

vp4242
Copy link
Member
@vp4242 vp4242 commented Jun 18, 2025

Lazy oracle unit tests (batch and count)

@vp4242 vp4242 requested a review from a team as a code owner June 18, 2025 17:08
Copy link
github-actions bot commented Jun 18, 2025

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                                     85       3  96.47%   194, 317, 328
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                                             85       2  97.65%   304-305
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%   275
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
8000
/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                                                                    4582     225  95.09%

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                                    +85      +3  +96.47%
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                                            +85      +2  +97.65%
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                                                                   +1720    +217  -3.95%

Results for commit: ad33d44

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

@vp4242 vp4242 added tests When it comes to testing the code vaults Lido stVaults related changes labels Jun 26, 2025
@vp4242 vp4242 changed the title Lazy oracle unit tests (batch and count) Lazy oracle unit tests Jul 1, 2025
Copy link
@dry914 dry914 left a comment

Choose a reason for hiding this comment

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

Leaved a few comments, looks good in general.

context("sanity params", () => {
it("update quarantine period", async () => {
await lazyOracle.grantRole(await lazyOracle.UPDATE_SANITY_PARAMS_ROLE(), deployer.address);
await lazyOracle.updateSanityParams(250000n, 1000n);
Copy link

Choose a reason for hiding this comment

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

I think it would be useful to add test case when address without UPDATE_SANITY_PARAMS_ROLE tries to call updateSanityParams function (with revert).

vaultReport3[3],
vaultReport3[4],
tree3.getProof(0),
);
Copy link

Choose a reason for hiding this comment

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

Here we can check QuarantinedDeposit event

vaultReport4[3],
vaultReport4[4],
tree4.getProof(0),
);
Copy link

Choose a reason for hiding this comment

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

Here we can check QuarantineExpired event

});

context("handleSanityChecks", () => {
it("limit", async () => {
Copy link

Choose a reason for hiding this comment

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

I think it would be valuable to add test for this logic:

some percentage of funds hasn't passed through the vault's balance is allowed for the EL and CL rewards handling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants
0