Skip to content

Commit dda2991

Browse files
pdobaczfselmo
authored andcommitted
fix(eof): eofwrap.py to ignore invalid blocks (ethereum#1028)
1 parent 9c1677d commit dda2991

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/cli/eofwrap.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ class EofWrapper:
9090
FIXTURES_CANT_WRAP = "fixtures_cant_wrap"
9191
# Test fixtures with EOF code but test doesn't pass and generation fails
9292
FIXTURES_CANT_GENERATE = "fixtures_cant_generate"
93+
# Invalid blocks in fixtures skipped
94+
INVALID_BLOCKS_SKIPPED = "invalid_blocks_skipped"
9395
# State accounts with code wrapped into valid EOF
9496
ACCOUNTS_WRAPPED = "accounts_wrapped"
9597
# State accounts with code wrapped into valid unique EOF
@@ -111,6 +113,7 @@ def __init__(self):
111113
self.FIXTURES_GENERATED: 0,
112114
self.FIXTURES_CANT_WRAP: 0,
113115
self.FIXTURES_CANT_GENERATE: 0,
116+
self.INVALID_BLOCKS_SKIPPED: 0,
114117
self.ACCOUNTS_WRAPPED: 0,
115118
self.UNIQUE_ACCOUNTS_WRAPPED: 0,
116119
self.ACCOUNTS_INVALID_EOF: 0,
@@ -282,16 +285,16 @@ def _wrap_fixture(self, fixture: BlockchainFixture, traces: bool):
282285
**fixture_tx_dump,
283286
)
284287
block.txs.append(tx)
288+
289+
test.blocks.append(block)
285290
elif isinstance(fixture_block, InvalidFixtureBlock):
286-
block = Block(
287-
rlp=fixture_block.rlp,
288-
exception=fixture_block.expect_exception,
289-
)
291+
# Skip - invalid blocks are not supported. Reason: FixtureTransaction doesn't
292+
# support expected exception. But we can continue and test the remaining
293+
# blocks.
294+
self.metrics[self.INVALID_BLOCKS_SKIPPED] += 1
290295
else:
291296
raise TypeError("not a FixtureBlock")
292297

293-
test.blocks.append(block)
294-
295298
result = test.generate(
296299
request=None, # type: ignore
297300
t8n=t8n,

0 commit comments

Comments
 (0)