Skip to content

[r3.5] cl: seed the ENR custody group count instead of an empty entry - #23592

Merged
lystopad merged 1 commit into
release/3.5from
feature/lystopad/cp-23560-to-3.5
Aug 27, 2026
Merged

[r3.5] cl: seed the ENR custody group count instead of an empty entry#23592
lystopad merged 1 commit into
release/3.5from
feature/lystopad/cp-23560-to-3.5

Conversation

@lystopad

Copy link
Copy Markdown
Member

Cherry-pick of #23560 to release/3.5.

Clean pick: the same five files, same diffstat, no branch-specific adaptations.

`setupENR` wrote the `cgc` entry as an empty byte slice:

```go
// cl/p2p/p2p.go
node.Set(enr.WithEntry(p.cfg.NetworkConfig.CgcKey, []byte{}))
```

Empty is the canonical encoding of zero, so a node advertised custody of
no groups.
Nothing corrected it: the only path that rewrites the entry is
`SetCustodyGroupCount`, gated on the count rising above `advertisedCgc`,
which
starts at `CustodyRequirement` — so on a node without attached
validators it never
fires. `p2p-interface.md` notes clients MAY reject a peer advertising
below
`CUSTODY_REQUIREMENT`, so the entry was not merely uninformative.

## Change

Seed the entry with the value `advertisedCgc` already starts at, via a
shared
`EncodeCgc` so the seed and the update path cannot drift on format.

Encoding is unchanged — `big.Int.Bytes()`, big endian with no leading
zero bytes,
zero as the empty string, per `fulu/p2p-interface.md`. The increase-only
gate is
unchanged: `fulu/validator.md` requires a node whose custody requirement
falls to
keep advertising the previous (highest) count, which is what it
implements. Both
are now covered by tests and a comment so neither gets "corrected"
later.

Verified on a gnosis archive node: `cgc` decoded to `0x` before and
`0x04` after.

## Scope

Present on `main`, `release/3.6` and `release/3.5`, and on every chain
with fulu
scheduled — none override `CustodyRequirement`. Cherry-picks to follow
once this
lands.

This does not change how a node computes its own custody, subnet
subscriptions or
column requests: those read the in-memory value, not the ENR. It fixes
what other
nodes believe about this one.

Two related gaps found in review, both pre-existing and filed separately
rather
than widened into this PR: the highest count is not persisted across
restarts, and
an archive node advertises `CustodyRequirement` while custodying all 128
groups.
@lystopad
lystopad requested a review from domiwei as a code owner August 26, 2026 11:10
@lystopad lystopad added the Caplin Caplin: Consensus Layer, Beacon API label Aug 26, 2026
@lystopad lystopad self-assigned this Aug 26, 2026
@lystopad
lystopad enabled auto-merge August 26, 2026 11:11

@domiwei domiwei left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. I verified this is a clean backport of #23560: the five changed paths and functional hunks are equivalent, the canonical minimal big-endian CGC encoding and increase-only ratchet are preserved, and the focused setup/encoding/ratchet tests pass. All non-skipped PR checks are green. The comment-style nits are non-blocking.

@lystopad
lystopad added this pull request to the merge queue Aug 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 27, 2026
@lystopad
lystopad added this pull request to the merge queue Aug 27, 2026
Merged via the queue into release/3.5 with commit eb0973b Aug 27, 2026
90 checks passed
@lystopad
lystopad deleted the feature/lystopad/cp-23560-to-3.5 branch August 27, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Caplin Caplin: Consensus Layer, Beacon API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants