Fix typing and delete the `signed_sidecar`
This commit is contained in:
parent
a12441486c
commit
51343f54fe
|
@ -27,7 +27,7 @@ GeneralizedIndex = NewType('GeneralizedIndex', int)
|
||||||
@classmethod
|
@classmethod
|
||||||
def sundry_functions(cls) -> str:
|
def sundry_functions(cls) -> str:
|
||||||
return '''
|
return '''
|
||||||
def get_generalized_index(ssz_class: Any, *path: Sequence[PyUnion[int, SSZVariableName]]) -> GeneralizedIndex:
|
def get_generalized_index(ssz_class: Any, *path: PyUnion[int, SSZVariableName]) -> GeneralizedIndex:
|
||||||
ssz_path = Path(ssz_class)
|
ssz_path = Path(ssz_class)
|
||||||
for item in path:
|
for item in path:
|
||||||
ssz_path = ssz_path / item
|
ssz_path = ssz_path / item
|
||||||
|
|
|
@ -163,18 +163,18 @@ def get_blob_sidecars(signed_block: SignedBeaconBlock,
|
||||||
blob=blob,
|
blob=blob,
|
||||||
kzg_commitment=block.body.blob_kzg_commitments[index],
|
kzg_commitment=block.body.blob_kzg_commitments[index],
|
||||||
kzg_proof=blob_kzg_proofs[index],
|
kzg_proof=blob_kzg_proofs[index],
|
||||||
|
signed_block_header=signed_block_header,
|
||||||
commitment_inclusion_proof=compute_merkle_proof(
|
commitment_inclusion_proof=compute_merkle_proof(
|
||||||
block.body,
|
block.body,
|
||||||
get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments', index), # type: ignore
|
get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments', index),
|
||||||
),
|
),
|
||||||
signed_block_header=signed_block_header,
|
|
||||||
)
|
)
|
||||||
for index, blob in enumerate(blobs)
|
for index, blob in enumerate(blobs)
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
||||||
The `subnet_id` for the `signed_sidecar` is calculated with:
|
The `subnet_id` for the `blob_sidecar` is calculated with:
|
||||||
- Let `blob_index = signed_sidecar.message.index`.
|
- Let `blob_index = blob_sidecar.index`.
|
||||||
- Let `subnet_id = compute_subnet_for_blob_sidecar(blob_index)`.
|
- Let `subnet_id = compute_subnet_for_blob_sidecar(blob_index)`.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
|
|
@ -167,7 +167,7 @@ def get_item_position(typ: SSZType, index_or_variable_name: Union[int, SSZVariab
|
||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def get_generalized_index(typ: SSZType, path: Sequence[Union[int, SSZVariableName]]) -> GeneralizedIndex:
|
def get_generalized_index(typ: SSZType, *path: PyUnion[int, SSZVariableName]) -> GeneralizedIndex:
|
||||||
"""
|
"""
|
||||||
Converts a path (eg. `[7, "foo", 3]` for `x[7].foo[3]`, `[12, "bar", "__len__"]` for
|
Converts a path (eg. `[7, "foo", 3]` for `x[7].foo[3]`, `[12, "bar", "__len__"]` for
|
||||||
`len(x[12].bar)`) into the generalized index representing its position in the Merkle tree.
|
`len(x[12].bar)`) into the generalized index representing its position in the Merkle tree.
|
||||||
|
|
Loading…
Reference in New Issue