Repository navigation
fix(p2p): drop the subscription count limits, list only digests held from startup on - #969
Conversation
|
/review |
Review notesSame change as #960. This branch's patch is identical to #960 at its head ( The commit added after #960's first review (the fix for the bot's M2, a clock stepped back across a fork boundary leaving the node deaf):
Release-branch fit. All three places that construct The base is green. On Bot findings on #960. M2 is fixed by the commit above. M1 (one 12 MB RPC of unlisted topic names holds the swarm task for about 0.2 s) is accepted and documented in #960; the follow-up is sizing One note, not a blocker. The shared list adds a lock read per topic in CI, as of this comment. Build, Lint, "Test (consensus)", "Test minimal preset" and "Beacon spec tests (minimal)" pass. "Test (node)", "Test (include-ethrex)" and "Beacon spec tests (mainnet)" are still running. "Link Check" failed on seven github.com links that returned 503 during the outage; it needs a re-run. |
AI security review: 3 finding(s) to checkReviewed by Opus, GPT, Kimi, DeepSeek. A judge model checked every one of the findings against the code.
DetailsM1. Backward-clock recovery does not restore existing peers' subscriptions (medium, logic)
M2. Removing per-RPC subscription count lets a peer stall the swarm task with oversized subscription hellos (medium, DoS/resource)
M3. The allowlist may not bound a peer's stored topic set: gossipsub may record topics from GRAFT without checking the subscription filter (medium, DoS/resource)
Cost of this review: ~$2.28 of a $30 budget (estimated from token counts). |
On the AI review's three findingsNo code change from any of them. M1 and M2 are known and accepted, and M3 does not hold for the gossipsub version this branch pins. M1 (after a clock step back, connected peers are not recorded on the re-listed digest)True, and documented where the list is extended (
Accepted as a limit of the recovery, not a regression: the node is no worse off than a node that has just started. M2 (a 12 MB subscription RPC holds the swarm task)The same finding as M1 on #960, answered there: #960 (comment) In short: putting M3 (GRAFT may record topics without going through the filter)Not the case in libp2p-gossipsub 0.50.0, which
The loop the finding describes from memory ("ensure we have recorded the mapping") is not in this version. So the allowlist does bound a peer's stored topic set, as the PR says. |
🗒️ Description / Motivation
Backport of #960 to
release/v2.0.0, forv2.0.0-rc.2(follow-up to #965 / #952).#960 is approved and not merged on
mainyet, so this is taken from its head (fe9525a3) and not from a squash commit onmain. If #960 changes before it merges, this branch has to be refreshed from the new head.What Changed
The three commits of #960 as one commit on top of
release/v2.0.0(ae54a86e): the diff from its branch point onmain(e48246f8) to its head (fe9525a3), applied withgit apply --3way. It applied without conflicts and nothing was edited by hand (samegit patch-id).What it does, from #960:
MaxCountSubscriptionFilterand the per-peer / per-RPC count limits (AllowlistimplementsTopicSubscriptionFilterdirectly). The per-peer limit was the size of the allowlist anyway, and the per-RPC limit made gossipsub refuse oversized RPCs atERRORwith no score penalty or disconnect.Allowlist::beaconat startup to every digest still held at the startup digest's first epoch (ForkSchedule::held_at) and every later scheduled digest, warning and falling back to listing every scheduled digest if the startup digest is not on the schedule.Allowlistbetween gossipsub andP2PServer, and hasbeacon::transition::applylist a digest's topics (Allowlist::list, with a warning) before joining one that is not listed, so a backward clock jump across boundaries never leaves the node deaf.SubscriptionError::NotAllowedon this node's ownsubscribeatERRORinswarm_adapter.Tests Added / Run
On this branch:
cargo fmt --all -- --check,make inert-paths-check, andcargo clippy --locked -p ethlambda-p2p --all-targets -- -D warnings: clean.cargo test --locked -p ethlambda-p2p --lib --profile release-fast: 614 passed, 0 failed, 1 ignored.Not run locally: the rest of
make lintandmake test; CI covers them.Related Issues / PRs
release/v2.0.0: fix(p2p): keep a peer's gossipsub subscriptions only for listed topics, within a count limit #965.