|
1 | 1 | from functools import partial
|
2 |
| -from typing import Dict |
| 2 | +from typing import Dict, Generator, Tuple |
3 | 3 |
|
4 | 4 | import pytest
|
5 | 5 |
|
6 |
| -from tests.helpers import EEST_TESTS_PATH, ETHEREUM_TESTS_PATH |
| 6 | +from tests.helpers import TEST_FIXTURES |
7 | 7 | from tests.helpers.load_state_tests import (
|
8 | 8 | Load,
|
9 | 9 | fetch_state_test_files,
|
10 | 10 | idfn,
|
11 | 11 | run_blockchain_st_test,
|
12 | 12 | )
|
13 | 13 |
|
14 |
| -ETHEREUM_BLOCKCHAIN_TESTS_DIR = f"{ETHEREUM_TESTS_PATH}/BlockchainTests/" |
15 |
| -EEST_BLOCKCHAIN_TESTS_DIR = f"{EEST_TESTS_PATH}/blockchain_tests/" |
16 |
| -NETWORK = "Osaka" |
17 |
| -PACKAGE = "osaka" |
| 14 | +fetch_osaka_tests = partial(fetch_state_test_files, network="Osaka") |
| 15 | + |
| 16 | +FIXTURES_LOADER = Load("Osaka", "osaka") |
| 17 | + |
| 18 | +run_osaka_blockchain_st_tests = partial( |
| 19 | + run_blockchain_st_test, load=FIXTURES_LOADER |
| 20 | +) |
| 21 | + |
| 22 | +ETHEREUM_TESTS_PATH = TEST_FIXTURES["ethereum_tests"]["fixture_path"] |
| 23 | +ETHEREUM_SPEC_TESTS_PATH = TEST_FIXTURES["execution_spec_tests"][ |
| 24 | + "fixture_path" |
| 25 | +] |
| 26 | + |
| 27 | + |
| 28 | +# Run state tests |
| 29 | +test_dir = f"{ETHEREUM_TESTS_PATH}/BlockchainTests/" |
18 | 30 |
|
19 | 31 | SLOW_TESTS = (
|
20 | 32 | # GeneralStateTests
|
21 | 33 | "stTimeConsuming/CALLBlake2f_MaxRounds.json",
|
22 | 34 | "stTimeConsuming/static_Call50000_sha256.json",
|
23 | 35 | "vmPerformance/loopExp.json",
|
24 | 36 | "vmPerformance/loopMul.json",
|
25 |
| - "QuadraticComplexitySolidity_CallDataCopy_d0g1v0_Prague", |
26 |
| - "CALLBlake2f_d9g0v0_Prague", |
| 37 | + "QuadraticComplexitySolidity_CallDataCopy_d0g1v0_Osaka", |
| 38 | + "CALLBlake2f_d9g0v0_Osaka", |
27 | 39 | "CALLCODEBlake2f_d9g0v0",
|
28 | 40 | # GeneralStateTests
|
29 | 41 | "stRandom/randomStatetest177.json",
|
|
33 | 45 | # InvalidBlockTest
|
34 | 46 | "bcUncleHeaderValidity/nonceWrong.json",
|
35 | 47 | "bcUncleHeaderValidity/wrongMixHash.json",
|
36 |
| - "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Prague-blockchain_test-bls_pairing_non-degeneracy-\\]", |
37 |
| - "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Prague-blockchain_test-bls_pairing_bilinearity-\\]", |
38 |
| - "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Prague-blockchain_test-bls_pairing_e\\(G1,-G2\\)=e\\(-G1,G2\\)-\\]", |
39 |
| - "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Prague-blockchain_test-bls_pairing_e\\(aG1,bG2\\)=e\\(abG1,G2\\)-\\]", |
40 |
| - "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Prague-blockchain_test-bls_pairing_e\\(aG1,bG2\\)=e\\(G1,abG2\\)-\\]", |
41 |
| - "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Prague-blockchain_test-inf_pair-\\]", |
42 |
| - "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Prague-blockchain_test-multi_inf_pair-\\]", |
43 |
| - "tests/osaka/eip2935_historical_block_hashes_from_state/test_block_hashes\\.py\\:\\:test_block_hashes_history\\[fork_Prague-blockchain_test-full_history_plus_one_check_blockhash_first\\]", |
| 48 | + "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Osaka-blockchain_test-bls_pairing_non-degeneracy-\\]", |
| 49 | + "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Osaka-blockchain_test-bls_pairing_bilinearity-\\]", |
| 50 | + "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Osaka-blockchain_test-bls_pairing_e\\(G1,-G2\\)=e\\(-G1,G2\\)-\\]", |
| 51 | + "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Osaka-blockchain_test-bls_pairing_e\\(aG1,bG2\\)=e\\(abG1,G2\\)-\\]", |
| 52 | + "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Osaka-blockchain_test-bls_pairing_e\\(aG1,bG2\\)=e\\(G1,abG2\\)-\\]", |
| 53 | + "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Osaka-blockchain_test-inf_pair-\\]", |
| 54 | + "tests/osaka/eip2537_bls_12_381_precompiles/test_bls12_pairing\\.py\\:\\:test_valid\\[fork_Osaka-blockchain_test-multi_inf_pair-\\]", |
| 55 | + "tests/osaka/eip2935_historical_block_hashes_from_state/test_block_hashes\\.py\\:\\:test_block_hashes_history\\[fork_Osaka-blockchain_test-full_history_plus_one_check_blockhash_first\\]", |
44 | 56 | )
|
45 | 57 |
|
46 | 58 | # These are tests that are considered to be incorrect,
|
|
54 | 66 | # InvalidBlockTest
|
55 | 67 | "bcForgedTest",
|
56 | 68 | "bcMultiChainTest",
|
57 |
| - "GasLimitHigherThan2p63m1_Prague", |
| 69 | + "GasLimitHigherThan2p63m1_Osaka", |
58 | 70 | )
|
59 | 71 |
|
60 | 72 | # All tests that recursively create a large number of frames (50000)
|
|
70 | 82 | "stStaticCall/",
|
71 | 83 | )
|
72 | 84 |
|
73 |
| -# Define Tests |
74 |
| -fetch_tests = partial( |
75 |
| - fetch_state_test_files, |
76 |
| - network=NETWORK, |
| 85 | +fetch_state_tests = partial( |
| 86 | + fetch_osaka_tests, |
77 | 87 | ignore_list=IGNORE_TESTS,
|
78 | 88 | slow_list=SLOW_TESTS,
|
79 | 89 | big_memory_list=BIG_MEMORY_TESTS,
|
80 | 90 | )
|
81 | 91 |
|
82 |
| -FIXTURES_LOADER = Load(NETWORK, PACKAGE) |
83 | 92 |
|
84 |
| -run_tests = partial(run_blockchain_st_test, load=FIXTURES_LOADER) |
| 93 | +# Run temporary test fixtures for Osaka |
| 94 | +test_dirs = ( |
| 95 | + "tests/fixtures/latest_fork_tests/osaka/eof/blockchain_tests/eip7692_eof_v1", |
| 96 | +) |
85 | 97 |
|
86 | 98 |
|
87 |
| -# Run tests from ethereum/tests |
88 |
| -@pytest.mark.parametrize( |
89 |
| - "test_case", |
90 |
| - fetch_tests(ETHEREUM_BLOCKCHAIN_TESTS_DIR), |
91 |
| - ids=idfn, |
92 |
| -) |
93 |
| -def test_ethereum_tests(test_case: Dict) -> None: |
94 |
| - run_tests(test_case) |
| 99 | +def fetch_temporary_tests(test_dirs: Tuple[str, ...]) -> Generator: |
| 100 | + """ |
| 101 | + Fetch the relevant tests for a particular EIP-Implementation |
| 102 | + from among the temporary fixtures from ethereum-spec-tests. |
| 103 | + """ |
| 104 | + for test_dir in test_dirs: |
| 105 | + yield from fetch_state_tests(test_dir) |
95 | 106 |
|
96 | 107 |
|
97 |
| -# Run EEST test fixtures |
98 | 108 | @pytest.mark.parametrize(
|
99 | 109 | "test_case",
|
100 |
| - fetch_tests(EEST_BLOCKCHAIN_TESTS_DIR), |
| 110 | + fetch_temporary_tests(test_dirs), |
101 | 111 | ids=idfn,
|
102 | 112 | )
|
103 |
| -def test_eest_tests(test_case: Dict) -> None: |
104 |
| - run_tests(test_case) |
| 113 | +def test_execution_specs_generated_tests(test_case: Dict) -> None: |
| 114 | + run_osaka_blockchain_st_tests(test_case) |
0 commit comments