mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-20 15:38:55 +00:00
Apply PR feedback from @michaelsproul
This commit is contained in:
parent
ac717b106a
commit
0f8b5ae6bd
@ -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
|
||||
|
@ -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,
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user