-
Notifications
You must be signed in to change notification settings - Fork 195
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
Fix accounting tests for vaults #912
Conversation
Hardhat Unit Tests Coverage Summary
Diff against master
Results for commit: ade6c03 Minimum allowed coverage is ♻️ This comment has been updated with latest results |
58f9dc9
to
d456680
Compare
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 suggest to reframe it as a unit tests, without testing the lido+accounting duo together
test/deploy/dao.ts
Outdated
@@ -79,7 +79,14 @@ export async function deployLidoDao({ rootAccount, initialized, locatorConfig = | |||
await lido.initialize(locator, eip712steth, { value: ether("1.0") }); | |||
} | |||
|
|||
return { lido, dao, acl }; | |||
const locator = await lido.getLidoLocator(); |
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.
Looks like these lines add accounting deployment to the dozen of different test suites. Do we really need it this way? It will slow down all the test pipeline. Maybe, we need a separate function for it?
@@ -125,14 +125,6 @@ contract OracleReportSanityCheckerStub { | |||
uint256 _reportTimestamp | |||
) external view {} | |||
|
|||
function checkSimulatedShareRate( |
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.
Seems like this contract is not used at all and may be deleted safely. Probably, even the whole file.
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.
Almost ready to merge
|
||
let elRewardsVault: LidoExecutionLayerRewardsVault__MockForLidoAccounting; | ||
let withdrawalVault: WithdrawalVault__MockForLidoAccounting; | ||
let stakingRouter: StakingRouter__MockForLidoAccounting; | ||
let oracleReportSanityChecker: OracleReportSanityChecker__MockForAccounting; |
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.
Lido don't use sanity checker anymore, so we can skip this part of initialization.
|
||
let lido: Lido; | ||
let acl: ACL; | ||
// let locator: LidoLocator; | ||
let postTokenRebaseReceiver: IPostTokenRebaseReceiver; |
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.
Lido don't use postTokenRebaseReceiver too, so we can skip it.
let locator: LidoLocator; | ||
|
||
let lido: Lido__MockForAccounting; | ||
let elRewardsVault: LidoExecutionLayerRewardsVault__MockForLidoAccounting; |
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.
We can remove excess dependencies if testing only Accounting: elRewardsVault and withdrawalVault
it("Reverts if the `checkAccountingOracleReport` sanity check fails", async () => { | ||
await oracleReportSanityChecker.mock__checkAccountingOracleReportReverts(true); | ||
|
||
await expect(accounting.handleOracleReport(report())).to.be.reverted; |
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.
Need to check the exact reason
withdrawalFinalizationBatches: [1n], | ||
}), | ||
), | ||
).to.be.reverted; |
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.
Need to check the reason
|
||
/// NOTE: This test is not applicable to the current implementation (Accounting's _checkAccountingOracleReport() checks for checkWithdrawalQueueOracleReport() | ||
/// explicitly in case _report.withdrawalFinalizationBatches.length > 0 | ||
// it("Does not revert if the `checkWithdrawalQueueOracleReport` sanity check fails but `withdrawalQueue` is paused", async () => { |
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.
It maybe a bug in a new Accounting, BTW. Need to check.
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.
Could be. Previous implementation have explicit check for pause state
core/contracts/0.4.24/Lido.sol
Line 879 in 901c0e1
if (!withdrawalQueue.isPaused()) { |
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.
}), | ||
), | ||
) | ||
.and.to.emit(lido, "TransferShares") |
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.
Looks like formatter troubles
Fix accounting tests for vaults