from .base import BaseSpecBuilder from ..constants import BELLATRIX class BellatrixSpecBuilder(BaseSpecBuilder): fork: str = BELLATRIX @classmethod def imports(cls, preset_name: str): return f''' from typing import Protocol from eth2spec.altair import {preset_name} as altair from eth2spec.utils.ssz.ssz_typing import Bytes8, Bytes20, ByteList, ByteVector ''' @classmethod def sundry_functions(cls) -> str: return """ ExecutionState = Any def get_pow_block(hash: Bytes32) -> Optional[PowBlock]: return PowBlock(block_hash=hash, parent_hash=Bytes32(), total_difficulty=uint256(0)) def get_execution_state(_execution_state_root: Bytes32) -> ExecutionState: pass def get_pow_chain_head() -> PowBlock: pass def validator_is_connected(validator_index: ValidatorIndex) -> bool: # pylint: disable=unused-argument return True""" @classmethod def execution_engine_cls(cls) -> str: return """ class NoopExecutionEngine(ExecutionEngine): def notify_new_payload(self: ExecutionEngine, execution_payload: ExecutionPayload) -> 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) -> bool: return True def verify_and_notify_new_payload(self: ExecutionEngine, new_payload_request: NewPayloadRequest) -> bool: return True EXECUTION_ENGINE = NoopExecutionEngine()""" @classmethod def hardcoded_custom_type_dep_constants(cls, spec_object) -> str: return { 'MAX_BYTES_PER_TRANSACTION': spec_object.preset_vars['MAX_BYTES_PER_TRANSACTION'].value, }