mirror of
https://github.com/sigp/lighthouse.git
synced 2026-06-10 01:26:44 +00:00
Fix tests
This commit is contained in:
@@ -260,10 +260,11 @@ fn make_signed_preferences(
|
|||||||
validator_index: u64,
|
validator_index: u64,
|
||||||
fee_recipient: Address,
|
fee_recipient: Address,
|
||||||
target_gas_limit: u64,
|
target_gas_limit: u64,
|
||||||
|
dependent_root: Hash256,
|
||||||
) -> Arc<SignedProposerPreferences> {
|
) -> Arc<SignedProposerPreferences> {
|
||||||
Arc::new(SignedProposerPreferences {
|
Arc::new(SignedProposerPreferences {
|
||||||
message: ProposerPreferences {
|
message: ProposerPreferences {
|
||||||
dependent_root: Hash256::ZERO,
|
dependent_root,
|
||||||
proposal_slot,
|
proposal_slot,
|
||||||
validator_index,
|
validator_index,
|
||||||
fee_recipient,
|
fee_recipient,
|
||||||
@@ -274,8 +275,25 @@ fn make_signed_preferences(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn seed_preferences(ctx: &TestContext, slot: Slot, fee_recipient: Address, gas_limit: u64) {
|
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 {
|
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);
|
ctx.preferences_cache.insert_preferences(prefs);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user