From 1aa74885f7d59920b4d4da994b9be2292210c5da Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Wed, 12 Jun 2024 14:46:38 -0600 Subject: [PATCH] update spec builder for electra execution engine --- pysetup/spec_builders/electra.py | 49 ++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/pysetup/spec_builders/electra.py b/pysetup/spec_builders/electra.py index 1f968a817d..dd79811063 100644 --- a/pysetup/spec_builders/electra.py +++ b/pysetup/spec_builders/electra.py @@ -8,16 +8,53 @@ class ElectraSpecBuilder(BaseSpecBuilder): @classmethod def imports(cls, preset_name: str): - return f''' + return f""" from eth2spec.deneb import {preset_name} as deneb -''' +""" -## TODO: deal with changed gindices + @classmethod + def execution_engine_cls(cls) -> str: + return """ +class NoopExecutionEngine(ExecutionEngine): + + def notify_new_payload(self: ExecutionEngine, + execution_payload: ExecutionPayload, + parent_beacon_block_root: Root, + max_blobs_per_block: uint64) -> bool: + return True + + def notify_forkchoice_updated(self: ExecutionEngine, + head_block_hash: Hash32, + safe_block_hash: Hash32, + finalized_block_hash: Hash32, + payload_attributes: Optional[PayloadAttributes]) -> Optional[PayloadId]: + pass + + def get_payload(self: ExecutionEngine, payload_id: PayloadId) -> GetPayloadResponse: + # pylint: disable=unused-argument + raise NotImplementedError("no default block production") + + def is_valid_block_hash(self: ExecutionEngine, + execution_payload: ExecutionPayload, + parent_beacon_block_root: Root) -> bool: + return True + + def is_valid_versioned_hashes(self: ExecutionEngine, new_payload_request: NewPayloadRequest) -> bool: + return True + + def verify_and_notify_new_payload(self: ExecutionEngine, + new_payload_request: NewPayloadRequest) -> bool: + return True + + +EXECUTION_ENGINE = NoopExecutionEngine()""" + + ## TODO: deal with changed gindices @classmethod def hardcoded_ssz_dep_constants(cls) -> Dict[str, str]: return { - 'FINALIZED_ROOT_GINDEX': 'GeneralizedIndex(169)', - 'CURRENT_SYNC_COMMITTEE_GINDEX': 'GeneralizedIndex(86)', - 'NEXT_SYNC_COMMITTEE_GINDEX': 'GeneralizedIndex(87)', + "FINALIZED_ROOT_GINDEX": "GeneralizedIndex(169)", + "CURRENT_SYNC_COMMITTEE_GINDEX": "GeneralizedIndex(86)", + "NEXT_SYNC_COMMITTEE_GINDEX": "GeneralizedIndex(87)", }