diff --git a/tests/core/pyspec/eth2spec/gen_helpers/gen_base/gen_runner.py b/tests/core/pyspec/eth2spec/gen_helpers/gen_base/gen_runner.py index 1d2b03fd2..dccb9313f 100644 --- a/tests/core/pyspec/eth2spec/gen_helpers/gen_base/gen_runner.py +++ b/tests/core/pyspec/eth2spec/gen_helpers/gen_base/gen_runner.py @@ -9,7 +9,6 @@ import sys import json from typing import Iterable, AnyStr, Any, Callable import traceback - from ruamel.yaml import ( YAML, ) @@ -98,6 +97,11 @@ def run_generator(generator_name, test_providers: Iterable[TestProvider]): yaml = YAML(pure=True) yaml.default_flow_style = None + def _represent_none(self, _): + return self.represent_scalar('tag:yaml.org,2002:null', 'null') + + yaml.representer.add_representer(type(None), _represent_none) + # Spec config is using a YAML subset cfg_yaml = YAML(pure=True) cfg_yaml.default_flow_style = False # Emit separate line for each key diff --git a/tests/core/pyspec/eth2spec/test/helpers/optimistic_sync.py b/tests/core/pyspec/eth2spec/test/helpers/optimistic_sync.py index d88513a8a..a89c3083e 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/optimistic_sync.py +++ b/tests/core/pyspec/eth2spec/test/helpers/optimistic_sync.py @@ -42,9 +42,9 @@ class PayloadStatusV1: @property def formatted_output(self): return { - 'status': str(self.status), - 'latest_valid_hash': encode_hex(self.latest_valid_hash) if self.latest_valid_hash is not None else 'null', - 'validation_error': str(self.validation_error) if self.validation_error is not None else 'null' + 'status': str(self.status.value), + 'latest_valid_hash': encode_hex(self.latest_valid_hash) if self.latest_valid_hash is not None else None, + 'validation_error': str(self.validation_error) if self.validation_error is not None else None } @@ -95,6 +95,7 @@ def add_optimistic_block(spec, mega_store, signed_block, test_steps, mega_store.block_payload_statuses[block_root] = payload_status test_steps.append({ + 'block_hash': encode_hex(el_block_hash), 'payload_status': payload_status.formatted_output, })