Skip to content

Validator pubkeys/indices for duties calculation #1290

Open
@rodrigo-o

Description

@rodrigo-o

Right now the fetch_validator_index function is doing a linear search of all validators pubkeys every time one index is needed.

  @spec fetch_validator_index(Types.BeaconState.t(), Bls.pubkey()) ::
          non_neg_integer() | nil
  def fetch_validator_index(state, pubkey) do
    Enum.find_index(state.validators, &(&1.pubkey == pubkey))
  end

After #1284 every period we need to recalculate the sync_subcommitte_participants which depends on it, we should measure if this can became a bottleneck or not, and in case it is go with a map instead.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions