Beacon API: cap the slot a beacon_committee_subscriptions entry joins a subnet until

Open
#814 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust

Research direction

Start with post_committee_subscriptions in crates/net/rpc/src/beacon/validator.rs and compare its slot handling with post_sync_committee_subscriptions in crates/net/rpc/src/beacon/sync_committee.rs. Read the referenced sync clamp test, then check the aggregator subnet join and expiry paths in crates/net/p2p/src/gossipsub/handler.rs. Done means future slots are capped or rejected at the stated epoch bound, the behavior is tested, and the outdated clause is removed from docs/rpc.md.

Written by the indexing model from the issue text.

Description

Problem. POST /eth/v1/validator/beacon_committee_subscriptions lets the caller choose how long the node stays on an attestation subnet, with no upper bound.

  • post_committee_subscriptions (crates/net/rpc/src/beacon/validator.rs:307-331) passes each aggregator entry's slot through as sent.
  • join_aggregator_subnets (crates/net/p2p/src/gossipsub/handler.rs:1156-1186) keeps the largest slot it has seen for a subnet.
  • leave_expired_aggregator_subnets (handler.rs:1251-1264) leaves the subnet only once that slot has passed.

So one request with is_aggregator: true and a far-future slot keeps the node subscribed until restart. That costs it bandwidth and gossip validation on that subnet. With 64 entries, one per subnet, it holds every attestation subnet. The sync committee endpoint does not have this gap: post_sync_committee_subscriptions clamps until_epoch to the end of the next sync committee period (crates/net/rpc/src/beacon/sync_committee.rs:320-338).

Why it is out of scope. lambdaclass/ethlambda#778 is docs-only. It documents the gap in docs/rpc.md's "What the servers trust" ("an attestation subnet's is not capped") and does not change it.

Fix. Clamp, or refuse with a 400, any slot past the last slot of the furthest epoch attester duties are served for. That epoch is epoch_upper_bound, the wall-clock or head epoch plus one (validator.rs:422-425, enforced by attester_duties at validator.rs:688). A validator client cannot hold a legitimate duty beyond it.

  • Model the change and its test on the sync clamp (subscriptions_group_by_subnet_keep_the_latest_epoch_and_clamp_it, sync_committee.rs:872).
  • Then drop the "not capped" clause from docs/rpc.md.
Dominant language
Rust
Stars
86
Forks
34
Avg merge
9d 20h
Merged PRs (30d)
77

Getting set up

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.

More from lambdaclass/ethlambda

All issues in lambdaclass/ethlambda

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.