From dd5e6f813f82cd20636dfb36950ec281a428d48f Mon Sep 17 00:00:00 2001 From: Hsiao-Wei Wang Date: Wed, 24 May 2023 01:58:49 +0800 Subject: [PATCH] Add `make_function_abstract` to make it more general --- setup.py | 14 +++++++++----- specs/deneb/beacon-chain.md | 4 ---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 609d2acf3..22a05ee32 100644 --- a/setup.py +++ b/setup.py @@ -736,6 +736,11 @@ def is_byte_vector(value: str) -> bool: return value.startswith(('ByteVector')) +def make_function_abstract(protocol_def: ProtocolDefinition, key: str): + function = protocol_def.functions[key].split('"""') + protocol_def.functions[key] = function[0] + "..." + + def objects_to_spec(preset_name: str, spec_object: SpecObject, builder: SpecBuilder, @@ -753,11 +758,10 @@ def objects_to_spec(preset_name: str, ) def format_protocol(protocol_name: str, protocol_def: ProtocolDefinition) -> str: - if "verify_and_notify_new_payload" in protocol_def.functions: - # del protocol_def.functions['verify_and_notify_new_payload'] - protocol_def.functions['verify_and_notify_new_payload'] = """def verify_and_notify_new_payload(self: ExecutionEngine, - new_payload_request: NewPayloadRequest) -> bool: - ...""" + abstract_functions = ["verify_and_notify_new_payload"] + for key in protocol_def.functions.keys(): + if key in abstract_functions: + make_function_abstract(protocol_def, key) protocol = f"class {protocol_name}(Protocol):" for fn_source in protocol_def.functions.values(): diff --git a/specs/deneb/beacon-chain.md b/specs/deneb/beacon-chain.md index bed64db51..615af60d4 100644 --- a/specs/deneb/beacon-chain.md +++ b/specs/deneb/beacon-chain.md @@ -180,8 +180,6 @@ class NewPayloadRequest(object): #### `is_valid_block_hash` -[0]: # (eth2spec: skip) - ```python def is_valid_block_hash(self: ExecutionEngine, execution_payload: ExecutionPayload) -> bool: """ @@ -192,8 +190,6 @@ def is_valid_block_hash(self: ExecutionEngine, execution_payload: ExecutionPaylo #### `is_valid_versioned_hashes` -[0]: # (eth2spec: skip) - ```python def is_valid_versioned_hashes(self: ExecutionEngine, new_payload_request: NewPayloadRequest) -> bool: """