Skip to content

fix: match fork digest in gossip spec tests#622

Merged
tcoratger merged 1 commit intoleanEthereum:mainfrom
shariqnaiyer:fix/shariqnaiyer/devnet0
Apr 16, 2026
Merged

fix: match fork digest in gossip spec tests#622
tcoratger merged 1 commit intoleanEthereum:mainfrom
shariqnaiyer:fix/shariqnaiyer/devnet0

Conversation

@shariqnaiyer
Copy link
Copy Markdown
Collaborator

🗒️ Description

Addresses #619

Matches the fork digest to the existing digest in the spec as well as the one implemented in other clients.

🔗 Related Issues or PRs

✅ Checklist

  • Ran tox checks to avoid unnecessary CI fails:
    uvx tox

Match the beacon chain convention of using bare hex fork digests
(e.g. "12345678") instead of 0x-prefixed hex ("0x12345678").

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tcoratger tcoratger force-pushed the fix/shariqnaiyer/devnet0 branch from 42b95a1 to a8d85be Compare April 16, 2026 15:42
@tcoratger tcoratger merged commit b3d7b3e into leanEthereum:main Apr 16, 2026
13 checks passed
@unnawut unnawut added the specs Scope: Changes to the specifications label Apr 16, 2026
@unnawut unnawut added this to the pq-devnet-4 milestone Apr 16, 2026
MegaRedHand added a commit to lambdaclass/ethlambda that referenced this pull request Apr 16, 2026
Match the leanSpec topic format `/leanconsensus/{fork_digest}/{name}/ssz_snappy`
(leanEthereum/leanSpec#622) instead of the custom `/leanconsensus/devnet0/...`.

Introduce a `ForkDigest` newtype displayed as lowercase hex without `0x`
prefix, plus `block_topic` / `aggregation_topic` / `attestation_subnet_topic`
helpers. The digest is plumbed through `SwarmConfig` / `BuiltSwarm` /
`P2PServer` so it becomes configurable once the spec defines real fork
identification. For now every client agrees on the dummy `12345678` value,
exposed as `ForkDigest::DUMMY`.

Closes #292
MegaRedHand added a commit to lambdaclass/ethlambda that referenced this pull request Apr 17, 2026
## Summary

- Match the [leanSpec gossipsub topic
format](leanEthereum/leanSpec#622)
`/leanconsensus/{fork_digest}/{name}/ssz_snappy` instead of the custom
`/leanconsensus/devnet0/...` we had hard-coded.

Closes #292.
tcoratger added a commit to tcoratger/leanSpec that referenced this pull request Apr 27, 2026
Delete forks/devnet5/ entirely. We are running one devnet roughly per month,
so per-devnet placeholders rot fast and lock the spec into a sequential
upgrade story we are not committing to.

Rename forks/devnet4/ to forks/lstar/ (via git mv, history preserved):

- Devnet4Spec    -> LstarSpec
- Devnet4 (test BaseFork class) -> Lstar
- "devnet4" / "Devnet4" string identifiers -> "lstar" / "Lstar"
- lean_spec.forks.devnet4.* import paths -> lean_spec.forks.lstar.*
- --fork=Devnet4 / --fork=devnet4 in CI workflows and docs -> Lstar / lstar

Test surface follows: TestDevnet4Spec -> TestLstarSpec, TestDevnet5Spec
removed entirely. Multi-fork ForkRegistry tests now use a synthetic
in-test successor class instead of a real second fork.

Untouched on purpose:

- pyproject.toml lean-multisig-py branch="devnet4" (external repo, not ours).
- tests/consensus/devnet/ folder name (generic test path, no version number).
- GOSSIP_DIGEST="devnet0" — the cross-client gossip network name set by
  PR leanEthereum#622. Renaming it touches the whole networking layer and is a
  separate cleanup.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
tcoratger added a commit to tcoratger/leanSpec that referenced this pull request Apr 27, 2026
The value sitting on the gossipsub topic layer is the cross-client
network name (currently "devnet0", set by PR leanEthereum#622), not a 4-byte fork
digest hash. The "fork_digest" naming was a holdover from Ethereum
mainline where it really is a digest; here it just confuses readers
into expecting a hash where there is a string identifier.

Renamed in the network-name layer:

- ForkProtocol.GOSSIP_DIGEST -> ForkProtocol.NETWORK_NAME
- GossipTopic.fork_digest -> GossipTopic.network_name
- GossipTopic.{block,committee_aggregation,attestation_subnet}
  fork_digest parameter -> network_name
- GossipTopic.validate_fork(expected_fork_digest=...)
  -> validate_fork(expected_network_name=...)
- GossipTopic.from_string_validated(..., expected_fork_digest=...)
  -> expected_network_name
- GossipHandler.fork_digest -> GossipHandler.network_name
- LiveNetworkEventSource._fork_digest -> _network_name
- LiveNetworkEventSource.set_fork_digest() -> set_network_name()
- NetworkService.fork_digest -> NetworkService.network_name
- NodeConfig.fork_digest -> NodeConfig.network_name

Plus matching test renames:

- test_gossip_digest -> test_network_name
- test_gossip_topic_fork_digest_{matches,mismatch,...}
  -> test_gossip_topic_network_name_*
- All test variables, parameters, and prose updated.

Untouched on purpose:

- Eth2Data.fork_digest: ForkDigest in subspecs/networking/enr/eth2.py
  is a real 4-byte ENR hash per the Ethereum p2p spec. The ForkDigest
  type stays. enr/enr.py, peer.py, discovery/routing.py all interact
  with this real digest and are unchanged.
- JSON fixture keys "forkDigest" / "expectedForkDigest" in cross-client
  test vectors. Other clients consume those keys; renaming would break
  the wire format. Internal Python uses network_name; the JSON keys are
  read into network_name on the way in.
- ForkMismatchError class name. A fork mismatch is still a fork
  mismatch semantically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

specs Scope: Changes to the specifications

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants