2024-04-09 18:49:58 +00:00
|
|
|
from typing import Dict
|
2023-06-26 10:01:56 +00:00
|
|
|
from .base import BaseSpecBuilder
|
2024-02-16 04:29:00 +00:00
|
|
|
from ..constants import ELECTRA
|
2023-06-26 10:01:56 +00:00
|
|
|
|
|
|
|
|
2024-02-16 04:29:00 +00:00
|
|
|
class ElectraSpecBuilder(BaseSpecBuilder):
|
|
|
|
fork: str = ELECTRA
|
2023-06-26 10:01:56 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def imports(cls, preset_name: str):
|
|
|
|
return f'''
|
|
|
|
from eth2spec.deneb import {preset_name} as deneb
|
|
|
|
'''
|
2024-04-09 18:49:58 +00:00
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def hardcoded_ssz_dep_constants(cls) -> Dict[str, str]:
|
|
|
|
return {
|
2024-07-09 18:15:31 +00:00
|
|
|
'FINALIZED_ROOT_GINDEX_ELECTRA': 'GeneralizedIndex(169)',
|
|
|
|
'CURRENT_SYNC_COMMITTEE_GINDEX_ELECTRA': 'GeneralizedIndex(86)',
|
|
|
|
'NEXT_SYNC_COMMITTEE_GINDEX_ELECTRA': 'GeneralizedIndex(87)',
|
2024-04-09 18:49:58 +00:00
|
|
|
}
|
2024-09-05 22:08:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
def execution_engine_cls(cls) -> str:
|
|
|
|
return """
|
|
|
|
class NoopExecutionEngine(ExecutionEngine):
|
|
|
|
|
|
|
|
def notify_new_payload(self: ExecutionEngine,
|
|
|
|
execution_payload: ExecutionPayload,
|
|
|
|
execution_requests: ExecutionRequests,
|
|
|
|
parent_beacon_block_root: Root) -> 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()"""
|