Ethereum Test Fixtures package¶
Ethereum test fixture format definitions.
BaseFixture
¶
Bases: CamelModel
Represents a base Ethereum test fixture of any type.
Source code in src/ethereum_test_fixtures/base.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
|
output_base_dir_name()
classmethod
¶
Return name of the subdirectory where this type of fixture should be dumped to.
Source code in src/ethereum_test_fixtures/base.py
55 56 57 58 |
|
__pydantic_init_subclass__(**kwargs)
classmethod
¶
Register all subclasses of BaseFixture with a fixture format name set as possible fixture formats.
Source code in src/ethereum_test_fixtures/base.py
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
json_dict: Dict[str, Any]
cached
property
¶
Returns the JSON representation of the fixture.
hash: str
cached
property
¶
Returns the hash of the fixture.
json_dict_with_info(hash_only=False)
¶
Return JSON representation of the fixture with the info field.
Source code in src/ethereum_test_fixtures/base.py
107 108 109 110 111 112 113 |
|
fill_info(t8n_version, test_case_description, fixture_source_url, ref_spec, _info_metadata)
¶
Fill the info field for this fixture.
Source code in src/ethereum_test_fixtures/base.py
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
get_fork()
¶
Return fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/base.py
135 136 137 |
|
supports_fork(fork)
classmethod
¶
Return whether the fixture can be generated for the given fork.
By default, all fixtures support all forks.
Source code in src/ethereum_test_fixtures/base.py
139 140 141 142 143 144 145 146 |
|
LabeledFixtureFormat
¶
Represents a fixture format with a custom label.
This label will be used in the test id and also will be added as a marker to the generated test case when filling the test.
Source code in src/ethereum_test_fixtures/base.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
|
__init__(fixture_format, label, description)
¶
Initialize the fixture format with a custom label.
Source code in src/ethereum_test_fixtures/base.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
format_name: str
property
¶
Get the execute format name.
__eq__(other)
¶
Check if two labeled fixture formats are equal.
If the other object is a FixtureFormat type, the format of the labeled fixture format will be compared with the format of the other object.
Source code in src/ethereum_test_fixtures/base.py
185 186 187 188 189 190 191 192 193 194 195 196 |
|
BlockchainEngineFixture
¶
Bases: BlockchainEngineFixtureCommon
Engine specific test fixture information.
Source code in src/ethereum_test_fixtures/blockchain.py
548 549 550 551 552 553 554 555 556 557 558 559 |
|
BlockchainEngineFixtureCommon
¶
Bases: BaseFixture
Base blockchain test fixture model for Engine API based execution.
Similar to BlockchainFixtureCommon but excludes the 'pre' field to avoid duplicating large pre-allocations when using shared genesis approaches.
Source code in src/ethereum_test_fixtures/blockchain.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 |
|
get_fork()
¶
Return fixture's Fork
.
Source code in src/ethereum_test_fixtures/blockchain.py
534 535 536 |
|
supports_fork(fork)
classmethod
¶
Return whether the fixture can be generated for the given fork.
The Engine API is available only on Paris and afterwards.
Source code in src/ethereum_test_fixtures/blockchain.py
538 539 540 541 542 543 544 545 |
|
BlockchainEngineReorgFixture
¶
Bases: BlockchainEngineFixtureCommon
Engine reorg specific test fixture information.
Uses shared pre-allocations and blockchain reorganization for efficient test execution without client restarts.
Source code in src/ethereum_test_fixtures/blockchain.py
562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 |
|
pre_hash: str
instance-attribute
¶
Hash of the shared pre-allocation group this test belongs to.
post_state_diff: Alloc | None = None
class-attribute
instance-attribute
¶
State difference from genesis after test execution (efficiency optimization).
payloads: List[FixtureEngineNewPayload] = Field(..., alias='engineNewPayloads')
class-attribute
instance-attribute
¶
Engine API payloads for blockchain execution.
sync_payload: FixtureEngineNewPayload | None = None
class-attribute
instance-attribute
¶
Optional sync payload for blockchain synchronization.
BlockchainFixture
¶
Bases: BlockchainFixtureCommon
Cross-client specific blockchain test model use in JSON fixtures.
Source code in src/ethereum_test_fixtures/blockchain.py
509 510 511 512 513 514 515 516 517 |
|
BlockchainFixtureCommon
¶
Bases: BaseFixture
Base blockchain test fixture model.
Source code in src/ethereum_test_fixtures/blockchain.py
475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 |
|
config_defaults_for_backwards_compatibility(data)
classmethod
¶
Check if the config field is populated, otherwise use the root-level field values for backwards compatibility.
Source code in src/ethereum_test_fixtures/blockchain.py
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
|
get_fork()
¶
Return fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/blockchain.py
504 505 506 |
|
FixtureCollector
dataclass
¶
Collects all fixtures generated by the test cases.
Source code in src/ethereum_test_fixtures/collector.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
get_fixture_basename(info)
¶
Return basename of the fixture file for a given test case.
Source code in src/ethereum_test_fixtures/collector.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
add_fixture(info, fixture)
¶
Add fixture to the list of fixtures of a given test case.
Source code in src/ethereum_test_fixtures/collector.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
|
dump_fixtures()
¶
Dump all collected fixtures to their respective files.
Source code in src/ethereum_test_fixtures/collector.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
verify_fixture_files(evm_fixture_verification)
¶
Run evm [state|block]test
on each fixture.
Source code in src/ethereum_test_fixtures/collector.py
171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
TestInfo
dataclass
¶
Contains test information from the current node.
Source code in src/ethereum_test_fixtures/collector.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
strip_test_name(name)
classmethod
¶
Remove test prefix from a python test case name.
Source code in src/ethereum_test_fixtures/collector.py
33 34 35 36 37 38 39 40 |
|
get_name_and_parameters()
¶
Convert test name to a tuple containing the test name and test parameters.
Example: test_push0_key_sstore[fork_Shanghai] -> test_push0_key_sstore, fork_Shanghai
Source code in src/ethereum_test_fixtures/collector.py
42 43 44 45 46 47 48 49 50 51 |
|
get_single_test_name(mode='module')
¶
Convert test name to a single test name.
Source code in src/ethereum_test_fixtures/collector.py
53 54 55 56 57 58 59 60 61 62 |
|
get_dump_dir_path(base_dump_dir, filler_path, level='test_parameter')
¶
Path to dump the debug output as defined by the level to dump at.
Source code in src/ethereum_test_fixtures/collector.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
|
get_id()
¶
Return the test id.
Source code in src/ethereum_test_fixtures/collector.py
84 85 86 |
|
get_module_relative_output_dir(filler_path)
¶
Return a directory name for the provided test_module (relative to the base ./tests directory) that can be used for output (within the configured fixtures output path or the base_dump_dir directory).
Example: tests/shanghai/eip3855_push0/test_push0.py -> shanghai/eip3855_push0/test_push0
Source code in src/ethereum_test_fixtures/collector.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
FixtureConsumer
¶
Bases: ABC
Abstract class for verifying Ethereum test fixtures.
Source code in src/ethereum_test_fixtures/consume.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
|
can_consume(fixture_format)
¶
Return whether the fixture format is consumable by this consumer.
Source code in src/ethereum_test_fixtures/consume.py
22 23 24 25 26 27 |
|
consume_fixture(fixture_format, fixture_path, fixture_name=None, debug_output_path=None)
abstractmethod
¶
Test the client with the specified fixture using its direct consumer interface.
Source code in src/ethereum_test_fixtures/consume.py
29 30 31 32 33 34 35 36 37 38 39 40 |
|
EOFFixture
¶
Bases: BaseFixture
Fixture for a single EOFTest.
Source code in src/ethereum_test_fixtures/eof.py
41 42 43 44 45 46 47 48 49 50 51 |
|
get_fork()
¶
Return fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/eof.py
49 50 51 |
|
SharedPreState
¶
Bases: EthereumTestRootModel
Root model mapping pre-state hashes to test groups.
Source code in src/ethereum_test_fixtures/shared_alloc.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
|
__setitem__(key, value)
¶
Set item in root dict.
Source code in src/ethereum_test_fixtures/shared_alloc.py
76 77 78 |
|
from_folder(folder)
classmethod
¶
Create SharedPreState from a folder of pre-allocation files.
Source code in src/ethereum_test_fixtures/shared_alloc.py
80 81 82 83 84 85 86 87 |
|
to_folder(folder)
¶
Save SharedPreState to a folder of pre-allocation files.
Source code in src/ethereum_test_fixtures/shared_alloc.py
89 90 91 92 |
|
__getitem__(item)
¶
Get item from root dict.
Source code in src/ethereum_test_fixtures/shared_alloc.py
94 95 96 |
|
__iter__()
¶
Iterate over root dict.
Source code in src/ethereum_test_fixtures/shared_alloc.py
98 99 100 |
|
__contains__(item)
¶
Check if item in root dict.
Source code in src/ethereum_test_fixtures/shared_alloc.py
102 103 104 |
|
__len__()
¶
Get length of root dict.
Source code in src/ethereum_test_fixtures/shared_alloc.py
106 107 108 |
|
keys()
¶
Get keys from root dict.
Source code in src/ethereum_test_fixtures/shared_alloc.py
110 111 112 |
|
values()
¶
Get values from root dict.
Source code in src/ethereum_test_fixtures/shared_alloc.py
114 115 116 |
|
items()
¶
Get items from root dict.
Source code in src/ethereum_test_fixtures/shared_alloc.py
118 119 120 |
|
SharedPreStateGroup
¶
Bases: CamelModel
Shared pre-state group for tests with identical Environment and fork values.
Groups tests by a hash of their fixture Environment and fork to enable shared pre-allocation optimization.
Source code in src/ethereum_test_fixtures/shared_alloc.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
model_post_init(__context)
¶
Post-init hook to ensure pre is not None.
Source code in src/ethereum_test_fixtures/shared_alloc.py
33 34 35 36 37 38 39 40 |
|
genesis()
¶
Get the genesis header for this group.
Source code in src/ethereum_test_fixtures/shared_alloc.py
42 43 44 45 46 47 48 49 |
|
to_file(file)
¶
Save SharedPreStateGroup to a file.
Source code in src/ethereum_test_fixtures/shared_alloc.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
StateFixture
¶
Bases: BaseFixture
Fixture for a single StateTest.
Source code in src/ethereum_test_fixtures/state.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
get_fork()
¶
Return fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/state.py
104 105 106 107 108 |
|
TransactionFixture
¶
Bases: BaseFixture
Fixture for a single TransactionTest.
Source code in src/ethereum_test_fixtures/transaction.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
|
get_fork()
¶
Return the fork of the fixture as a string.
Source code in src/ethereum_test_fixtures/transaction.py
32 33 34 35 36 |
|