Skip to content

Hold a Waggle peer to one aggregate per slot and aggregator - #987

Merged
pablodeymo merged 3 commits into
pq-devnet-2-wagglefrom
waggle-duplicate-aggregate-id
Dec 5, 2026
Merged

pablodeymo merged 3 commits into
pq-devnet-2-wagglefrom
waggle-duplicate-aggregate-id

Conversation

@pablodeymo

@pablodeymo pablodeymo commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

What

EIP-8529's draft gained a validation rule on 04.12 (ethereum/EIPs#12792, commit b541c27f85):

[REJECT] No other AggregateID with the same slot and aggregator_index has been received from the sender. The node has received such an AggregateID when a previous message carrying it passed the checks above.

This implements it in the Waggle dissemination service, in both directions.

Receiving. The service remembers the first aggregate each peer sent a message about, per slot and aggregator. A message from that peer about another one is dropped, before the header of another aggregate we may hold is looked at, as the EIP orders the checks. The record is kept by peer, not by connection, so reconnecting does not reset it, and is dropped with the slot's tracking window.

Sending. Once the node holds the header of an aggregate (a peer's header passed, or it publishes its own), it sends nothing about that aggregate to the peers that sent it another one of the slot and aggregator. It may have requested chunks of theirs from them, and they would drop and penalize the second ID. Those peers have no use for it: a peer only sends messages about an aggregate it holds the header of, or to peers that announced it. A published aggregate is now held before it is pushed, for the same reason.

bound_headerless_aggregates is removed: it let a peer count for the aggregate it named last, and a peer can no longer name a second one.

Penalty

Each such message is dropped and its sender penalized (MidTolerance, waggle_second_aggregate_id), as the EIP's [REJECT] says, and counted in lean_beacon_aggregate_dissemination_second_ids_rejected_total. A node on an earlier draft breaks the rule when an aggregator signs two headers (it requests the one a peer announced, then announces the other to every peer), so such nodes are penalized by this one in that case.

Tests

  • a_peer_sends_one_aggregate_per_slot_and_aggregator: second IDs are dropped with their chunk and header, the peer is penalized for each, other peers and other aggregators are unaffected, reconnecting does not reset the record, and the record goes with the tracking window.
  • a_peer_is_sent_one_aggregate_per_slot_and_aggregator and a_published_aggregate_is_not_sent_to_a_peer_that_named_another: the send side.
  • one_header_is_held_per_slot_and_aggregator: a peer whose first message is dropped because another header is held is still held to that ID.

Each of the three new tests fails when its half of the change is disabled. cargo test -p ethlambda-p2p -p ethlambda-telemetry, cargo fmt --check and make lint pass. Not run on a devnet.

Review follow-up

The AI security review found two gaps, both closed in the last commit:

  • A peer whose first message of a slot and aggregator names another aggregate after the node holds a header was recorded but still sent the held aggregate. It is now kept out of it from that message on.
  • A message of a peer's previous connection, delivered after the node heard of the new one, was dropped before its ID was recorded, so the peer could name another aggregate on the new connection. The message is still ignored, but its ID is recorded (and a second one penalized) like any other.

The same commit fixes the docs build, which failed on _[REJECT]_ in docs/beacon_pq.md.

EIP-8529's draft added a rule (b541c27f85): a message naming a second
AggregateID with the slot and aggregator of one the sender already sent
is dropped, and its sender penalized.

The service now remembers the first aggregate each peer sent a message
about, per slot and aggregator, by peer rather than by connection and
for as long as the slot is tracked. A message of that peer about another
one is dropped before the header of another aggregate we may hold is
looked at, as the EIP orders it. The peer is penalized for the first
such message only (waggle_second_aggregate_id): a peer on an earlier
draft breaks the rule in every announcement when an aggregator signed
two headers.

The node keeps to the rule itself. Once it holds the header of an
aggregate, by a peer's header passing or by publishing its own, it sends
nothing about it to the peers that sent it another aggregate of the slot
and aggregator: it may have requested chunks of theirs from them. A
published aggregate is now held before it is pushed, for that reason.

The rule replaces bound_headerless_aggregates, which let a peer count
for the aggregate it named last: a peer can no longer name a second one.
The sender of a second AggregateID for a slot and aggregator was
penalized for the first such message only. The EIP's REJECT penalizes
the sender of each, so each is penalized now.
@pablodeymo

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

AI security review: 1 finding(s) to check

Reviewed by GPT, Kimi, DeepSeek. A judge model checked every one of the findings against the code.
GLM (error, see the run log), Opus (error, see the run log) did not finish; GPT, Kimi, DeepSeek reviewed the whole PR. Comment /review continue to retry, with a new budget; reviewers that finished are reused.

# Finding Severity Status Found by Where
M1 A peer that first names the other aggregate after a header is already held still receives the held aggregate later low Bug DeepSeek, Kimi (2/3) crates/net/p2p/src/beacon/waggle_aggregates.rs:1366
Details

M1. A peer that first names the other aggregate after a header is already held still receives the held aggregate later (low, logic)

  • Trigger: A Waggle peer sends its first message about aggregate B for a slot/aggregator after this node already holds header A for the same slot/aggregator. Later, A has new chunks or announcements to flush (or the peer reconnects and try_inform_new_peer runs).
  • Mechanism: handle_message first calls note_received_id, which stores peer_id -> B in received_ids, then enters this OtherHeld branch and returns without marking that peer banned on the already-held A aggregate. on_header_held(A) has already run and does not run again, so the new received_ids entry is never propagated into A's AggregatePeer. The send paths only check AggregatePeer.banned in push_chunks, announce_to, and request_missing_chunks, so they do not consult received_ids and can later queue/send A to that peer.
  • Impact: The node violates the new EIP send-side rule by sending the held aggregate to a peer that already named another aggregate for that slot/aggregator. The peer can drop and penalize each such message, causing Waggle peer scoring/disconnection despite the PR's intended suppression.
  • Judge: The late-ID suppression gap is confirmed: the first B message records the peer's ID and returns through OtherHeld without banning it on held aggregate A. Suppression is populated only when on_header_held runs, so a later reconnect or announcement can send A to that peer. This violates the new suppression guarantee and wastes traffic. Automatic penalties/disconnection are not established: the recei

Cost of this review: ~$0.84 of a $30 budget (estimated from token counts).

…uild

Both are from the AI security review of this pull request.

A peer whose first message of a slot and aggregator named another
aggregate after we held a header was recorded but not kept out of the
aggregate we hold: only on_header_held marked such peers, and it had
already run. note_received_id now marks the peer too, so it is sent
nothing more about the held aggregate.

A message of a peer's previous connection that was delivered after we
heard of its new one was dropped before its ID was recorded, so the peer
could name another aggregate on the new connection. The message is
still ignored, but its ID is received like any other.

The docs build failed on `_[REJECT]_`, which the link checker reads as
a link without a target.
@pablodeymo

Copy link
Copy Markdown
Collaborator Author

/review

@github-actions

github-actions Bot commented Dec 5, 2026

Copy link
Copy Markdown

AI security review: 0 finding(s) to check

Reviewed by GPT, Kimi, DeepSeek.
GLM (error, see the run log), Opus (error, see the run log) did not finish; GPT, Kimi, DeepSeek reviewed the whole PR. Comment /review continue to retry, with a new budget; reviewers that finished are reused.

No findings to check.

Cost of this review: ~$0.66 of a $30 budget (estimated from token counts).

@pablodeymo
pablodeymo merged commit f5091b2 into pq-devnet-2-waggle Dec 5, 2026
14 checks passed
@pablodeymo
pablodeymo deleted the waggle-duplicate-aggregate-id branch December 5, 2026 01:20
pablodeymo added a commit that referenced this pull request Dec 5, 2026
…-and-pull) (#988)

The same commit as #987, cherry-picked onto the announce-and-pull
branch. The two branches differ only in `PUSH_PHASE` / `REQUEST_DELAY`
and one `CLAUDE.md` sentence, and the diff between the two PR heads is
exactly that. Tests were run again on this branch with its constants.

## What

EIP-8529's draft gained a validation rule on 04.12 (ethereum/EIPs#12792,
commit `b541c27f85`):

