|
16 | 16 | from execution_testing.base_types import Bytes |
17 | 17 | from execution_testing.fixtures import BlockchainEngineFixture |
18 | 18 | from execution_testing.fixtures.blockchain import ( |
19 | | - FixtureEngineNewPayload, |
20 | 19 | FixtureExecutionPayload, |
21 | 20 | FixtureHeader, |
22 | 21 | ) |
|
29 | 28 | ) |
30 | 29 | from execution_testing.rpc.rpc_types import ( |
31 | 30 | ForkchoiceState, |
32 | | - PayloadAttributes, |
33 | 31 | PayloadStatusEnum, |
34 | 32 | ) |
35 | 33 | from execution_testing.test_types.block_access_list import BlockAccessList |
|
42 | 40 |
|
43 | 41 | logger = get_logger(__name__) |
44 | 42 |
|
45 | | -# Execution-dependent fields that must match exactly between the built |
46 | | -# and expected payloads. Excluded: |
| 43 | +# All FixtureExecutionPayload fields are validated except: |
47 | 44 | # - gas_limit: testing_buildBlockV1 doesn't accept it; the client |
48 | 45 | # picks its own via EIP-1559 (validated separately by range check). |
49 | 46 | # - block_hash: depends on gas_limit, so it will differ too. |
50 | | -_VALIDATED_FIELDS = ( |
51 | | - "state_root", |
52 | | - "receipts_root", |
53 | | - "gas_used", |
54 | | - "logs_bloom", |
55 | | - "base_fee_per_gas", |
56 | | - "blob_gas_used", |
57 | | - "excess_blob_gas", |
58 | | - "block_access_list", |
59 | | - "fee_recipient", |
60 | | - "number", |
61 | | - "timestamp", |
62 | | - "extra_data", |
63 | | - "prev_randao", |
64 | | - "parent_hash", |
65 | | - "transactions", |
66 | | - "withdrawals", |
| 47 | +_VALIDATED_FIELDS = tuple( |
| 48 | + name |
| 49 | + for name in FixtureExecutionPayload.model_fields |
| 50 | + if name not in {"gas_limit", "block_hash"} |
67 | 51 | ) |
68 | 52 |
|
69 | 53 |
|
@@ -114,23 +98,6 @@ def _format_block_access_list_diff( |
114 | 98 | ) |
115 | 99 |
|
116 | 100 |
|
117 | | -def _payload_attributes( |
118 | | - payload: FixtureEngineNewPayload, |
119 | | -) -> PayloadAttributes: |
120 | | - """Extract PayloadAttributes from a fixture payload.""" |
121 | | - execution_payload = payload.params[0] |
122 | | - parent_beacon_block_root = ( |
123 | | - payload.params[2] if len(payload.params) >= 3 else None |
124 | | - ) |
125 | | - return PayloadAttributes( |
126 | | - timestamp=execution_payload.timestamp, |
127 | | - prev_randao=execution_payload.prev_randao, |
128 | | - suggested_fee_recipient=execution_payload.fee_recipient, |
129 | | - withdrawals=execution_payload.withdrawals, |
130 | | - parent_beacon_block_root=parent_beacon_block_root, |
131 | | - ) |
132 | | - |
133 | | - |
134 | 101 | def _validate_gas_limit( |
135 | 102 | built: FixtureExecutionPayload, |
136 | 103 | parent_gas_limit: int, |
@@ -257,10 +224,9 @@ def test_blockchain_via_build( |
257 | 224 | with total_build_timing.time(f"Block {i + 1}") as block_timing: |
258 | 225 | # 1. Build the block |
259 | 226 | with block_timing.time("testing_buildBlockV1"): |
260 | | - attributes = _payload_attributes(payload) |
261 | 227 | build_response = testing_rpc.build_block( |
262 | 228 | parent_block_hash=(expected_payload.parent_hash), |
263 | | - payload_attributes=attributes, |
| 229 | + payload_attributes=payload.get_payload_attributes(), |
264 | 230 | transactions=(expected_payload.transactions), |
265 | 231 | extra_data=expected_payload.extra_data, |
266 | 232 | ) |
|
0 commit comments