Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pysetup/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,12 @@ def format_protocol(protocol_name: str, protocol_def: ProtocolDefinition) -> str

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

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

def format_config_var(name: str, vardef: VariableDefinition) -> str:
if vardef.type_name is None:
Expand Down Expand Up @@ -140,7 +142,6 @@ def format_constant(name: str, vardef: VariableDefinition) -> str:
constant_vars_spec = '# Constant vars\n' + '\n'.join(format_constant(k, v) for k, v in spec_object.constant_vars.items())
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())
preset_vars_spec = '# Preset vars\n' + '\n'.join(format_constant(k, v) for k, v in spec_object.preset_vars.items())
ordered_class_objects_spec = '\n\n\n'.join(ordered_class_objects.values())
ssz_dep_constants = '\n'.join(map(lambda x: '%s = %s' % (x, hardcoded_ssz_dep_constants[x]), hardcoded_ssz_dep_constants))
ssz_dep_constants_verification = '\n'.join(map(lambda x: 'assert %s == %s' % (x, spec_object.ssz_dep_constants[x]), filtered_ssz_dep_constants))
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))
Expand Down
14 changes: 7 additions & 7 deletions specs/fulu/p2p-interface.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
- [Preset](#preset)
- [Configuration](#configuration)
- [Containers](#containers)
- [`DataColumnIdentifier`](#datacolumnidentifier)
- [`DataColumnsByRootIdentifier`](#datacolumnsbyrootidentifier)
- [Helpers](#helpers)
- [`verify_data_column_sidecar`](#verify_data_column_sidecar)
- [`verify_data_column_sidecar_kzg_proofs`](#verify_data_column_sidecar_kzg_proofs)
Expand Down Expand Up @@ -61,12 +61,12 @@ The specification of these changes continues in the same format as the network s

### Containers

#### `DataColumnIdentifier`
#### `DataColumnsByRootIdentifier`

```python
class DataColumnIdentifier(Container):
class DataColumnsByRootIdentifier(Container):
block_root: Root
index: ColumnIndex
columns: List[ColumnIndex, NUMBER_OF_COLUMNS]
```

### Helpers
Expand Down Expand Up @@ -314,7 +314,7 @@ Request Content:

```
(
List[DataColumnIdentifier, MAX_REQUEST_DATA_COLUMN_SIDECARS]
List[DataColumnsByRootIdentifier, MAX_REQUEST_BLOCKS_DENEB]
)
```

Expand All @@ -326,8 +326,8 @@ Response Content:
)
```

Requests sidecars by block root and index.
The response is a list of `DataColumnIdentifier` whose length is less than or equal to the number of requests.
Requests data column sidecars by block root and column index.
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)`.
It may be less in the case that the responding peer is missing blocks or sidecars.

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`.
Expand Down