Skip to content

Commit

Permalink
chore: cleanup dead EigenState model code
Browse files Browse the repository at this point in the history
  • Loading branch information
seanmcgary committed Jan 3, 2025
1 parent f90bc85 commit 7be6783
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 70 deletions.
7 changes: 3 additions & 4 deletions pkg/eigenState/avsOperators/avsOperators.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@ type AvsOperatorStateChange struct {
// EigenState model for AVS operators that implements IEigenStateModel.
type AvsOperatorsModel struct {
base.BaseEigenState
StateTransitions types.StateTransitions[AvsOperatorStateChange]
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config

// Keep track of each distinct change, rather than accumulated change, to add to the delta table
stateAccumulator map[uint64][]*AvsOperatorStateChange
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ import (

type DisabledDistributionRootsModel struct {
base.BaseEigenState
StateTransitions types.StateTransitions[types.DisabledDistributionRoot]
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config

// Accumulates state changes for SlotIds, grouped by block number
stateAccumulator map[uint64]map[types.SlotID]*types.DisabledDistributionRoot
Expand Down
33 changes: 3 additions & 30 deletions pkg/eigenState/operatorShares/operatorShares.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"github.com/Layr-Labs/sidecar/pkg/storage"
"github.com/shopspring/decimal"
"math/big"
"slices"
"sort"
"strings"
Expand All @@ -21,31 +20,6 @@ import (
"gorm.io/gorm/clause"
)

// OperatorShares represents the state of an operator's shares in a strategy at a given block number.
type OperatorShares struct {
Operator string
Strategy string
Shares string
BlockNumber uint64
CreatedAt time.Time
}

// AccumulatedStateChange represents the accumulated state change for an operator's shares in a strategy at a given block number.
type AccumulatedStateChange struct {
Operator string
Strategy string
Shares *big.Int
BlockNumber uint64
}

type OperatorSharesDiff struct {
Operator string
Strategy string
Shares *big.Int
BlockNumber uint64
IsNew bool
}

type OperatorShareDeltas struct {
Operator string
Staker string
Expand All @@ -65,10 +39,9 @@ func NewSlotID(operator string, strategy string, staker string, transactionHash
// Implements IEigenStateModel.
type OperatorSharesModel struct {
base.BaseEigenState
StateTransitions types.StateTransitions[AccumulatedStateChange]
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config

stateAccumulator map[uint64][]*OperatorShareDeltas
}
Expand Down
11 changes: 5 additions & 6 deletions pkg/eigenState/rewardSubmissions/rewardSubmissions.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,11 @@ func NewSlotID(transactionHash string, logIndex uint64, rewardHash string, strat

type RewardSubmissionsModel struct {
base.BaseEigenState
StateTransitions types.StateTransitions[[]*RewardSubmission]
DB *gorm.DB
Network config.Network
Environment config.Environment
logger *zap.Logger
globalConfig *config.Config
DB *gorm.DB
Network config.Network
Environment config.Environment
logger *zap.Logger
globalConfig *config.Config

// Accumulates state changes for SlotIds, grouped by block number
stateAccumulator map[uint64]map[types.SlotID]*RewardSubmission
Expand Down
14 changes: 3 additions & 11 deletions pkg/eigenState/stakerDelegations/stakerDelegations.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,13 @@ type StakerDelegationChange struct {

type StakerDelegationsModel struct {
base.BaseEigenState
StateTransitions types.StateTransitions[StakerDelegationChange]
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config

stateAccumulator map[uint64][]*StakerDelegationChange
}

type DelegatedStakersDiff struct {
Staker string
Operator string
Delegated bool
BlockNumber uint64
}

func NewStakerDelegationsModel(
esm *stateManager.EigenStateManager,
grm *gorm.DB,
Expand Down
14 changes: 3 additions & 11 deletions pkg/eigenState/stakerShares/stakerShares.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@ import (
"gorm.io/gorm/clause"
)

type AccumulatedStateChange struct {
Staker string
Strategy string
Shares *big.Int
BlockNumber uint64
}

// Table staker_share_deltas
type StakerShareDeltas struct {
Staker string
Expand All @@ -50,10 +43,9 @@ func NewSlotID(transactionHash string, logIndex uint64, staker string, strategy

type StakerSharesModel struct {
base.BaseEigenState
StateTransitions types.StateTransitions[AccumulatedStateChange]
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config

// Accumulates deltas for each block
stateAccumulator map[uint64][]*StakerShareDeltas
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ import (

type SubmittedDistributionRootsModel struct {
base.BaseEigenState
StateTransitions types.StateTransitions[types.SubmittedDistributionRoot]
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config
DB *gorm.DB
logger *zap.Logger
globalConfig *config.Config

// Accumulates state changes for SlotIds, grouped by block number
stateAccumulator map[uint64]map[types.SlotID]*types.SubmittedDistributionRoot
Expand Down

0 comments on commit 7be6783

Please sign in to comment.