Ethereum Test Fixtures package¶
Ethereum test fixture format definitions.
BaseFixture
¶
Bases: CamelModel
Represents a base Ethereum test fixture of any type.
Source code in packages/testing/src/execution_testing/fixtures/base.py
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 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 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 | |
output_base_dir_name()
classmethod
¶
Return name of the subdirectory where this type of fixture should be dumped to.
Source code in packages/testing/src/execution_testing/fixtures/base.py
95 96 97 98 99 100 101 | |
__pydantic_init_subclass__(**kwargs)
classmethod
¶
Register all subclasses of BaseFixture with a fixture format name set as possible fixture formats.
Source code in packages/testing/src/execution_testing/fixtures/base.py
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 | |
json_dict
cached
property
¶
Returns the JSON representation of the fixture.
hash
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 packages/testing/src/execution_testing/fixtures/base.py
156 157 158 159 160 161 162 | |
model_post_init(__context)
¶
Model post-init to assert that the custom pre-allocation was provided and the default was not used.
Source code in packages/testing/src/execution_testing/fixtures/base.py
164 165 166 167 168 169 170 | |
fill_info(t8n_version, test_case_description, fixture_source_url, ref_spec, _info_metadata, metadata=None)
¶
Fill the info field for this fixture.
Source code in packages/testing/src/execution_testing/fixtures/base.py
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |
get_fork()
¶
Return fork of the fixture as a string.
Source code in packages/testing/src/execution_testing/fixtures/base.py
194 195 196 | |
format_class()
classmethod
¶
Get the fixture format.
Source code in packages/testing/src/execution_testing/fixtures/base.py
198 199 200 201 | |
format_id()
classmethod
¶
Get string used as identifier for this format.
Source code in packages/testing/src/execution_testing/fixtures/base.py
203 204 205 206 | |
is_variant(variant)
classmethod
¶
Return whether this format is the named variant.
A plain format never is: only a label can name a variant.
Source code in packages/testing/src/execution_testing/fixtures/base.py
208 209 210 211 212 213 214 215 216 | |
with_label_suffix(suffix, description=None, *, transition_tool_cache_key=None, variant=None)
classmethod
¶
Return this format labeled <format_id>_<suffix>.
Use this instead of building a LabeledFixtureFormat by hand when a
spec type re-labels the formats of another one: the label is derived
from format_id(), so a format that already carries a label derives a
distinct label per label instead of collapsing them all onto its
format name.
transition_tool_cache_key defaults to this format's key, which is
what a label that only renames the same fixture wants. A suffix that
asks the transition tool for something different must pass its own
key, or an empty string to opt out of caching.
variant names what the label asks its spec type to fill differently,
for that spec type to query with is_variant() rather than comparing
formats.
Source code in packages/testing/src/execution_testing/fixtures/base.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
marks(*, transition_tool_cache_key=None)
classmethod
¶
Get list of pytest marks that need to be added to a test produced with this fixture format.
transition_tool_cache_key overrides the format's own key.
Source code in packages/testing/src/execution_testing/fixtures/base.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
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 packages/testing/src/execution_testing/fixtures/base.py
280 281 282 283 284 285 286 287 288 | |
discard_fixture_format_by_marks(fork, markers)
classmethod
¶
Discard a fixture format from filling if the appropriate marker is used.
Source code in packages/testing/src/execution_testing/fixtures/base.py
290 291 292 293 294 295 296 297 298 299 300 301 | |
FixtureFillingPhase
¶
Bases: Enum
Execution phase for fixture generation.
Source code in packages/testing/src/execution_testing/fixtures/base.py
60 61 62 63 64 65 66 | |
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 packages/testing/src/execution_testing/fixtures/base.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 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 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 | |
__init__(fixture_format, label, description, *, transition_tool_cache_key=None, variant=None)
¶
Initialize the fixture format with a custom label.
transition_tool_cache_key defaults to the wrapped format's key. A
label that asks the transition tool for something different must set
its own key, or an empty string to opt out of caching, since labels
sharing a key also share cached output.
variant names what this label asks its spec type to fill
differently, and defaults to the wrapped label's variant.
Wrapping a label rather than a plain format keeps what that inner label decided: its variant, its cache key and its fork/marker vetoes still apply, so re-labeling never silently reverts them to the plain format's.
Source code in packages/testing/src/execution_testing/fixtures/base.py
321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
format_name
property
¶
Get the filling format name.
format_phases
property
¶
Get the filling format phases where it should be included.
format_class()
¶
Get the format without label.
Source code in packages/testing/src/execution_testing/fixtures/base.py
369 370 371 | |
supports_fork(fork)
¶
Return whether this label can be filled for the given fork.
Defers to the label this one was derived from, or to the wrapped format. A label whose fixture only makes sense for some forks overrides this.
Source code in packages/testing/src/execution_testing/fixtures/base.py
373 374 375 376 377 378 379 380 381 382 383 | |
discard_fixture_format_by_marks(fork, markers)
¶
Discard this label from filling if the appropriate marker is used.
Defers to the label this one was derived from, or to the wrapped format, so a label can veto itself without affecting the other labels of the same format.
Source code in packages/testing/src/execution_testing/fixtures/base.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | |
format_id()
¶
Get string used as identifier for this format.
Source code in packages/testing/src/execution_testing/fixtures/base.py
401 402 403 | |
variant
property
¶
Get what this label asks its spec type to fill differently.
Falls back to the variant of the label this one was derived from, so a variant survives being re-labeled.
is_variant(variant)
¶
Return whether this label is the named variant.
A spec type asks this instead of comparing the format it was handed against the label it declared: comparing cannot tell a variant from the plain format it wraps, and it stops matching as soon as another spec type re-labels the variant.
Source code in packages/testing/src/execution_testing/fixtures/base.py
419 420 421 422 423 424 425 426 427 428 | |
labels()
¶
Get this label and every label it was derived from, outermost last.
Source code in packages/testing/src/execution_testing/fixtures/base.py
430 431 432 433 434 435 436 | |
with_label_suffix(suffix, description=None, *, transition_tool_cache_key=None, variant=None)
¶
Return this label re-labeled as <label>_<suffix>.
The derived label keeps this label's fork/marker vetoes, so every label of one format derives its own distinct label rather than all of them collapsing onto the format name.
transition_tool_cache_key defaults to this label's key, so a label
that opted out of caching stays opted out. A suffix that asks the
transition tool for something different must pass its own key.
variant defaults to this label's variant, so re-labeling a variant
keeps filling that variant.
Source code in packages/testing/src/execution_testing/fixtures/base.py
438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
marks()
¶
Get list of pytest marks that need to be added to a test produced with this fixture format.
Every label this one was derived from is marked too, so selecting a label also selects the labels another spec type derived from it.
Source code in packages/testing/src/execution_testing/fixtures/base.py
470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | |
transition_tool_cache_key
property
¶
Get the transition tool cache key.
Falls back to the key of the label this one was derived from, and then to the wrapped format's, so a label that opted out of caching does not opt back in when it is re-labeled.
__eq__(other)
¶
Check if two labeled fixture formats are equal.
Two labeled formats are equal only when they share both format and label, so one format can carry more than one label.
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 packages/testing/src/execution_testing/fixtures/base.py
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 | |
__hash__()
¶
Return the hash of the wrapped format.
A labeled format compares equal to the plain format it wraps, so both must hash alike. Two labels of one format collide, which is allowed since they no longer compare equal.
Source code in packages/testing/src/execution_testing/fixtures/base.py
522 523 524 525 526 527 528 529 530 | |
strip_fixture_format_from_node(item)
¶
Remove fixture format suffix from a test nodeid.
Used for cache keys and xdist grouping to ensure related fixture formats (e.g., blockchain_test and blockchain_test_engine) share the same key.
Example
'test.py::test[fork_Osaka-state_test]' -> 'test.py::test[fork_Osaka]'
Source code in packages/testing/src/execution_testing/fixtures/base.py
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 | |
BlockchainEngineFixture
¶
Bases: BlockchainEngineFixtureCommon
Engine specific test fixture information.
Source code in packages/testing/src/execution_testing/fixtures/blockchain.py
981 982 983 984 985 986 987 988 989 990 991 992 993 994 | |
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.
Source code in packages/testing/src/execution_testing/fixtures/blockchain.py
952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 | |
get_fork()
¶
Return fixture's Fork.
Source code in packages/testing/src/execution_testing/fixtures/blockchain.py
967 968 969 | |
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 packages/testing/src/execution_testing/fixtures/blockchain.py
971 972 973 974 975 976 977 978 | |
BlockchainEngineStatefulFixture
¶
Bases: BlockchainEngineFixtureCommon
Engine fixture for snapshot-based stateful testing.
Instead of embedding pre-allocation or referencing a computed group, this fixture references an external snapshot that the consumer must pre-load. Setup payloads deploy contracts and seed accounts on top of the snapshot before the actual test payloads execute.
Source code in packages/testing/src/execution_testing/fixtures/blockchain.py
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 | |
BlockchainEngineSyncFixture
¶
Bases: BlockchainEngineFixture
Engine Sync specific test fixture information.
This fixture format is specifically designed for sync testing where: - The client under test receives all payloads - A sync client attempts to sync from the client under test - Both client types are parametrized from hive client config
Source code in packages/testing/src/execution_testing/fixtures/blockchain.py
1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | |
discard_fixture_format_by_marks(fork, markers)
classmethod
¶
Discard the fixture format based on the provided markers.
Source code in packages/testing/src/execution_testing/fixtures/blockchain.py
1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 | |
BlockchainEngineXFixture
¶
Bases: BlockchainEngineFixtureCommon
Engine X specific test fixture information.
Uses pre-allocation groups (and a single client instance) for efficient test execution without client restarts.
Source code in packages/testing/src/execution_testing/fixtures/blockchain.py
997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 | |
pre_hash
instance-attribute
¶
Hash of the pre-allocation group this test belongs to.
post_state_diff
instance-attribute
¶
State difference from genesis after test execution (efficiency optimization).
payloads = Field(..., alias='engineNewPayloads')
class-attribute
instance-attribute
¶
Engine API payloads for blockchain execution.
BlockchainFixture
¶
Bases: BlockchainFixtureCommon
Cross-client specific blockchain test model use in JSON fixtures.
Source code in packages/testing/src/execution_testing/fixtures/blockchain.py
938 939 940 941 942 943 944 945 946 947 948 949 | |
BlockchainFixtureCommon
¶
Bases: BaseFixture
Base blockchain test fixture model.
Source code in packages/testing/src/execution_testing/fixtures/blockchain.py
903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 | |
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 packages/testing/src/execution_testing/fixtures/blockchain.py
916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 | |
get_fork()
¶
Return fork of the fixture as a string.
Source code in packages/testing/src/execution_testing/fixtures/blockchain.py
933 934 935 | |
FixtureCollector
dataclass
¶
Collects all fixtures generated by the test cases.
Source code in packages/testing/src/execution_testing/fixtures/collector.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
get_fixture_basename(info)
¶
Return basename of the fixture file for a given test case.
Source code in packages/testing/src/execution_testing/fixtures/collector.py
234 235 236 237 238 239 240 241 242 243 244 245 246 | |
add_fixture(info, fixture, output_subdir=None)
¶
Add fixture and immediately stream to partial JSONL file.
Source code in packages/testing/src/execution_testing/fixtures/collector.py
260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | |
close_streaming_files()
¶
Close all open streaming file handles.
Source code in packages/testing/src/execution_testing/fixtures/collector.py
363 364 365 366 367 368 369 370 371 | |
dump_fixtures()
¶
Dump collected fixtures (only used for stdout mode).
Source code in packages/testing/src/execution_testing/fixtures/collector.py
373 374 375 376 377 378 379 380 381 382 | |
verify_fixture_files(evm_fixture_verification)
¶
Run evm [state|block]test on each fixture.
For streaming mode, uses lightweight tracking of fixture paths/formats rather than keeping full fixtures in memory.
Source code in packages/testing/src/execution_testing/fixtures/collector.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
TestInfo
dataclass
¶
Contains test information from the current node.
Source code in packages/testing/src/execution_testing/fixtures/collector.py
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 203 204 205 | |
strip_test_name(name)
classmethod
¶
Remove test prefix from a python test case name.
Source code in packages/testing/src/execution_testing/fixtures/collector.py
125 126 127 128 129 130 131 132 | |
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 packages/testing/src/execution_testing/fixtures/collector.py
134 135 136 137 138 139 140 141 142 143 | |
get_single_test_name(mode='module')
¶
Convert test name to a single test name.
Source code in packages/testing/src/execution_testing/fixtures/collector.py
145 146 147 148 149 150 151 152 153 154 155 156 | |
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 packages/testing/src/execution_testing/fixtures/collector.py
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 | |
get_id()
¶
Return the test id.
Source code in packages/testing/src/execution_testing/fixtures/collector.py
185 186 187 | |
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 packages/testing/src/execution_testing/fixtures/collector.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
merge_partial_fixture_files(output_dir)
¶
Merge all partial fixture JSONL files into final JSON fixture files.
Called at session end after all workers have written their partials. Each partial file contains JSONL lines: {"k": fixture_id, "v": json_str}
Processes one target file at a time, reading its partials sequentially into a dict. Memory = O(entries per target), freed before next target.
Source code in packages/testing/src/execution_testing/fixtures/collector.py
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 104 105 106 | |
FixtureConsumer
¶
Bases: ABC
Abstract class for verifying Ethereum test fixtures.
Source code in packages/testing/src/execution_testing/fixtures/consume.py
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 | |
can_consume(fixture_format)
¶
Return whether the fixture format is consumable by this consumer.
Source code in packages/testing/src/execution_testing/fixtures/consume.py
40 41 42 43 44 45 | |
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 packages/testing/src/execution_testing/fixtures/consume.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |
AccountCheck
¶
Bases: CamelModel
Capture which fields are verified for a single account.
A None value means the field is not checked (it was not
explicitly set by the test author). A present value records the
expected value that check_alloc would assert against.
Source code in packages/testing/src/execution_testing/fixtures/post_verifications.py
18 19 20 21 22 23 24 25 26 27 28 29 30 | |
PostVerifications
¶
Bases: CamelModel
Record every post-state check performed during a fill session.
Accounts mapped to None represent should-not-exist checks.
Source code in packages/testing/src/execution_testing/fixtures/post_verifications.py
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 | |
from_alloc(alloc)
classmethod
¶
Derive verification checks from an expected post Alloc.
Walk each address/account pair and inspect
model_fields_set to determine which fields will actually
be compared by Account.check_alloc.
Source code in packages/testing/src/execution_testing/fixtures/post_verifications.py
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 | |
PreAllocGroup
¶
Bases: PreAllocGroupCommon
Pre-allocation group for tests with identical Environment and fork values.
Grouping is still keyed on the tests' fixture Environment and fork, but
that Environment lives in phase 1 (PreAllocGroupBuilder) only: what
reaches the final group is the genesis header derived from it.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 | |
model_post_init(__context)
¶
Model post init method to cache the state root in GroupPreAlloc.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
693 694 695 696 697 698 699 | |
hash()
¶
Return a Hash based on the canonical JSON of the model.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
701 702 703 704 705 706 707 708 709 | |
PreAllocGroupBuilder
¶
Bases: PreAllocGroupCommon
Pre-allocation group temporary builder.
This file must NOT be saved as the final output of the filling process.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
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 147 148 149 150 151 152 153 154 155 156 | |
model_post_init(__context)
¶
Seed the pre-alloc's commitment scheme from its genesis fork.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
88 89 90 91 92 93 94 95 | |
get_pre_account_count()
¶
Return the amount of accounts the pre-allocation group holds.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
97 98 99 | |
get_test_count()
¶
Return the amount of tests that use this pre-allocation group.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
101 102 103 | |
calculate_genesis()
¶
Get the genesis header for this group.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
105 106 107 108 109 110 111 | |
add_test_alloc(test_id, new_pre)
¶
Adds a pre to this builder's pre.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
113 114 115 116 117 118 119 120 121 | |
build()
¶
Build the pre-alloc group.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
123 124 125 126 127 128 129 130 131 132 133 134 135 | |
to_partial_file(file, worker_id=None)
¶
Save PreAllocGroupBuilder to a partial file (no locking).
Each worker writes its own partial file, which are merged at session end by merge_partial_group_files(). This eliminates lock contention that caused workers to take 30-180+ seconds each.
Saves the builder format (without genesis/state_root) to avoid
expensive state root computation during Phase 1. State root is
computed once when the build method is used to construct the final
PreAllocGroup.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
PreAllocGroupBuilders
¶
Bases: EthereumTestRootModel
Root model mapping pre-allocation group builders to group hashes.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | |
to_folder(folder, worker_id=None)
¶
Save PreAllocGroups to a folder as partial files.
Each worker writes its own partial files (no lock contention). Call merge_partial_group_files() on master after all workers finish.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
529 530 531 532 533 534 535 536 537 538 | |
add_test_pre(*, pre_alloc_hash, test_id, fork, chain_id, environment, pre, group_salt=None)
¶
Adds a single test to the appropriate group based on the hash.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | |
PreAllocGroups
¶
Bases: EthereumTestRootModel
Root model mapping pre-allocation group hashes to test groups.
If lazy_load is True, the groups are not loaded from the folder until they are accessed.
Iterating will fail if lazy_load is True.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | |
__setitem__(key, value)
¶
Set item in root dict.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
728 729 730 731 732 733 | |
from_folder(folder, *, lazy_load=False)
classmethod
¶
Create PreAllocGroups from a folder of pre-allocation files.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | |
__getitem__(item)
¶
Get item from root dict.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
754 755 756 757 758 759 760 761 762 763 764 765 766 767 | |
__iter__()
¶
Iterate over root dict.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
769 770 771 | |
__contains__(item)
¶
Check if item in root dict.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
773 774 775 | |
__len__()
¶
Get length of root dict.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
777 778 779 | |
keys()
¶
Get keys from root dict.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
781 782 783 | |
values()
¶
Get values from root dict.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
785 786 787 788 789 | |
items()
¶
Get items from root dict.
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
791 792 793 794 795 796 797 | |
pack_pre_alloc_groups(folder)
¶
Merge fine-grained pre-allocation groups into fewer, larger ones.
Phase 1 keys every test's group on the exact content of any hard-coded
accounts it sets (modified_accounts_salt), so a test that pins accounts
to fixed addresses lands in its own group even when it could safely share a
genesis with others. This is conservative: it splits far more than the
genuine address conflicts require. groupstats shows this dominates the
group count, with most groups a single test.
This pass reclaims that while preserving each test's isolation. Groups
are bucketed by everything a shared genesis requires (fork, chain id, and
environment), by the explicit pre_alloc_group marker salt (so a test
that demands its own genesis keeps it), and then by their
reserved-address footprint (see _reserved_addresses), so two tests only
share a genesis when they agree on every precompile and shared address.
Within a bucket the reserved accounts are identical and the remaining
(test-private) addresses are unique to one group, so the union is always
conflict-free and the whole bucket collapses to a single group.
The packing is deterministic: buckets are processed in sorted order and each group's id is derived from its sorted test ids, so a re-fill of the same tests reproduces the same groups.
Called on the master process after merge_partial_group_files, replacing
the fine-grained files in folder with the packed ones. Also writes a
test id -> group index file (see read_test_group_index), so phase 2
workers can find a test's group without scanning every group file; each
entry records the test's fine-grained phase 1 hash as a fingerprint so a
stale folder is detected (see packed_group_hash_for_test).
Source code in packages/testing/src/execution_testing/fixtures/pre_alloc_groups.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 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 507 508 509 510 511 512 513 514 515 516 517 518 519 | |
StateFixture
¶
Bases: BaseFixture
Fixture for a single StateTest.
Source code in packages/testing/src/execution_testing/fixtures/state.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
get_fork()
¶
Return fork of the fixture as a string.
Source code in packages/testing/src/execution_testing/fixtures/state.py
130 131 132 133 134 | |
TransactionFixture
¶
Bases: BaseFixture
Fixture for a single TransactionTest.
Source code in packages/testing/src/execution_testing/fixtures/transaction.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | |
get_fork()
¶
Return the fork of the fixture as a string.
Source code in packages/testing/src/execution_testing/fixtures/transaction.py
40 41 42 43 44 45 46 | |