-
Notifications
You must be signed in to change notification settings - Fork 27
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 network withdrawals #262
Conversation
test/dao/network-fee-withdraw.ts
Outdated
const amount = await ssvViews.getNetworkEarnings() / 2; | ||
|
||
await ssvNetworkContract.withdrawNetworkEarnings(amount); | ||
await ssvNetworkContract.withdrawNetworkEarnings(amount); | ||
|
||
await expect(ssvNetworkContract.withdrawNetworkEarnings(amount | ||
)).to.be.revertedWithCustomError(ssvNetworkContract, 'InsufficientBalance'); | ||
}); |
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.
Please for these tests and all other tests where we do any withdraw lets add get assertions.
so in this particular test we do 3 withdrawls and one of them fails
After each one please do a getNetworkBalance and assert the number is correct.
So in this case:
First witdraw should be amount
Second should be 0
Third should be 2 blocks worth of network fees as the getNetworkBalance before the revert + revert took 2 blocks
Same for operator withdraw we should do a getOperatorEarnings and assert the number that its correct.
const amount = await ssvViews.getNetworkEarnings() / 2; | ||
|
||
await ssvNetworkContract.withdrawNetworkEarnings(amount); | ||
expect(await ssvViews.getNetworkEarnings()).to.be.equals(((networkFee * 13) + (networkFee * 11) - 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 the way you assert much more then the way i suggested :)
* Remove registerAuth implementation (#257) * remove registerAuth implementation * remove test * remove all references to registerAuth in tests * remove pending registerAuth * deploy stage-dev 30082023 * deploy stage v1.0.0.rc4 * add bug bounty details in README * Fix network withdrawals (#262) * fix sequential network withdrawals issue * A validator can voluntarily exit (#263) * A validator can voluntarily exit * Update local-dev.md (#260) * Update local-dev.md * Fix Types.shrink() (#265) * fix Types.shrink * v1.0.0.rc5 * goerli_dev deployment * Remove validator gas costs metrics (#266) * holesky dev (#267) * Get Network total validators count (#270) * add SSVViews.getNetworkValidatorsCount() * testnet holesky (#268) * change input modifiers * rename __gap (#269) * OperatorLib gas optimizations (#273) * remove named return params (#272) * add msg.sender to ValidatorExited event (#271) * remove storage checks * add audit reports --------- Co-authored-by: andrew-blox <[email protected]>
Update the DAO index when making a network withdrawal.