diff --git a/beacon_node/beacon_chain/src/payload_bid_verification/tests.rs b/beacon_node/beacon_chain/src/payload_bid_verification/tests.rs index ccdf64d41d..17b8aacdb7 100644 --- a/beacon_node/beacon_chain/src/payload_bid_verification/tests.rs +++ b/beacon_node/beacon_chain/src/payload_bid_verification/tests.rs @@ -260,10 +260,11 @@ fn make_signed_preferences( validator_index: u64, fee_recipient: Address, target_gas_limit: u64, + dependent_root: Hash256, ) -> Arc { Arc::new(SignedProposerPreferences { message: ProposerPreferences { - dependent_root: Hash256::ZERO, + dependent_root, proposal_slot, validator_index, fee_recipient, @@ -274,8 +275,25 @@ fn make_signed_preferences( } fn seed_preferences(ctx: &TestContext, slot: Slot, fee_recipient: Address, gas_limit: u64) { + // Key the preferences by the same dependent root that gossip verification will compute from + // the head state, otherwise the lookup misses and verification returns `NoProposerPreferences`. + let cached_head = ctx.canonical_head.cached_head(); + let head_state = &cached_head.snapshot.beacon_state; + let dependent_root = head_state + .proposer_shuffling_decision_root_at_epoch( + slot.epoch(E::slots_per_epoch()), + cached_head.head_block_root(), + &ctx.spec, + ) + .expect("should compute proposer shuffling decision root"); let prefs = GossipVerifiedProposerPreferences { - signed_preferences: make_signed_preferences(slot, 0, fee_recipient, gas_limit), + signed_preferences: make_signed_preferences( + slot, + 0, + fee_recipient, + gas_limit, + dependent_root, + ), }; ctx.preferences_cache.insert_preferences(prefs); }