lambdaclass / lambdaclass/lambda_ethereum_consensus
Disallow blocks coming in gossip that have a slot in the future
Nobody has claimed this yet.
- Dominant language
- Elixir
- Stars
- 109
- Forks
- 41
- PR merge metrics
- No merged PRs in 30d
Description
Currently we accept blocks that are newer than this formula: https://github.com/lambdaclass/lambda_ethereum_consensus/blob/main/lib/lambda_ethereum_consensus/p2p/gossip/handler.ex#L16
We should also discard blocks that are from the future. But we have to be careful, because there might be some clock mismatch and we might be discarting blocks from the present. This might happen if we are at the end of a slot.
Lighthouse solves this by getting a "present slot with tolerance", which means that it adds 500 ms to the current clock and calculates the corresponding slot. If the gossip block is higher than that block, it is discarted. See:
https://github.com/sigp/lighthouse/blob/1e9925435ec236a6dffe5fe3829d1e502de3c127/beacon_node/beacon_chain/src/block_verification.rs#L731-L740
Acceptance criteria:
- We want to discard blocks from gossip that are more in the future compared to the current slot. We might want to add some kind of "tolerance" similar to lighthouse.
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 in lib/lambda_ethereum_consensus/p2p/gossip/handler.ex at the formula linked in the issue, then compare the Lighthouse block-verification reference for its present-slot tolerance. Trace how gossip blocks expose their slot and how the current slot is calculated. Done means future gossip blocks are discarded while the agreed clock tolerance avoids rejecting blocks near the slot boundary.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- distributed-systems, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100