Skip to content

Commit 9b677f4

Browse files
committed
t8n: Return InvalidBlock exception in result.blockException
1 parent d9a7ee2 commit 9b677f4

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/ethereum_spec_tools/evm_tools/t8n/__init__.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from ethereum_types.numeric import U64, Uint
1414

1515
from ethereum import trace
16-
from ethereum.exceptions import EthereumException
16+
from ethereum.exceptions import EthereumException, InvalidBlock
1717
from ethereum_spec_tools.forks import Hardfork
1818

1919
from ..loaders.fixture_loader import Load
@@ -245,7 +245,10 @@ def run_blockchain_test(self) -> None:
245245
)
246246

247247
if self.fork.is_after_fork("ethereum.prague"):
248-
self.fork.process_general_purpose_requests(block_env, block_output)
248+
try:
249+
self.fork.process_general_purpose_requests(block_env, block_output)
250+
except InvalidBlock as e:
251+
self.result.block_exception = f"{e}"
249252

250253
self.result.update(self, block_env, block_output)
251254
self.result.rejected = self.txs.rejected_txs

src/ethereum_spec_tools/evm_tools/t8n/t8n_types.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ class Result:
267267
blob_gas_used: Optional[Uint] = None
268268
requests_hash: Optional[Hash32] = None
269269
requests: Optional[List[Bytes]] = None
270+
block_exception: Optional[str] = None
270271

271272
def get_receipts_from_tries(
272273
self, t8n: Any, tx_trie: Any, receipts_trie: Any
@@ -372,5 +373,8 @@ def to_json(self) -> Any:
372373
# T8N doesn't consider the request type byte to be part of the
373374
# request
374375
data["requests"] = [encode_to_hex(req) for req in self.requests]
376+
377+
if self.block_exception is not None:
378+
data["blockException"] = self.block_exception
375379

376380
return data

0 commit comments

Comments
 (0)