Skip to content

feat: implement rewards v2.2 - Operator Set Rewards with Unique & Total Stake#500

Open
serichoi65 wants to merge 40 commits intomasterfrom
release/rewards-v2.2-pt1
Open

feat: implement rewards v2.2 - Operator Set Rewards with Unique & Total Stake#500
serichoi65 wants to merge 40 commits intomasterfrom
release/rewards-v2.2-pt1

Conversation

@serichoi65
Copy link
Contributor

@serichoi65 serichoi65 commented Feb 4, 2026

Description

Implements Rewards v2.2 - Operator Set rewards with automatic stake-weighted distribution for both unique allocated stake and total delegated stake. This brings forward-looking reward capabilities (up to 2 years) to operator sets managed via AllocationManager.

Key tables added:

  • Table 15: Active unique and total stake rewards
  • Table 16-18: Unique stake rewards (operator → staker → AVS refunds)
  • Table 19-21: Total stake rewards (operator → staker → AVS refunds)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Test_RewardsV2_2 passes.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

@serichoi65 serichoi65 requested a review from a team as a code owner February 4, 2026 18:40
@serichoi65 serichoi65 force-pushed the release/rewards-v2.2-pt1 branch from f3e7e0a to 7738212 Compare February 5, 2026 12:48
@serichoi65 serichoi65 changed the title Release/rewards v2.2 pt1 feat: rewards v2.2 pt1 Feb 5, 2026
@serichoi65 serichoi65 force-pushed the release/rewards-v2.2-pt1 branch from 5826de8 to cd3cfee Compare February 5, 2026 17:22
Copy link

@elhajin elhajin left a comment

Choose a reason for hiding this comment

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

what should be addressed :

  • T16 — drop Steps 5-7 (deregistration queue + slash multiplier). The allocation snapshots already handle deallocation delay via effective_block and slashing via live magnitude/shares updates. The queue logic double-counts slashing and the >= join inflates operator weight. Simplifies the query from 8 CTEs to 5. Deregistered-operator rewards can be pt-2.
  • T18/T21 — SUM(tokens_per_day_decimal)MAX. tokens_per_day_decimal is duplicated per strategy; the GROUP BY doesn't include strategy, so SUM inflates total_tokens by N×.
  • T20 — join through Table 15 instead of operator_set_strategy_registration_snapshots. Current join pulls all strategies in the operator set (not just reward submission strategies) and drops multipliers. Should mirror T17's pattern.
  • operatorShareSnapshots.go — remove allocation_adjustments CTE. Dead code (table it reads isn't populated yet), and the SUM(magnitude) across operator sets is semantically invalid.

details in inline comments

@serichoi65 serichoi65 force-pushed the release/rewards-v2.2-pt1 branch from 9929189 to 34ff4a3 Compare February 9, 2026 19:56
@serichoi65 serichoi65 changed the title feat: rewards v2.2 pt1 feat: implement rewards v2.2 - Operator Set Rewards with Unique & Total Stake Feb 9, 2026
allocate unique stake to operator set

add more v2.2 tables

fix function call

clean v2.1

delete unused file

implement total stake rewards
…distribution

Implement support for UniqueStakeRewardsSubmissionCreated and
TotalStakeRewardsSubmissionCreated events with pro-rata distribution
across operators.

Changes:
- Add migration for unique_stake_reward_submissions and
  total_stake_reward_submissions tables
- Create eigenState models for stake-based reward submission events
- Add stake_operator_set_rewards denormalized table
- Rename Tables 15-21 to 16-22 to accommodate new table
- Add Table 15 (ActiveUniqueAndTotalStakeRewards) as source for
  unique/total stake calculations
- Update Tables 16 and 19 to support both OD rewards (per-operator
  amounts) and stake rewards (pro-rata by operator weight)
- Table 17/20: evaluate refunds per operator-set/operator, not per-snapshot
- operatorShareSnapshots: apply allocations to all backfill days, include cutoff snapshot
OD rewards are operator-directed with staker distribution handled by
staker share snapshots. Removes duplicate processing and reward_source
column.
…ng bugs

Based on PR review feedback for rewards v2.2 implementation:

Table 16 (Unique Stake Operator Rewards):
- Remove Steps 5-7 (deregistration queue + slash_multiplier) - snapshots
  already reflect slashing via OperatorSharesDecreased events
- Fix registration join: change >= to = (registration snapshots have one
  row per day)
- Remove slashable_until filter (PT2 scope)

Table 18/21 (AVS Refunds):
- Change SUM(tokens_per_day_decimal) to MAX to prevent inflation by N
  strategies - tokens_per_day_decimal is duplicated per strategy

Table 20 (Total Stake Staker Rewards):
- Fix join pattern: use activeStakeRewardsTable instead of
  operator_set_strategy_registration_snapshots to get correct strategy
  set with multipliers
- Add reward_type = 'total_stake' filter for explicitness

operatorShareSnapshots.go:
- Remove dead allocation_adjustments and combined_snapshots CTEs
  (operator_allocation_snapshots populated after this runs)

operatorAllocationSnapshots.go:
- Simplify ORDER BY to use block_number DESC, log_index DESC
  (block_time is derived from block_number)

Tables 17/19/20:
- Remove unnecessary CAST(shares AS NUMERIC(78,0)) - shares already numeric
@serichoi65 serichoi65 force-pushed the release/rewards-v2.2-pt1 branch from 927f38a to 0e4fd9f Compare February 10, 2026 22:34
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.

2 participants