Skip to content

Commit 1aa7488

Browse files
committed
update spec builder for electra execution engine
1 parent 71f2912 commit 1aa7488

File tree

1 file changed

+43
-6
lines changed

1 file changed

+43
-6
lines changed

pysetup/spec_builders/electra.py

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,53 @@ class ElectraSpecBuilder(BaseSpecBuilder):
88

99
@classmethod
1010
def imports(cls, preset_name: str):
11-
return f'''
11+
return f"""
1212
from eth2spec.deneb import {preset_name} as deneb
13-
'''
13+
"""
1414

15-
## TODO: deal with changed gindices
15+
@classmethod
16+
def execution_engine_cls(cls) -> str:
17+
return """
18+
class NoopExecutionEngine(ExecutionEngine):
19+
20+
def notify_new_payload(self: ExecutionEngine,
21+
execution_payload: ExecutionPayload,
22+
parent_beacon_block_root: Root,
23+
max_blobs_per_block: uint64) -> bool:
24+
return True
25+
26+
def notify_forkchoice_updated(self: ExecutionEngine,
27+
head_block_hash: Hash32,
28+
safe_block_hash: Hash32,
29+
finalized_block_hash: Hash32,
30+
payload_attributes: Optional[PayloadAttributes]) -> Optional[PayloadId]:
31+
pass
32+
33+
def get_payload(self: ExecutionEngine, payload_id: PayloadId) -> GetPayloadResponse:
34+
# pylint: disable=unused-argument
35+
raise NotImplementedError("no default block production")
36+
37+
def is_valid_block_hash(self: ExecutionEngine,
38+
execution_payload: ExecutionPayload,
39+
parent_beacon_block_root: Root) -> bool:
40+
return True
41+
42+
def is_valid_versioned_hashes(self: ExecutionEngine, new_payload_request: NewPayloadRequest) -> bool:
43+
return True
44+
45+
def verify_and_notify_new_payload(self: ExecutionEngine,
46+
new_payload_request: NewPayloadRequest) -> bool:
47+
return True
48+
49+
50+
EXECUTION_ENGINE = NoopExecutionEngine()"""
51+
52+
## TODO: deal with changed gindices
1653

1754
@classmethod
1855
def hardcoded_ssz_dep_constants(cls) -> Dict[str, str]:
1956
return {
20-
'FINALIZED_ROOT_GINDEX': 'GeneralizedIndex(169)',
21-
'CURRENT_SYNC_COMMITTEE_GINDEX': 'GeneralizedIndex(86)',
22-
'NEXT_SYNC_COMMITTEE_GINDEX': 'GeneralizedIndex(87)',
57+
"FINALIZED_ROOT_GINDEX": "GeneralizedIndex(169)",
58+
"CURRENT_SYNC_COMMITTEE_GINDEX": "GeneralizedIndex(86)",
59+
"NEXT_SYNC_COMMITTEE_GINDEX": "GeneralizedIndex(87)",
2360
}

0 commit comments

Comments
 (0)