Skip to content

Commit b4432fb

Browse files
authored
Merge pull request #3817 from dapplion/max-blobs-config
Make MAX_BLOBS_PER_BLOCK a config parameter
2 parents 252b852 + 9280cc7 commit b4432fb

12 files changed

Lines changed: 25 additions & 16 deletions

File tree

configs/mainnet.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ MAX_REQUEST_BLOB_SIDECARS: 768
147147
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
148148
# `6`
149149
BLOB_SIDECAR_SUBNET_COUNT: 6
150+
## `uint64(6)`
151+
MAX_BLOBS_PER_BLOCK: 6
150152

151153
# Whisk
152154
# `Epoch(2**8)`

configs/minimal.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ MAX_REQUEST_BLOB_SIDECARS: 768
148148
MIN_EPOCHS_FOR_BLOB_SIDECARS_REQUESTS: 4096
149149
# `6`
150150
BLOB_SIDECAR_SUBNET_COUNT: 6
151+
## `uint64(6)`
152+
MAX_BLOBS_PER_BLOCK: 6
151153

152154
# Whisk
153155
WHISK_EPOCHS_PER_SHUFFLING_PHASE: 4

presets/mainnet/deneb.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@
66
FIELD_ELEMENTS_PER_BLOB: 4096
77
# `uint64(2**12)` (= 4096)
88
MAX_BLOB_COMMITMENTS_PER_BLOCK: 4096
9-
# `uint64(6)`
10-
MAX_BLOBS_PER_BLOCK: 6
119
# `floorlog2(get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments')) + 1 + ceillog2(MAX_BLOB_COMMITMENTS_PER_BLOCK)` = 4 + 1 + 12 = 17
1210
KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 17

presets/minimal/deneb.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,5 @@
66
FIELD_ELEMENTS_PER_BLOB: 4096
77
# [customized]
88
MAX_BLOB_COMMITMENTS_PER_BLOCK: 16
9-
# `uint64(6)`
10-
MAX_BLOBS_PER_BLOCK: 6
119
# [customized] `floorlog2(get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments')) + 1 + ceillog2(MAX_BLOB_COMMITMENTS_PER_BLOCK)` = 4 + 1 + 4 = 9
1210
KZG_COMMITMENT_INCLUSION_PROOF_DEPTH: 9

pysetup/spec_builders/deneb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def hardcoded_custom_type_dep_constants(cls, spec_object) -> Dict[str, str]:
7070
return {
7171
'BYTES_PER_FIELD_ELEMENT': spec_object.constant_vars['BYTES_PER_FIELD_ELEMENT'].value,
7272
'FIELD_ELEMENTS_PER_BLOB': spec_object.preset_vars['FIELD_ELEMENTS_PER_BLOB'].value,
73-
'MAX_BLOBS_PER_BLOCK': spec_object.preset_vars['MAX_BLOBS_PER_BLOCK'].value,
73+
'MAX_BLOBS_PER_BLOCK': spec_object.config_vars['MAX_BLOBS_PER_BLOCK'].value,
7474
'MAX_BLOB_COMMITMENTS_PER_BLOCK': spec_object.preset_vars['MAX_BLOB_COMMITMENTS_PER_BLOCK'].value,
7575
}
7676

specs/deneb/beacon-chain.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- [Preset](#preset)
1414
- [Execution](#execution)
1515
- [Configuration](#configuration)
16+
- [Execution](#execution-1)
1617
- [Validator cycle](#validator-cycle)
1718
- [Containers](#containers)
1819
- [Extended containers](#extended-containers)
@@ -77,13 +78,18 @@ Deneb is a consensus-layer upgrade containing a number of features. Including:
7778
| Name | Value | Description |
7879
| - | - | - |
7980
| `MAX_BLOB_COMMITMENTS_PER_BLOCK` | `uint64(2**12)` (= 4096) | *[New in Deneb:EIP4844]* hardfork independent fixed theoretical limit same as `LIMIT_BLOBS_PER_TX` (see EIP 4844) |
81+
82+
## Configuration
83+
84+
### Execution
85+
86+
| Name | Value | Description |
87+
| - | - | - |
8088
| `MAX_BLOBS_PER_BLOCK` | `uint64(6)` | *[New in Deneb:EIP4844]* maximum number of blobs in a single block limited by `MAX_BLOB_COMMITMENTS_PER_BLOCK` |
8189

8290
*Note*: The blob transactions are packed into the execution payload by the EL/builder with their corresponding blobs being independently transmitted
8391
and are limited by `MAX_BLOB_GAS_PER_BLOCK // GAS_PER_BLOB`. However the CL limit is independently defined by `MAX_BLOBS_PER_BLOCK`.
8492

85-
## Configuration
86-
8793
### Validator cycle
8894

8995
| Name | Value |

tests/core/pyspec/eth2spec/test/deneb/block_processing/test_process_execution_payload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def test_invalid_correct_input__execution_invalid(spec, state):
254254
def test_invalid_exceed_max_blobs_per_block(spec, state):
255255
execution_payload = build_empty_execution_payload(spec, state)
256256

257-
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec, blob_count=spec.MAX_BLOBS_PER_BLOCK + 1)
257+
opaque_tx, _, blob_kzg_commitments, _ = get_sample_opaque_tx(spec, blob_count=spec.config.MAX_BLOBS_PER_BLOCK + 1)
258258

259259
execution_payload.transactions = [opaque_tx]
260260
execution_payload.block_hash = compute_el_block_hash(spec, execution_payload, state)

tests/core/pyspec/eth2spec/test/deneb/unittests/test_config_invariants.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,20 @@
99
@spec_test
1010
@single_phase
1111
def test_length(spec):
12-
assert spec.MAX_BLOBS_PER_BLOCK < spec.MAX_BLOB_COMMITMENTS_PER_BLOCK
12+
assert spec.config.MAX_BLOBS_PER_BLOCK < spec.MAX_BLOB_COMMITMENTS_PER_BLOCK
1313

1414

1515
@with_deneb_and_later
1616
@spec_test
1717
@single_phase
1818
def test_networking(spec):
19-
assert spec.MAX_BLOBS_PER_BLOCK < spec.MAX_BLOB_COMMITMENTS_PER_BLOCK
20-
assert spec.config.MAX_REQUEST_BLOB_SIDECARS == spec.config.MAX_REQUEST_BLOCKS_DENEB * spec.MAX_BLOBS_PER_BLOCK
19+
assert spec.config.MAX_BLOBS_PER_BLOCK < spec.MAX_BLOB_COMMITMENTS_PER_BLOCK
20+
assert (
21+
spec.config.MAX_REQUEST_BLOB_SIDECARS ==
22+
spec.config.MAX_REQUEST_BLOCKS_DENEB * spec.config.MAX_BLOBS_PER_BLOCK
23+
)
2124
# Start with the same size, but `BLOB_SIDECAR_SUBNET_COUNT` could potentially increase later.
22-
assert spec.config.BLOB_SIDECAR_SUBNET_COUNT == spec.MAX_BLOBS_PER_BLOCK
25+
assert spec.config.BLOB_SIDECAR_SUBNET_COUNT == spec.config.MAX_BLOBS_PER_BLOCK
2326
for i in range(spec.MAX_BLOB_COMMITMENTS_PER_BLOCK):
2427
gindex = spec.get_generalized_index(spec.BeaconBlockBody, 'blob_kzg_commitments', i)
2528
assert spec.floorlog2(gindex) == spec.KZG_COMMITMENT_INCLUSION_PROOF_DEPTH

tests/core/pyspec/eth2spec/test/eip7594/unittests/test_config_invariants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def test_invariants(spec):
1818
assert spec.config.MAX_REQUEST_DATA_COLUMN_SIDECARS == (
1919
spec.config.MAX_REQUEST_BLOCKS_DENEB * spec.config.NUMBER_OF_COLUMNS
2020
)
21-
assert spec.config.MAX_CELLS_IN_EXTENDED_MATRIX == spec.MAX_BLOBS_PER_BLOCK * spec.config.NUMBER_OF_COLUMNS
21+
assert spec.config.MAX_CELLS_IN_EXTENDED_MATRIX == spec.config.MAX_BLOBS_PER_BLOCK * spec.config.NUMBER_OF_COLUMNS
2222

2323

2424
@with_eip7594_and_later

tests/core/pyspec/eth2spec/test/eip7594/unittests/test_security.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_sampling_config(spec):
1919
security_requirement = 0.01
2020
assert probability_of_unavailable <= security_requirement
2121

22-
column_size_in_bytes = spec.FIELD_ELEMENTS_PER_CELL * spec.BYTES_PER_FIELD_ELEMENT * spec.MAX_BLOBS_PER_BLOCK
22+
column_size_in_bytes = spec.FIELD_ELEMENTS_PER_CELL * spec.BYTES_PER_FIELD_ELEMENT * spec.config.MAX_BLOBS_PER_BLOCK
2323
bytes_per_slot = column_size_in_bytes * spec.SAMPLES_PER_SLOT
2424
# TODO: What is the bandwidth requirement?
2525
bandwidth_requirement = 10000 # bytes/s

0 commit comments

Comments
 (0)