Skip to content

test: rounding tests low slashing factors#1178

Merged
8sunyuan merged 10 commits intotest/slashing-integration-testingfrom
rounding-case-tests
Mar 4, 2025
Merged

test: rounding tests low slashing factors#1178
8sunyuan merged 10 commits intotest/slashing-integration-testingfrom
rounding-case-tests

Conversation

@8sunyuan
Copy link
Copy Markdown
Contributor

@8sunyuan 8sunyuan commented Feb 26, 2025

Motivation:

Testing coverage for rounding edge cases.

Modifications:

Added test file in Register_Allocate_Slash_VerifyWC_.t.sol
The _init setup creates an Operator registered to an OperatorSet who gets slashed down to 1 maxMagnitude.

  • Removed duplicate function assert_Snap_StakeBecomeUnslashable
  • Added setter for BCSF on EPMWrapper
  • Fixed assert_Snap_DSF_State_WithdrawalAsShares() for when fully slashed
  • Fixed assert_Snap_DSF_State_Delegation() to use staker's operator magnitudes instead of staker's magnitude itself
  • Additional checks helpers
  • Added helper getSlashingFactor for User.t.sol

Result:
Integration Tests with 1 operator MaxMagnitude
test_slashBC_startCompleteCP_queue_complete
test_slash_undelegate_redeposit
test_slash_undelegate_completeAsTokens_verifyWC
test_slash_undelegate_completeAsShares_startCompleteCP
test_queueAllShares_completeAsTokens

Integration Tests with 1 BCSF
test_verifyWC_startCompleteCP
test_slashFullyBC_deposit
test_slashAVS_delegate_startCompleteCP

Integration Tests with High DSF and repeat deposits
test_multiple_deposits

@8sunyuan 8sunyuan added 🗡️ Slashing Release Changes for the slashing release. 🧪 Test Test-related changes (unit, integration, etc.). labels Feb 27, 2025
bytes32[] memory withdrawalRoots = _getWithdrawalHashes(withdrawals);
check_Undelegate_State(staker, operator, withdrawals, withdrawalRoots, strategies, initDepositShares, 0.toArrayU256());

// 6. redeposit (start/complete checkpoint)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we be actually depositing another 32 ETH and starting a validator in these steps to check that "redepositing" is working?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point, I personally define redeposit as adding shares so this can be either from verify wc of new validators, completing checkpoints, or completing any queued withdrawals.

I'll update this test to randomly choose between those 2 paths on the EigenPod

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@8sunyuan 8sunyuan force-pushed the rounding-case-tests branch 2 times, most recently from 5ee230a to 63451b2 Compare March 4, 2025 18:01
@8sunyuan 8sunyuan force-pushed the rounding-case-tests branch from 837d3fa to b86b8ab Compare March 4, 2025 21:00
@8sunyuan 8sunyuan merged commit 9a6b8d0 into test/slashing-integration-testing Mar 4, 2025
10 checks passed
@8sunyuan 8sunyuan deleted the rounding-case-tests branch March 4, 2025 22:04
ypatil12 pushed a commit that referenced this pull request Mar 5, 2025
<!-- 
    🚨 ATTENTION! 🚨 
    
This PR template is REQUIRED. PRs not following this format will be
closed without review.
    
    Requirements:
- PR title must follow commit conventions:
https://www.conventionalcommits.org/en/v1.0.0/
- Label your PR with the correct type (e.g., 🐛 Bug, ✨ Enhancement, 🧪
Test, etc.)
    - Provide clear and specific details in each section
-->

**Motivation:**

Testing coverage for rounding edge cases.

**Modifications:**

Added test file in `Register_Allocate_Slash_VerifyWC_.t.sol`
The _init setup creates an Operator registered to an OperatorSet who
gets slashed down to 1 maxMagnitude.

- Removed duplicate function `assert_Snap_StakeBecomeUnslashable`
- Added setter for BCSF on EPMWrapper
- Fixed `assert_Snap_DSF_State_WithdrawalAsShares()` for when fully
slashed
- Fixed `assert_Snap_DSF_State_Delegation()` to use staker's operator
magnitudes instead of staker's magnitude itself
- Additional checks helpers
- Added helper `getSlashingFactor` for User.t.sol

**Result:**
Integration Tests with 1 operator MaxMagnitude
`test_slashBC_startCompleteCP_queue_complete`
`test_slash_undelegate_redeposit`
`test_slash_undelegate_completeAsTokens_verifyWC`
`test_slash_undelegate_completeAsShares_startCompleteCP`
`test_queueAllShares_completeAsTokens`

Integration Tests with 1 BCSF
`test_verifyWC_startCompleteCP`
`test_slashFullyBC_deposit`
`test_slashAVS_delegate_startCompleteCP`

Integration Tests with High DSF and repeat deposits
`test_multiple_deposits`
ypatil12 pushed a commit that referenced this pull request Mar 5, 2025
<!-- 
    🚨 ATTENTION! 🚨 
    
This PR template is REQUIRED. PRs not following this format will be
closed without review.
    
    Requirements:
- PR title must follow commit conventions:
https://www.conventionalcommits.org/en/v1.0.0/
- Label your PR with the correct type (e.g., 🐛 Bug, ✨ Enhancement, 🧪
Test, etc.)
    - Provide clear and specific details in each section
-->

**Motivation:**

Testing coverage for rounding edge cases.

**Modifications:**

Added test file in `Register_Allocate_Slash_VerifyWC_.t.sol`
The _init setup creates an Operator registered to an OperatorSet who
gets slashed down to 1 maxMagnitude.

- Removed duplicate function `assert_Snap_StakeBecomeUnslashable`
- Added setter for BCSF on EPMWrapper
- Fixed `assert_Snap_DSF_State_WithdrawalAsShares()` for when fully
slashed
- Fixed `assert_Snap_DSF_State_Delegation()` to use staker's operator
magnitudes instead of staker's magnitude itself
- Additional checks helpers
- Added helper `getSlashingFactor` for User.t.sol

**Result:**
Integration Tests with 1 operator MaxMagnitude
`test_slashBC_startCompleteCP_queue_complete`
`test_slash_undelegate_redeposit`
`test_slash_undelegate_completeAsTokens_verifyWC`
`test_slash_undelegate_completeAsShares_startCompleteCP`
`test_queueAllShares_completeAsTokens`

Integration Tests with 1 BCSF
`test_verifyWC_startCompleteCP`
`test_slashFullyBC_deposit`
`test_slashAVS_delegate_startCompleteCP`

Integration Tests with High DSF and repeat deposits
`test_multiple_deposits`
ypatil12 added a commit that referenced this pull request Mar 5, 2025
**Motivation:**

Slashing Integration Testing for Competition Audit

**Modifications:**

***General State Validation***
- #1204
- #1198
- #1169
- #1158

***Upgrade Tests***
- #1187
- #1171
- #1143

***Dual Slash Tests***
- #1195
- #1153

***Rounding Tests***
- #1178

***EigenPod Tests***
- #1191
- #1188
- #1203
- #1194
- #1163

***Invariants***
- #1201
- #1176
- #1192
- #1197
- #1175
- #1189
- #1150
- #1149

**Result:**

Comprehensive Test Coverage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🗡️ Slashing Release Changes for the slashing release. 🧪 Test Test-related changes (unit, integration, etc.).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants