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

Fix network withdrawals #262

Merged
merged 2 commits into from
Sep 29, 2023
Merged

Fix network withdrawals #262

merged 2 commits into from
Sep 29, 2023

Conversation

mtabasco
Copy link
Collaborator

Update the DAO index when making a network withdrawal.

@mtabasco mtabasco changed the base branch from main to jato-v2 September 19, 2023 08:49
Comment on lines 73 to 80
const amount = await ssvViews.getNetworkEarnings() / 2;

await ssvNetworkContract.withdrawNetworkEarnings(amount);
await ssvNetworkContract.withdrawNetworkEarnings(amount);

await expect(ssvNetworkContract.withdrawNetworkEarnings(amount
)).to.be.revertedWithCustomError(ssvNetworkContract, 'InsufficientBalance');
});
Copy link
Collaborator

@andrew-blox andrew-blox Sep 19, 2023

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));
Copy link
Collaborator

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 :)

@mtabasco mtabasco merged commit a0c2914 into jato-v2 Sep 29, 2023
4 checks passed
@mtabasco mtabasco deleted the fix-network-withdrawals branch September 29, 2023 09:02
liorrutenberg pushed a commit that referenced this pull request Nov 8, 2023
* 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants