fix tests

This commit is contained in:
Eitan Seri-Levi
2026-05-22 19:31:48 +03:00
parent 97c125505a
commit d35c1cb363
2 changed files with 13 additions and 3 deletions

View File

@@ -59,14 +59,24 @@ impl TestContext {
root: Hash256::ZERO, root: Hash256::ZERO,
}; };
let mut genesis_block = BeaconBlock::empty(&spec);
let genesis_state_root = state let genesis_state_root = state
.update_tree_hash_cache() .update_tree_hash_cache()
.expect("should hash genesis state"); .expect("should hash genesis state");
let mut anchor_header = state.latest_block_header().clone();
if anchor_header.state_root.is_zero() {
anchor_header.state_root = genesis_state_root;
}
let block_root = anchor_header.canonical_root();
// Build a signed block with the correct state root for the snapshot.
let mut genesis_block = BeaconBlock::empty(&spec);
*genesis_block.state_root_mut() = genesis_state_root; *genesis_block.state_root_mut() = genesis_state_root;
let signed_block = SignedBeaconBlock::from_block(genesis_block, Signature::empty()); let signed_block = SignedBeaconBlock::from_block(genesis_block, Signature::empty());
let block_root = signed_block.canonical_root();
let _ = store
.init_anchor_info(Hash256::ZERO, Slot::new(0), Slot::new(0), false)
.expect("should init anchor info");
store store
.put_state(&genesis_state_root, &state) .put_state(&genesis_state_root, &state)
.expect("should persist genesis state"); .expect("should persist genesis state");

View File

@@ -2925,7 +2925,7 @@ impl ApiTester {
.expect("slot index should be in lookahead") as usize; .expect("slot index should be in lookahead") as usize;
let preferences = ProposerPreferences { let preferences = ProposerPreferences {
dependent_root: Hash256::ZERO, dependent_root: head.beacon_block_root,
proposal_slot, proposal_slot,
validator_index: validator_index as u64, validator_index: validator_index as u64,
fee_recipient: Address::repeat_byte(0xaa), fee_recipient: Address::repeat_byte(0xaa),