Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved configuration into network preset instead of constants. #3394

Merged
merged 9 commits into from
Jun 9, 2023
8 changes: 8 additions & 0 deletions presets/mainnet/bellatrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ MAX_TRANSACTIONS_PER_PAYLOAD: 1048576
BYTES_PER_LOGS_BLOOM: 256
# 2**5 (= 32)
MAX_EXTRA_DATA_BYTES: 32

# Networking
# ---------------------------------------------------------------
# `10 * 2**20` (= 10485760, 10 MiB)
GOSSIP_MAX_SIZE: 10485760

# `10 * 2**20` (= 10,485,760, 10 MiB)
MAX_CHUNK_SIZE: 1048576
rolfyone marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 8 additions & 0 deletions presets/minimal/bellatrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,11 @@ MAX_TRANSACTIONS_PER_PAYLOAD: 1048576
BYTES_PER_LOGS_BLOOM: 256
# 2**5 (= 32)
MAX_EXTRA_DATA_BYTES: 32

# Networking
# ---------------------------------------------------------------
# `10 * 2**20` (= 10485760, 10 MiB)
GOSSIP_MAX_SIZE: 10485760

# `10 * 2**20` (= 10,485,760, 10 MiB)
MAX_CHUNK_SIZE: 1048576
rolfyone marked this conversation as resolved.
Show resolved Hide resolved
16 changes: 10 additions & 6 deletions specs/bellatrix/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ This section outlines modifications constants that are used in this spec.

| Name | Value | Description |
|---|---|---|
| `GOSSIP_MAX_SIZE_BELLATRIX` | `10 * 2**20` (= 10,485,760, 10 MiB) | The maximum allowed size of uncompressed gossip messages starting at Bellatrix upgrade. |
| `MAX_CHUNK_SIZE_BELLATRIX` | `10 * 2**20` (= 10,485,760, 10 MiB) | The maximum allowed size of uncompressed req/resp chunked responses starting at Bellatrix upgrade. |
| `GOSSIP_MAX_SIZE` | `10 * 2**20` (= 10,485,760, 10 MiB) | The maximum allowed size of uncompressed gossip messages starting at Bellatrix upgrade. |
| `MAX_CHUNK_SIZE` | `10 * 2**20` (= 10,485,760, 10 MiB) | The maximum allowed size of uncompressed req/resp chunked responses starting at Bellatrix upgrade. |

### The gossip domain: gossipsub

Expand All @@ -61,8 +61,10 @@ All topics remain stable except the beacon block topic which is updated with the

The specification around the creation, validation, and dissemination of messages has not changed from the Phase 0 and Altair documents unless explicitly noted here.

Starting at Bellatrix upgrade, `GOSSIP_MAX_SIZE` has increased from 1Mib to 10Mib.

Starting at Bellatrix upgrade, each gossipsub [message](https://github.com/libp2p/go-libp2p-pubsub/blob/master/pb/rpc.proto#L17-L24)
has a maximum size of `GOSSIP_MAX_SIZE_BELLATRIX`.
has a maximum size of `GOSSIP_MAX_SIZE`.
Clients MUST reject (fail validation) messages that are over this size limit.
Likewise, clients MUST NOT emit or propagate messages larger than this limit.

Expand Down Expand Up @@ -130,8 +132,10 @@ down-scoring or disconnection.

Request and Response remain unchanged unless explicitly noted here.

Starting at Bellatrix upgrade, `MAX_CHUNK_SIZE` has increased from 1Mib to 10Mib.

Starting at Bellatrix upgrade,
a global maximum uncompressed byte size of `MAX_CHUNK_SIZE_BELLATRIX` MUST be applied to all method response chunks
a global maximum uncompressed byte size of `MAX_CHUNK_SIZE` MUST be applied to all method response chunks
regardless of type specific bounds that *MUST* also be respected.

Bellatrix fork-digest is introduced to the `context` enum to specify Bellatrix block type.
Expand Down Expand Up @@ -178,9 +182,9 @@ current mainnet conditions.

Geth currently has a [max gossip message size](https://github.com/ethereum/go-ethereum/blob/3ce9f6d96f38712f5d6756e97b59ccc20cc403b3/eth/protocols/eth/protocol.go#L49) of 10 MiB.
To support backward compatibility with this previously defined network limit,
we adopt `GOSSIP_MAX_SIZE_BELLATRIX` of 10 MiB for maximum gossip sizes at the
we adopt `GOSSIP_MAX_SIZE` of 10 MiB for maximum gossip sizes at the
point of Bellatrix and beyond. Note, that clients SHOULD still reject objects
that exceed their maximum theoretical bounds which in most cases is less than `GOSSIP_MAX_SIZE_BELLATRIX`.
that exceed their maximum theoretical bounds which in most cases is less than `GOSSIP_MAX_SIZE`.

Note, that due to additional size induced by the `BeaconBlock` contents (e.g.
proposer signature, operations lists, etc) this does reduce the
Expand Down