Skip to content

Commit d615cb5

Browse files
committed
t8n: Return InvalidBlock exception in result.blockException
1 parent a25a8ab commit d615cb5

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

src/ethereum_spec_tools/evm_tools/t8n/__init__.py

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -442,21 +442,25 @@ def apply_body(self) -> None:
442442
self.fork.is_after_fork("ethereum.prague")
443443
and not self.options.state_test
444444
):
445-
requests_from_execution = (
446-
self.fork.process_general_purpose_requests(
447-
deposit_requests,
448-
self.alloc.state,
449-
self.env.block_hashes,
450-
self.env.coinbase,
451-
self.env.block_number,
452-
self.env.base_fee_per_gas,
453-
self.env.block_gas_limit,
454-
self.env.block_timestamp,
455-
self.env.prev_randao,
456-
self.chain_id,
457-
self.env.excess_blob_gas,
445+
requests_from_execution = []
446+
try:
447+
requests_from_execution = (
448+
self.fork.process_general_purpose_requests(
449+
deposit_requests,
450+
self.alloc.state,
451+
self.env.block_hashes,
452+
self.env.coinbase,
453+
self.env.block_number,
454+
self.env.base_fee_per_gas,
455+
self.env.block_gas_limit,
456+
self.env.block_timestamp,
457+
self.env.prev_randao,
458+
self.chain_id,
459+
self.env.excess_blob_gas,
460+
)
458461
)
459-
)
462+
except InvalidBlock as e:
463+
self.result.block_exception = f"{e}"
460464
requests_hash = self.fork.compute_requests_hash(
461465
requests_from_execution
462466
)

src/ethereum_spec_tools/evm_tools/t8n/t8n_types.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ class Result:
311311
blob_gas_used: Optional[Uint] = None
312312
requests_hash: Optional[Hash32] = None
313313
requests: Optional[List[Bytes]] = None
314+
block_exception: Optional[str] = None
314315

315316
def to_json(self) -> Any:
316317
"""Encode the result to JSON"""
@@ -360,5 +361,8 @@ def to_json(self) -> Any:
360361
# T8N doesn't consider the request type byte to be part of the
361362
# request
362363
data["requests"] = [encode_to_hex(req) for req in self.requests]
364+
365+
if self.block_exception is not None:
366+
data["blockException"] = self.block_exception
363367

364368
return data

0 commit comments

Comments
 (0)