Skip to content

Optimize GetBlockAttestations calls #4

@Marketen

Description

@Marketen

Currently, the code fetches attestations per slot inside a nested loop for each validator, meaning that:

  • If we have 100 validators, we have to check attestation duties of all 100 validators in epoch X
  • An attestation can be included up to 32 slots later
  • We could be doing up to 100 × 32 = 3200 separate RPC calls to GetBlockAttestations.

We could, Instead of fetching attestations per slot for each validator:

  • Preload all unique block slots that any of my validators' attestations could be included in.
  • Need to cover the union of all duty.Slot + 1 → duty.Slot + 32 ranges.

Example:
I have 100 validators.

  • One has a duty at slot 1 → needs slots 2–33
  • Another has a duty at slot 31 → needs slots 32–63
  • I need to cover: MIN(duty.Slot) + 1 → MAX(duty.Slot) + 32 (2 through 63 → total of 62 slots)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions