Skip to content

Commit f5a5b07

Browse files
authored
Improve DataColumnSidecarsByRoot request (#4284)
1 parent 1937aff commit f5a5b07

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

pysetup/helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,12 @@ def format_protocol(protocol_name: str, protocol_def: ProtocolDefinition) -> str
8282

8383
functions = reduce(lambda fns, builder: builder.implement_optimizations(fns), builders, spec_object.functions)
8484
functions_spec = '\n\n\n'.join(functions.values())
85+
ordered_class_objects_spec = '\n\n\n'.join(ordered_class_objects.values())
8586

8687
# Access global dict of config vars for runtime configurables
8788
for name in spec_object.config_vars.keys():
8889
functions_spec = re.sub(r"\b%s\b" % name, 'config.' + name, functions_spec)
90+
ordered_class_objects_spec = re.sub(r"\b%s\b" % name, 'config.' + name, ordered_class_objects_spec)
8991

9092
def format_config_var(name: str, vardef: VariableDefinition) -> str:
9193
if vardef.type_name is None:
@@ -140,7 +142,6 @@ def format_constant(name: str, vardef: VariableDefinition) -> str:
140142
constant_vars_spec = '# Constant vars\n' + '\n'.join(format_constant(k, v) for k, v in spec_object.constant_vars.items())
141143
preset_dep_constant_vars_spec = '# Preset computed constants\n' + '\n'.join(format_constant(k, v) for k, v in spec_object.preset_dep_constant_vars.items())
142144
preset_vars_spec = '# Preset vars\n' + '\n'.join(format_constant(k, v) for k, v in spec_object.preset_vars.items())
143-
ordered_class_objects_spec = '\n\n\n'.join(ordered_class_objects.values())
144145
ssz_dep_constants = '\n'.join(map(lambda x: '%s = %s' % (x, hardcoded_ssz_dep_constants[x]), hardcoded_ssz_dep_constants))
145146
ssz_dep_constants_verification = '\n'.join(map(lambda x: 'assert %s == %s' % (x, spec_object.ssz_dep_constants[x]), filtered_ssz_dep_constants))
146147
func_dep_presets_verification = '\n'.join(map(lambda x: 'assert %s == %s # noqa: E501' % (x, spec_object.func_dep_presets[x]), filtered_hardcoded_func_dep_presets))

specs/fulu/p2p-interface.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- [Preset](#preset)
1010
- [Configuration](#configuration)
1111
- [Containers](#containers)
12-
- [`DataColumnIdentifier`](#datacolumnidentifier)
12+
- [`DataColumnsByRootIdentifier`](#datacolumnsbyrootidentifier)
1313
- [Helpers](#helpers)
1414
- [`verify_data_column_sidecar`](#verify_data_column_sidecar)
1515
- [`verify_data_column_sidecar_kzg_proofs`](#verify_data_column_sidecar_kzg_proofs)
@@ -61,12 +61,12 @@ The specification of these changes continues in the same format as the network s
6161

6262
### Containers
6363

64-
#### `DataColumnIdentifier`
64+
#### `DataColumnsByRootIdentifier`
6565

6666
```python
67-
class DataColumnIdentifier(Container):
67+
class DataColumnsByRootIdentifier(Container):
6868
block_root: Root
69-
index: ColumnIndex
69+
columns: List[ColumnIndex, NUMBER_OF_COLUMNS]
7070
```
7171

7272
### Helpers
@@ -314,7 +314,7 @@ Request Content:
314314

315315
```
316316
(
317-
List[DataColumnIdentifier, MAX_REQUEST_DATA_COLUMN_SIDECARS]
317+
List[DataColumnsByRootIdentifier, MAX_REQUEST_BLOCKS_DENEB]
318318
)
319319
```
320320

@@ -326,8 +326,8 @@ Response Content:
326326
)
327327
```
328328

329-
Requests sidecars by block root and index.
330-
The response is a list of `DataColumnIdentifier` whose length is less than or equal to the number of requests.
329+
Requests data column sidecars by block root and column index.
330+
The response is a list of `DataColumnSidecar` whose length is less than or equal to `requested_columns_count`, where `requested_columns_count = sum(len(r.columns) for r in request)`.
331331
It may be less in the case that the responding peer is missing blocks or sidecars.
332332

333333
Before consuming the next response chunk, the response reader SHOULD verify the data column sidecar is well-formatted through `verify_data_column_sidecar`, has valid inclusion proof through `verify_data_column_sidecar_inclusion_proof`, and is correct w.r.t. the expected KZG commitments through `verify_data_column_sidecar_kzg_proofs`.

0 commit comments

Comments
 (0)