eth2.0-specs/specs/electra/p2p-interface.md

72 lines
2.7 KiB
Markdown
Raw Normal View History

2024-04-05 11:02:03 -06:00
# Electra -- Networking
2024-03-05 20:46:45 +08:00
2024-04-05 11:02:03 -06:00
This document contains the consensus-layer networking specification for Electra.
2024-03-05 20:46:45 +08:00
The specification of these changes continues in the same format as the network specifications of previous upgrades, and assumes them as pre-requisite.
## Table of contents
<!-- TOC -->
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
2024-04-05 11:02:03 -06:00
- [Modifications in Electra](#modifications-in-electra)
2024-03-05 20:46:45 +08:00
- [The gossip domain: gossipsub](#the-gossip-domain-gossipsub)
- [Topics and messages](#topics-and-messages)
2024-04-05 11:02:03 -06:00
- [Global topics](#global-topics)
- [`beacon_aggregate_and_proof`](#beacon_aggregate_and_proof)
- [Attestation subnets](#attestation-subnets)
2024-04-05 11:02:03 -06:00
- [`beacon_attestation_{subnet_id}`](#beacon_attestation_subnet_id)
2024-03-05 20:46:45 +08:00
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
<!-- /TOC -->
2024-04-05 11:02:03 -06:00
## Modifications in Electra
2024-03-05 20:46:45 +08:00
### The gossip domain: gossipsub
2024-04-05 11:02:03 -06:00
Some gossip meshes are upgraded in the fork of Electra to support upgraded types.
2024-03-05 20:46:45 +08:00
#### Topics and messages
2024-04-05 11:02:03 -06:00
Topics follow the same specification as in prior upgrades.
The `beacon_block` topic is modified to also support Electra blocks.
The `beacon_aggregate_and_proof` and `beacon_attestation_{subnet_id}` topics are modified to support the gossip of the new attestation type.
2024-03-05 20:46:45 +08:00
2024-04-05 11:02:03 -06:00
The specification around the creation, validation, and dissemination of messages has not changed from the Capella document unless explicitly noted here.
2024-03-05 20:46:45 +08:00
2024-04-05 11:02:03 -06:00
The derivation of the `message-id` remains stable.
2024-03-05 20:46:45 +08:00
2024-04-05 11:02:03 -06:00
#### Global topics
##### `beacon_aggregate_and_proof`
2024-03-05 20:46:45 +08:00
The following convenience variables are re-defined
- `index = get_committee_indices(aggregate.committee_bits)[0]`
The following validations are added:
2024-03-25 16:19:11 +06:00
* [REJECT] `len(committee_indices) == 1`, where `committee_indices = get_committee_indices(aggregate)`.
2024-03-05 20:46:45 +08:00
* [REJECT] `aggregate.data.index == 0`
#### Attestation subnets
2024-04-05 11:02:03 -06:00
##### `beacon_attestation_{subnet_id}`
2024-03-05 20:46:45 +08:00
Separate type for unaggregated network attestations As a complement to https://github.com/ethereum/consensus-specs/pull/3787, this PR introduces a `SingleAttestation` type used for network propagation only. In Electra, the on-chain attestation format introduced in [EIP-7549](https://github.com/ethereum/consensus-specs/pull/3559) presents several difficulties - not only are the new fields to be interpreted differently during network processing and onchain which adds complexity in clients, they also introduce inefficiency both in hash computation and bandwidth. The new type puts the validator and committee indices directly in the attestation type, this simplifying processing and increasing security. * placing the validator index directly in the attestation allows verifying the signature without computing a shuffling - this closes a loophole where clients either must drop attestations or risk being overwhelmed by shuffling computations during attestation verification * the simpler "structure" of the attestation saves several hash calls during processing (a single-item List has significant hashing overhead compared to a field) * we save a few bytes here and there - we can also put stricter bounds on message size on the attestation topic because `SingleAttestation` is now fixed-size * the ambiguity of interpreting the `attestation_bits` list indices which became contextual under EIP-7549 is removed Because this change only affects the network encoding (and not block contents), the implementation impact on clients should be minimal.
2024-08-26 15:54:59 +02:00
The topic is updated to propagate `SingleAttestation` objects.
2024-08-28 07:31:49 +02:00
The following convenience variables are re-defined:
Separate type for unaggregated network attestations As a complement to https://github.com/ethereum/consensus-specs/pull/3787, this PR introduces a `SingleAttestation` type used for network propagation only. In Electra, the on-chain attestation format introduced in [EIP-7549](https://github.com/ethereum/consensus-specs/pull/3559) presents several difficulties - not only are the new fields to be interpreted differently during network processing and onchain which adds complexity in clients, they also introduce inefficiency both in hash computation and bandwidth. The new type puts the validator and committee indices directly in the attestation type, this simplifying processing and increasing security. * placing the validator index directly in the attestation allows verifying the signature without computing a shuffling - this closes a loophole where clients either must drop attestations or risk being overwhelmed by shuffling computations during attestation verification * the simpler "structure" of the attestation saves several hash calls during processing (a single-item List has significant hashing overhead compared to a field) * we save a few bytes here and there - we can also put stricter bounds on message size on the attestation topic because `SingleAttestation` is now fixed-size * the ambiguity of interpreting the `attestation_bits` list indices which became contextual under EIP-7549 is removed Because this change only affects the network encoding (and not block contents), the implementation impact on clients should be minimal.
2024-08-26 15:54:59 +02:00
- `index = attestation.committee_index`
2024-03-05 20:46:45 +08:00
The following validations are added:
2024-08-28 07:31:49 +02:00
- _[REJECT]_ `attestation.data.index == 0`
- _[REJECT]_ The attester is a member of the committtee -- i.e.
`atestation.attester_index in get_beacon_committee(state, attestation.data.slot, index)`.
The following validations are removed:
- _[REJECT]_ The attestation is unaggregated --
that is, it has exactly one participating validator (`len([bit for bit in aggregation_bits if bit]) == 1`, i.e. exactly 1 bit is set).
- _[REJECT]_ The number of aggregation bits matches the committee size -- i.e.
`len(aggregation_bits) == len(get_beacon_committee(state, attestation.data.slot, index))`.