-
Notifications
You must be signed in to change notification settings - Fork 3
chore: add rewards v2.2 comprehensive unit/integration/Anvil tests #490
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
2701725 to
9401b5f
Compare
cefb196 to
1f2fde9
Compare
pkg/rewards/stakerShareSnapshots.go
Outdated
| INNER JOIN blocks b_queued ON qsw.block_number = b_queued.number | ||
| WHERE | ||
| -- Still within withdrawal queue window (not yet completable) | ||
| b_queued.block_time + INTERVAL '{{.withdrawalQueueWindow}} days' > TIMESTAMP '{{.snapshotDate}}' |
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.
is the source of the .withdrawalQueueWindow from event emission ?
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.
The withdrawalQueueWindow is a configuration value (r.globalConfig.Rewards.WithdrawalQueueWindow), not from event emission. It's set to 14 days for mainnet.
5751bbc to
5395626
Compare
5395626 to
ab00045
Compare
7694397 to
8c9826c
Compare
f9fccf7 to
ee10653
Compare
ebc358e to
03175c7
Compare
pkg/eigenState/precommitProcessors/slashingProcessor/createSlashingAdjustments_test.go
Show resolved
Hide resolved
pkg/eigenState/precommitProcessors/slashingProcessor/slashing.go
Outdated
Show resolved
Hide resolved
pkg/eigenState/precommitProcessors/slashingProcessor/createSlashingAdjustments_test.go
Show resolved
Hide resolved
fdfb4ce to
8c6c1eb
Compare
pkg/eigenState/precommitProcessors/slashingProcessor/slashing_test.go
Outdated
Show resolved
Hide resolved
pkg/eigenState/precommitProcessors/slashingProcessor/slashing_test.go
Outdated
Show resolved
Hide resolved
pkg/eigenState/precommitProcessors/slashingProcessor/slashing.go
Outdated
Show resolved
Hide resolved
| ) * (1 - LEAST(@wadSlashed / 1e18, 1)) as slash_multiplier, | ||
| @blockNumber as block_number, | ||
| @transactionHash as transaction_hash, | ||
| @logIndex as log_index |
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.
Since this query is selecting from queued_slashing_withdrawal table, which hasn't been committed yet (ie. latest block not updated), could we have a staleness issue? Edge case: a withdrawal has been queued in this block and then we are slashed a couple times in the same block. Do we need to add accumulated withdrawals in the given block? cc @elhajin
Slashes on day X now correctly become visible for snapshots on day X+1, matching the spec rule: block_date < snapshot_date
8c6c1eb to
9aab10c
Compare
Description
Summary
Adds comprehensive unit, integration, and Anvil tests for Rewards v2.2 (PRs #476, #481), validating operator allocation snapshots, withdrawal queue logic, and refund calculations. All tests passing with 100% coverage of edge cases defined in the Rewards V2.2 Testing Plan.
Test Coverage
OAS (Operator Allocation Snapshots) - 17 scenarios:
SSS (Staker Share Snapshots) - 15 scenarios:
R (Refunds) - 4 scenarios:
Integration Tests (8 Scenarios - PostgreSQL):
Anvil Tests (10 Scenarios - Real Contract Events):
Bug Fixes & Improvements
Schema Corrections:
Snapshot Timing Logic:
Linter Fixes:
Chain Configuration:
Notes
Type of change
How Has This Been Tested?
Unit tests
Checklist: