From 51343f54fe73eaffa550d78414faed6e63df5b62 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Mon, 30 Oct 2023 18:24:19 +0800 Subject: [PATCH] Fix typing and delete the `signed_sidecar` --- pysetup/spec_builders/altair.py | 2 +- specs/deneb/validator.md | 8 ++++---- ssz/merkle-proofs.md | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pysetup/spec_builders/altair.py b/pysetup/spec_builders/altair.py index ff667b19c..abd9b56c4 100644 --- a/pysetup/spec_builders/altair.py +++ b/pysetup/spec_builders/altair.py @@ -27,7 +27,7 @@ GeneralizedIndex = NewType('GeneralizedIndex', int) @classmethod def sundry_functions(cls) -> str: 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) for item in path: ssz_path = ssz_path / item diff --git a/specs/deneb/validator.md b/specs/deneb/validator.md index e5141746a..cb87e1322 100644 --- a/specs/deneb/validator.md +++ b/specs/deneb/validator.md @@ -163,18 +163,18 @@ def get_blob_sidecars(signed_block: SignedBeaconBlock, blob=blob, kzg_commitment=block.body.blob_kzg_commitments[index], kzg_proof=blob_kzg_proofs[index], + signed_block_header=signed_block_header, commitment_inclusion_proof=compute_merkle_proof( 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) ] ``` -The `subnet_id` for the `signed_sidecar` is calculated with: -- Let `blob_index = signed_sidecar.message.index`. +The `subnet_id` for the `blob_sidecar` is calculated with: +- Let `blob_index = blob_sidecar.index`. - Let `subnet_id = compute_subnet_for_blob_sidecar(blob_index)`. ```python diff --git a/ssz/merkle-proofs.md b/ssz/merkle-proofs.md index 6772026fe..919ff07f5 100644 --- a/ssz/merkle-proofs.md +++ b/ssz/merkle-proofs.md @@ -167,7 +167,7 @@ def get_item_position(typ: SSZType, index_or_variable_name: Union[int, SSZVariab ``` ```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 `len(x[12].bar)`) into the generalized index representing its position in the Merkle tree.