|
15 | 15 | ExceptionMessage, |
16 | 16 | TransactionException, |
17 | 17 | ) |
18 | | -from ethereum_test_fixtures import BlockchainFixture, FixtureFormat, StateFixture |
| 18 | +from ethereum_test_fixtures import BlockchainFixture, EOFFixture, FixtureFormat, StateFixture |
19 | 19 | from ethereum_test_forks import Fork |
20 | 20 |
|
21 | 21 | from ..ethereum_cli import EthereumCLI |
@@ -246,7 +246,7 @@ def is_fork_supported(self, fork: Fork) -> bool: |
246 | 246 | class GethFixtureConsumer( |
247 | 247 | GethEvm, |
248 | 248 | FixtureConsumerTool, |
249 | | - fixture_formats=[StateFixture, BlockchainFixture], |
| 249 | + fixture_formats=[StateFixture, BlockchainFixture, EOFFixture], |
250 | 250 | ): |
251 | 251 | """Geth's implementation of the fixture consumer.""" |
252 | 252 |
|
@@ -290,6 +290,38 @@ def consume_blockchain_test( |
290 | 290 | f"Unexpected exit code:\n{' '.join(command)}\n\n Error:\n{result.stderr}" |
291 | 291 | ) |
292 | 292 |
|
| 293 | + def consume_eof_test( |
| 294 | + self, |
| 295 | + fixture_path: Path, |
| 296 | + fixture_name: Optional[str] = None, |
| 297 | + debug_output_path: Optional[Path] = None, |
| 298 | + ): |
| 299 | + """Consume an EOF validation test (valid yes/no) without running any EOF code.""" |
| 300 | + subcommand = "eofparse" |
| 301 | + global_options = [] |
| 302 | + subcommand_options = ["--test"] |
| 303 | + if debug_output_path: |
| 304 | + global_options += ["--verbosity", "100"] |
| 305 | + # --trace does not exist for eofparse |
| 306 | + |
| 307 | + command = ( |
| 308 | + [str(self.binary)] |
| 309 | + + global_options |
| 310 | + + [subcommand] |
| 311 | + + subcommand_options |
| 312 | + + [str(fixture_path)] |
| 313 | + ) |
| 314 | + |
| 315 | + result = self._run_command(command) |
| 316 | + |
| 317 | + if debug_output_path: |
| 318 | + self._consume_debug_dump(command, result, fixture_path, debug_output_path) |
| 319 | + |
| 320 | + if result.returncode != 0: |
| 321 | + raise Exception( |
| 322 | + f"Unexpected exit code:\n{' '.join(command)}\n\n Error:\n{result.stderr}" |
| 323 | + ) |
| 324 | + |
293 | 325 | @cache # noqa |
294 | 326 | def consume_state_test_file( |
295 | 327 | self, |
@@ -385,6 +417,12 @@ def consume_fixture( |
385 | 417 | fixture_name=fixture_name, |
386 | 418 | debug_output_path=debug_output_path, |
387 | 419 | ) |
| 420 | + elif fixture_format == EOFFixture: |
| 421 | + self.consume_eof_test( |
| 422 | + fixture_path=fixture_path, |
| 423 | + fixture_name=fixture_name, |
| 424 | + debug_output_path=debug_output_path, |
| 425 | + ) |
388 | 426 | else: |
389 | 427 | raise Exception( |
390 | 428 | f"Fixture format {fixture_format.format_name} not supported by {self.binary}" |
|
0 commit comments