-
Notifications
You must be signed in to change notification settings - Fork 462
fix: overwriting existing pending modifications #1052
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
Conversation
|
|
ypatil12
left a comment
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.
LGTM, had a test question
| cheats.expectRevert(ModificationAlreadyPending.selector); | ||
| allocationManager.modifyAllocations(defaultOperator, newAllocateParams1); | ||
|
|
||
| // Assert that the deallocationQueue is unordered for the 2 deallocations in queue |
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.
Nit: is ordered
| * | ||
| * This test checks that the deallocationQueue is ascending ordered by effectBlocks | ||
| * In this case the new modifyAllocations call is an allocation | ||
| * where the effectBlock is increased and the deallocationQueue is unordered as well because the operator |
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.
Nit: is ordered
eigenmikem
left a comment
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.
lgtm
22ab594 to
1035d9c
Compare
1035d9c to
04526ba
Compare
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests
* test: regression tests showing invalid state * fix: require check and update tests

As a result of an existing deallocation being slashed such that its pendingDiff becomes an amount 0, it is possible
to call modifyAllocations and create a new allocation/deallocation overwriting the old deallocation in storage.
This could result in the deallocationQueue no longer being in ascending order by the deallocation's respective effectBlocks.
This prevents this edge case altogether by simply changing the check to use the effectBlock instead
require(allocation.effectBlock == 0, ModificationAlreadyPending());