lambdaclass / lambdaclass/lambda_ethereum_consensus
Validator pubkeys/indices for duties calculation
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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