Skip to content

feat(chainstate): Add indexer types#2492

Open
iquidus wants to merge 3 commits intoindexerfrom
indexer-types
Open

feat(chainstate): Add indexer types#2492
iquidus wants to merge 3 commits intoindexerfrom
indexer-types

Conversation

@iquidus
Copy link
Contributor

@iquidus iquidus commented Feb 6, 2026

Add types for the chainstate indexer

Note: This is the second PR in a series of PRs for the chainsate indexer

Add types for the chainstate indexer
@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 32.99%. Comparing base (965d2b7) to head (d187490).

❗ There is a different number of reports uploaded between BASE (965d2b7) and HEAD (d187490). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (965d2b7) HEAD (d187490)
unit-tests 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##           indexer    #2492      +/-   ##
===========================================
- Coverage    39.25%   32.99%   -6.27%     
===========================================
  Files          537       47     -490     
  Lines        49071     5940   -43131     
===========================================
- Hits         19264     1960   -17304     
+ Misses       27367     3592   -23775     
+ Partials      2440      388    -2052     
Flag Coverage Δ
litt-tests 32.99% <ø> (ø)
unit-tests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds foundational Go types for the new chainstate indexer so future PRs can implement indexing, persistence, and query APIs on a shared model.

Changes:

  • Introduces Operator, QuorumAPK, OperatorSocketUpdate, and OperatorEjection data models.
  • Adds query filter structs (OperatorFilter, QuorumAPKFilter) for selecting indexed data.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// Operator represents an EigenDA operator with their registration information.
type Operator struct {
// Unique operator identifier
ID core.OperatorID
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

In Operator, the identifier field is named ID, while the other chainstate types in this file use the more explicit OperatorID naming. For consistency and clarity (especially when these types are consumed across packages), consider renaming ID to OperatorID.

Suggested change
ID core.OperatorID
OperatorID core.OperatorID

Copilot uses AI. Check for mistakes.
// Transaction hash of the ejection
TxHash common.Hash

// Timestamp when this was recorded
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

OperatorEjection uses the field name EjectedAt but the preceding comment says "Timestamp when this was recorded" (which matches the UpdatedAt convention used in other structs here). Either rename the field to UpdatedAt for consistency, or update the comment to reflect that this is the ejection/event timestamp rather than a record update timestamp.

Suggested change
// Timestamp when this was recorded
// Timestamp when the ejection occurred

Copilot uses AI. Check for mistakes.
Comment on lines +104 to +110
type OperatorFilter struct {
// Only return registered operators
RegisteredOnly bool

// Only return deregistered operators
DeregisteredOnly bool

Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

OperatorFilter can represent contradictory states when both RegisteredOnly and DeregisteredOnly are true, and it’s unclear how callers/implementations should resolve that. Consider replacing these two booleans with a single status field (e.g., an enum) or documenting/encoding a clear precedence/validation rule.

Copilot uses AI. Check for mistakes.
Comment on lines +126 to +133
// Block number for the snapshot (0 for latest)
BlockNumber uint64

// Get all snapshots after this block (inclusive)
MinBlock uint64

// Get all snapshots before this block (inclusive, 0 for no limit)
MaxBlock uint64
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

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

QuorumAPKFilter mixes an exact BlockNumber selector (with the special value 0 meaning “latest”) with range fields (MinBlock/MaxBlock). This makes the filter semantics ambiguous when multiple fields are set. Consider splitting into separate filter types (exact vs range), or making the mutually exclusive fields pointers and enforcing/validating exclusivity.

Suggested change
// Block number for the snapshot (0 for latest)
BlockNumber uint64
// Get all snapshots after this block (inclusive)
MinBlock uint64
// Get all snapshots before this block (inclusive, 0 for no limit)
MaxBlock uint64
// Optional exact block number for the snapshot.
// If set and the pointed-to value is 0, this denotes the latest snapshot.
// When BlockNumber is non-nil, MinBlock and MaxBlock should be nil.
BlockNumber *uint64
// Optional lower bound for block number (inclusive).
// When specifying a range, set MinBlock and/or MaxBlock and leave BlockNumber nil.
MinBlock *uint64
// Optional upper bound for block number (inclusive).
// A nil MaxBlock denotes no upper limit.
MaxBlock *uint64

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@dmanc dmanc left a comment

Choose a reason for hiding this comment

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

Looks good, the copilot comments seem worth addressing though.

}

// QuorumAPKFilter is used to filter quorum APK snapshots when querying.
type QuorumAPKFilter struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

out of curiosity - how long does data need to obtained for successful protocol retrievals? if we're eg storing quourm APK updates since genesis but only querying the last 2 weeks worth then it may be beneficial to introduce some state pruning wrt to the blob TTL. (analogous to how a validator prunes its blob database for expired blobs)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Making a note to look into state pruning later. Will be simple enough to add.

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.

4 participants