@@ -61,8 +61,11 @@ class StateTransitionTest(BaseConsensusFixture):
6161 """
6262 The filled Blocks, processed through the specs.
6363
64- This is a private attribute not part of the model schema. Tests cannot set
65- this. The framework populates it during make_fixture().
64+ This is a private attribute not part of the model schema.
65+
66+ Tests cannot set this.
67+
68+ The framework populates it during make_fixture().
6669 """
6770
6871 post : StateExpectation | None = None
@@ -215,11 +218,11 @@ def _build_block_from_spec(self, spec: BlockSpec, state: State) -> tuple[Block,
215218 if not spec .skip_slot_processing :
216219 temp_state = state .process_slots (spec .slot )
217220
218- # Use provided parent_root or compute it
221+ # Use provided parent root or compute it
219222 if spec .parent_root is not None :
220223 parent_root = spec .parent_root
221224 else :
222- source_state = temp_state if temp_state is not None else state
225+ source_state = temp_state or state
223226 parent_root = hash_tree_root (source_state .latest_block_header )
224227
225228 # Extract attestations from body if provided
@@ -238,16 +241,15 @@ def _build_block_from_spec(self, spec: BlockSpec, state: State) -> tuple[Block,
238241 )
239242 return block , None
240243
241- temp_block = Block (
242- slot = spec .slot ,
243- proposer_index = proposer_index ,
244- parent_root = parent_root ,
245- state_root = Bytes32 .zero (),
246- body = spec .body or BlockBody (attestations = aggregated_attestations ),
247- )
248-
244+ # For invalid tests, return incomplete block without processing
249245 if self .expect_exception is not None or spec .skip_slot_processing :
250- return temp_block , None
246+ return Block (
247+ slot = spec .slot ,
248+ proposer_index = proposer_index ,
249+ parent_root = parent_root ,
250+ state_root = Bytes32 .zero (),
251+ body = spec .body or BlockBody (attestations = aggregated_attestations ),
252+ ), None
251253
252254 # Convert aggregated attestations to plain attestations to build block
253255 plain_attestations = [
0 commit comments