lambdaclass / lambdaclass/lambda_ethereum_consensus

Validator pubkeys/indices for duties calculation

Open
#1,290 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

perf sync committees validator
Dominant language
Elixir
Stars
109
Forks
41
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating fetch_validator_index and the sync_subcommitte_participants recalculation introduced after #1284. Measure the validator-index lookup cost during duties calculation; done means documenting whether it is a bottleneck and, if so, replacing the repeated linear search with a map-backed lookup.

Written by the indexing model from the issue text.

Assessment

Tech stack
elixir
Domain
distributed-systems, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.