Skip to content

Conversation

@8sunyuan
Copy link
Contributor

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());

@8sunyuan
Copy link
Contributor Author

image
Expected failed test cases from 52c1dfb before the fix is implemented

Copy link
Collaborator

@ypatil12 ypatil12 left a 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
Copy link
Collaborator

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

Choose a reason for hiding this comment

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

Nit: is ordered

Copy link
Contributor

@eigenmikem eigenmikem left a comment

Choose a reason for hiding this comment

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

lgtm

@wadealexc wadealexc force-pushed the fix-pending-diff-bug branch from 22ab594 to 1035d9c Compare January 30, 2025 20:20
@8sunyuan 8sunyuan force-pushed the fix-pending-diff-bug branch from 1035d9c to 04526ba Compare January 30, 2025 21:49
@8sunyuan 8sunyuan merged commit abcde78 into slashing-magnitudes-fixes Jan 30, 2025
11 checks passed
@8sunyuan 8sunyuan deleted the fix-pending-diff-bug branch January 30, 2025 22:09
0xClandestine pushed a commit that referenced this pull request Feb 11, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 19, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
ypatil12 pushed a commit that referenced this pull request Feb 20, 2025
* test: regression tests showing invalid state

* fix: require check and update tests
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.

5 participants