> _[REJECT]_ No other `AggregateID` with the same `slot` and
`aggregator_index` has been received from the sender. The node has
received such an `AggregateID` when a previous message carrying it
passed the checks above.

This implements it in the Waggle dissemination service, in both
directions.

**Receiving.** The service remembers the first aggregate each peer sent
a message about, per slot and aggregator. A message from that peer about
another one is dropped, before the header of another aggregate we may
hold is looked at, as the EIP orders the checks. The record is kept by
peer, not by connection, so reconnecting does not reset it, and is
dropped with the slot's tracking window.

**Sending.** Once the node holds the header of an aggregate (a peer's
header passed, or it publishes its own), it sends nothing about that
aggregate to the peers that sent it another one of the slot and
aggregator. It may have requested chunks of theirs from them, and they
would drop and penalize the second ID. Those peers have no use for it: a
peer only sends messages about an aggregate it holds the header of, or
to peers that announced it. A published aggregate is now held before it
is pushed, for the same reason.

`bound_headerless_aggregates` is removed: it let a peer count for the
aggregate it named last, and a peer can no longer name a second one.

## Penalty

Each such message is dropped and its sender penalized (`MidTolerance`,
`waggle_second_aggregate_id`), as the EIP's _[REJECT]_ says, and counted
in `lean_beacon_aggregate_dissemination_second_ids_rejected_total`. A
node on an earlier draft breaks the rule when an aggregator signs two
headers (it requests the one a peer announced, then announces the other
to every peer), so such nodes are penalized by this one in that case.

## Tests

- `a_peer_sends_one_aggregate_per_slot_and_aggregator`: second IDs are
dropped with their chunk and header, the peer is penalized for each,
other peers and other aggregators are unaffected, reconnecting does not
reset the record, and the record goes with the tracking window.
- `a_peer_is_sent_one_aggregate_per_slot_and_aggregator` and
`a_published_aggregate_is_not_sent_to_a_peer_that_named_another`: the
send side.
- `one_header_is_held_per_slot_and_aggregator`: a peer whose first
message is dropped because another header is held is still held to that
ID.

Each of the three new tests fails when its half of the change is
disabled. `cargo test -p ethlambda-p2p -p ethlambda-telemetry`, `cargo
fmt --check` and `make lint` pass. Not run on a devnet.


## Review follow-up

The AI security review found two gaps, both closed in the last commit:

- A peer whose first message of a slot and aggregator names another
aggregate *after* the node holds a header was recorded but still sent
the held aggregate. It is now kept out of it from that message on.
- A message of a peer's previous connection, delivered after the node
heard of the new one, was dropped before its ID was recorded, so the
peer could name another aggregate on the new connection. The message is
still ignored, but its ID is recorded (and a second one penalized) like
any other.

The same commit fixes the docs build, which failed on `_[REJECT]_` in
`docs/beacon_pq.md`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant