-
Notifications
You must be signed in to change notification settings - Fork 457
test: redistribution integration #1415
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
Merged
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a623a28
fix: use `tryGet` in view methods to avoid reverts
0xClandestine ed63e00
test: wip
0xClandestine 79c08ed
test: passing
0xClandestine 77f0541
test: add `assert_Snap_SlashEscrowCreated`
0xClandestine affd4b9
working?
0xClandestine c1bb4b3
chore: make fmt
0xClandestine 6b5eeae
test: more checks + tests
0xClandestine 4260398
test: more coverage
0xClandestine fff2c1e
test: remaining case
0xClandestine 140149b
refactor: review changes
0xClandestine e3c4d4e
test: add testFuzz_fullSlash_releaseByStrategy
0xClandestine 64443eb
test: burn path
0xClandestine 684642f
test: check getBurnOrRedistributableShares
0xClandestine d03c621
doc: update natspec
0xClandestine c1f01ce
chore: verbose foundry ci output
0xClandestine 3fc0be4
fix: ci
0xClandestine ec8e5e1
fix: flakey test
0xClandestine 5784120
doc: note todo
0xClandestine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1052,7 +1052,9 @@ contract IntegrationCheckUtils is IntegrationBase { | |
| * ALM - SLASHING | ||
| * | ||
| */ | ||
| function check_Base_Slashing_State(User operator, AllocateParams memory allocateParams, SlashingParams memory slashParams) internal { | ||
| function check_Base_Slashing_State(User operator, AllocateParams memory allocateParams, SlashingParams memory slashParams, uint slashId) | ||
| internal | ||
| { | ||
| OperatorSet memory operatorSet = allocateParams.operatorSet; | ||
|
|
||
| check_MaxMag_Invariants(operator); | ||
|
|
@@ -1065,7 +1067,7 @@ contract IntegrationCheckUtils is IntegrationBase { | |
| assert_Snap_Slashed_SlashableStake(operator, operatorSet, slashParams, "slash should lower slashable stake"); | ||
| assert_Snap_Slashed_OperatorShares(operator, slashParams, "slash should remove operator shares"); | ||
| assert_Snap_Slashed_Allocation(operator, operatorSet, slashParams, "slash should reduce current magnitude"); | ||
| // assert_Snap_Increased_BurnableShares(operatorSet, operator, slashParams, "slash should increase burnable shares"); | ||
| assert_Snap_Increased_BurnableShares(operatorSet, operator, slashParams, slashId, "slash should increase burnable shares"); | ||
|
|
||
| // Slashing SHOULD NOT change allocatable magnitude, registration, and slashability status | ||
| assert_Snap_Unchanged_AllocatableMagnitude(operator, allStrats, "slashing should not change allocatable magnitude"); | ||
|
|
@@ -1079,22 +1081,55 @@ contract IntegrationCheckUtils is IntegrationBase { | |
| User operator, | ||
| AllocateParams memory allocateParams, | ||
| SlashingParams memory slashParams, | ||
| Withdrawal[] memory withdrawals | ||
| Withdrawal[] memory withdrawals, | ||
| uint slashId | ||
| ) internal { | ||
| check_Base_Slashing_State(operator, allocateParams, slashParams); | ||
| check_Base_Slashing_State(operator, allocateParams, slashParams, slashId); | ||
| assert_Snap_Decreased_SlashableSharesInQueue(operator, slashParams, withdrawals, "slash should decrease slashable shares in queue"); | ||
| } | ||
|
|
||
| /// Slashing invariants when the operator has been fully slashed for every strategy in the operator set | ||
| function check_FullySlashed_State(User operator, AllocateParams memory allocateParams, SlashingParams memory slashParams) internal { | ||
| check_Base_Slashing_State(operator, allocateParams, slashParams); | ||
| function check_FullySlashed_State(User operator, AllocateParams memory allocateParams, SlashingParams memory slashParams, uint slashId) | ||
| internal | ||
| { | ||
| check_Base_Slashing_State(operator, allocateParams, slashParams, slashId); | ||
|
|
||
| assert_Snap_Removed_AllocatedSet(operator, allocateParams.operatorSet, "should not have updated allocated sets"); | ||
| assert_Snap_Removed_AllocatedStrats( | ||
| operator, allocateParams.operatorSet, slashParams.strategies, "should not have updated allocated strategies" | ||
| ); | ||
| } | ||
|
|
||
| function check_releaseSlashEscrow_State( | ||
| OperatorSet memory operatorSet, | ||
| uint slashId, | ||
| IStrategy[] memory strategies, | ||
| uint[] memory initTokenBalances, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: naming, not init token balances |
||
| address redistributionRecipient | ||
| ) internal { | ||
| assert_HasUnderlyingTokenBalances( | ||
| User(payable(redistributionRecipient)), | ||
| strategies, | ||
| initTokenBalances, | ||
| "redistribution recipient should have underlying token balances" | ||
| ); | ||
|
|
||
| assertFalse(_getIsPendingSlashId(operatorSet, slashId), "slash id should not be pending"); | ||
| assertEq(_getEscrowStartBlock(operatorSet, slashId), 0, "escrow start block should be deleted after"); | ||
| assertTrue(_getIsDeployedSlashEscrow(operatorSet, slashId), "escrow should be deployed after"); | ||
| } | ||
|
|
||
| function check_releaseSlashEscrow_State_NoneRemaining( | ||
| OperatorSet memory operatorSet, | ||
| uint slashId, | ||
| IStrategy[] memory strategies, | ||
| uint[] memory initTokenBalances, | ||
| address redistributionRecipient | ||
| ) internal { | ||
| check_releaseSlashEscrow_State(operatorSet, slashId, strategies, initTokenBalances, redistributionRecipient); | ||
| assertFalse(_getIsPendingOperatorSet(operatorSet), "operator set should not be pending"); | ||
| } | ||
|
|
||
| /** | ||
| * | ||
| * DUAL SLASHING CHECKS | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
There was a small bug present with the
getBurnOrRedistributableSharesgetters.EnumerableMap.get()reverts if a key does not exist.