Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 54 additions & 4 deletions specs/fulu/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
- [GetMetaData v3](#getmetadata-v3)
- [The discovery domain: discv5](#the-discovery-domain-discv5)
- [ENR structure](#enr-structure)
- [`eth2` field](#eth2-field)
- [Custody group count](#custody-group-count)
- [Next fork digest](#next-fork-digest)

Expand Down Expand Up @@ -290,6 +291,11 @@ The added fields are, as seen by the client at the time of sending the message:
- `earliest_available_slot`: The slot of earliest available block
(`BeaconBlock`).

*Note*: `fork_digest` is `compute_fork_digest(genesis_validators_root, epoch)`
where `genesis_validators_root` is the static `Root` found in
`state.genesis_validators_root` and `epoch` is the node's current epoch defined
by the wall-clock time (not necessarily the epoch to which the node is sync).

##### BlobSidecarsByRange v1

**Protocol ID:** `/eth2/beacon_chain/req/blob_sidecars_by_range/1/`
Expand Down Expand Up @@ -510,6 +516,49 @@ are unchanged from the Altair p2p networking document.

#### ENR structure

##### `eth2` field

*[Updated in Fulu:EIP7892]*

*Note*: The structure of `ENRForkID` has not changed but the field value
computations have changed. Unless explicitly mentioned here, all specifications
from [phase0/p2p-interface.md#eth2-field](../phase0/p2p-interface.md#eth2-field)
carry over.

ENRs MUST carry a generic `eth2` key with an 16-byte value of the node's current
fork digest, next fork version, and next fork epoch to ensure connections are
made with peers on the intended Ethereum network.

| Key | Value |
| :----- | :-------------- |
| `eth2` | SSZ `ENRForkID` |

Specifically, the value of the `eth2` key MUST be the following SSZ encoded
object (`ENRForkID`)

```
(
fork_digest: ForkDigest
next_fork_version: Version
next_fork_epoch: Epoch
)
```

where the fields of `ENRForkID` are defined as

- `fork_digest` is `compute_fork_digest(genesis_validators_root, epoch)` where
- `genesis_validators_root` is the static `Root` found in
`state.genesis_validators_root`
- `epoch` is the node's current epoch defined by the wall-clock time (not
necessarily the epoch to which the node is sync)
- `next_fork_version` is the fork version corresponding to the next planned hard
fork at a future epoch. If no future fork is planned, set
`next_fork_version = current_fork_version` to signal this fact
- `next_fork_epoch` is the epoch at which the next fork (whether a regular fork
Copy link
Contributor

Choose a reason for hiding this comment

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

If next fork epoch is a BPO fork, we don't need to update our current_fork_version though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's true. Let me make that clear.

Copy link
Member Author

Choose a reason for hiding this comment

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

@ensi321 how does it look now?

_or a BPO fork_) is planned and the `current_fork_version` will be updated. If
Copy link
Contributor

Choose a reason for hiding this comment

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

should this be next_fork_version?

no future fork is planned, set `next_fork_epoch = FAR_FUTURE_EPOCH` to signal
this fact

##### Custody group count

A new field is added to the ENR under the key `cgc` to facilitate custody data
Expand All @@ -524,7 +573,11 @@ assigned any value other than `FAR_FUTURE_EPOCH`.

A new entry is added to the ENR under the key `nfd`, short for _next fork
digest_. This entry communicates the digest of the next scheduled fork,
regardless of whether it is a regular or a Blob-Parameters-Only fork.
regardless of whether it is a regular or a Blob-Parameters-Only fork. This new
entry MUST be added once `FULU_FORK_EPOCH` is assigned any value other than
`FAR_FUTURE_EPOCH`. Adding this entry prior to the Fulu fork will not impact
peering as nodes will ignore unknown ENR entries and `nfd` mismatches do not
cause disconnnects.

If no next fork is scheduled, the `nfd` entry contains the default value for the
type (i.e., the SSZ representation of a zero-filled array).
Expand All @@ -533,9 +586,6 @@ type (i.e., the SSZ representation of a zero-filled array).
| :---- | :---------------------- |
| `nfd` | SSZ Bytes4 `ForkDigest` |

Furthermore, the existing `next_fork_epoch` field under the `eth2` entry MUST be
set to the epoch of the next fork, whether a regular fork, _or a BPO fork_.

When discovering and interfacing with peers, nodes MUST evaluate `nfd` alongside
their existing consideration of the `ENRForkID::next_*` fields under the `eth2`
key, to form a more accurate view of the peer's intended next fork for the
Expand Down