From 39134d594ae0b8f345ec51b95b6ebec713321915 Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Mon, 31 Jul 2023 19:47:53 +0800 Subject: [PATCH] Change it back to allow empty `blobs` list file --- tests/core/pyspec/eth2spec/test/helpers/fork_choice.py | 9 +++------ tests/formats/fork_choice/README.md | 5 ++--- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/tests/core/pyspec/eth2spec/test/helpers/fork_choice.py b/tests/core/pyspec/eth2spec/test/helpers/fork_choice.py index ba4f294bc..e0e354722 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/fork_choice.py +++ b/tests/core/pyspec/eth2spec/test/helpers/fork_choice.py @@ -181,11 +181,8 @@ def add_block(spec, # Check blob_data if blob_data is not None: blobs = spec.List[spec.Blob, spec.MAX_BLOBS_PER_BLOCK](blob_data.blobs) - if len(blobs) > 0: - blobs_root = blobs.hash_tree_root() - yield get_blobs_file_name(blobs_root=blobs_root), blobs - else: - blobs_root = None + blobs_root = blobs.hash_tree_root() + yield get_blobs_file_name(blobs_root=blobs_root), blobs is_blob_data_test = blob_data is not None @@ -193,7 +190,7 @@ def add_block(spec, if is_blob_data_test: test_steps.append({ 'block': get_block_file_name(signed_block), - 'blobs': None if blobs_root is None else get_blobs_file_name(blobs_root=blobs_root), + 'blobs': get_blobs_file_name(blobs_root=blobs_root), 'proofs': [encode_hex(proof) for proof in blob_data.proofs], 'valid': valid, }) diff --git a/tests/formats/fork_choice/README.md b/tests/formats/fork_choice/README.md index 4347e95f2..d23de865b 100644 --- a/tests/formats/fork_choice/README.md +++ b/tests/formats/fork_choice/README.md @@ -85,9 +85,8 @@ The parameter that is required for executing `on_block(store, block)`. { block: string -- the name of the `block_<32-byte-root>.ssz_snappy` file. To execute `on_block(store, block)` with the given attestation. - blobs: string or `null` -- optional, the name of the `blobs_<32-byte-root>.ssz_snappy` file. + blobs: string -- optional, the name of the `blobs_<32-byte-root>.ssz_snappy` file. The blobs file content is a `List[Blob, MAX_BLOBS_PER_BLOCK]` SSZ object. - If it's `null`, `blobs` is an empty list. proofs: array of byte48 hex string -- optional, the proofs of blob commitments. valid: bool -- optional, default to `true`. If it's `false`, this execution step is expected to be invalid. @@ -96,7 +95,7 @@ The parameter that is required for executing `on_block(store, block)`. The file is located in the same folder (see below). -`blobs` and `proofs` are new fields from Deneb EIP-4844. These are the expected values from `retrieve_blobs_and_proofs()` helper inside `is_data_available()` helper. +`blobs` and `proofs` are new fields from Deneb EIP-4844. These fields indicate the expected values from `retrieve_blobs_and_proofs()` helper inside `is_data_available()` helper. If these two fields are not provided, `retrieve_blobs_and_proofs()` returns empty lists. After this step, the `store` object may have been updated.