mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-10 09:37:38 +00:00
Fix tests
This commit is contained in:
@@ -260,10 +260,11 @@ fn make_signed_preferences(
|
||||
validator_index: u64,
|
||||
fee_recipient: Address,
|
||||
target_gas_limit: u64,
|
||||
dependent_root: Hash256,
|
||||
) -> Arc<SignedProposerPreferences> {
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user