Skip to content

Commit

Permalink
Moved configuration into network preset instead of constants.
Browse files Browse the repository at this point in the history
Now that `MAX_CHUNK_SIZE` and `GOSSIP_MAX_SIZE` are in configuration, we no longer need separate constants to represent them in the spec when they change in Bellatrix.

I've changed the usage, and put the values into the presets, but I'm not sure if I've updated the descriptions in the best way...

This is following on from the work in ethereum#3375 where a number of constants got moved into configuration, so we no longer need these constants to be separately represented, they can simply be updated in presets.
  • Loading branch information
rolfyone committed May 31, 2023
1 parent 53a9324 commit 3de2607
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 deletions.
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
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
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

0 comments on commit 3de2607

Please sign in to comment.