All tests bar invalid_message passing, changes might be dubious

This commit is contained in:
Michael Sproul
2026-05-13 09:26:27 +10:00
parent e9ae5babc8
commit 715d6bfa0c
6 changed files with 230 additions and 103 deletions

View File

@@ -338,7 +338,14 @@ impl ForkChoiceTestDefinition {
attestation_slot,
} => {
fork_choice
.process_attestation(validator_index, block_root, attestation_slot, false)
.process_attestation(
validator_index,
block_root,
attestation_slot,
false,
false,
MainnetEthSpec::slots_per_epoch(),
)
.unwrap_or_else(|_| {
panic!(
"process_attestation op at index {} returned error",
@@ -359,6 +366,8 @@ impl ForkChoiceTestDefinition {
block_root,
attestation_slot,
payload_present,
true,
MainnetEthSpec::slots_per_epoch(),
)
.unwrap_or_else(|_| {
panic!(

View File

@@ -594,10 +594,18 @@ impl ProtoArrayForkChoice {
block_root: Hash256,
attestation_slot: Slot,
payload_present: bool,
update_by_slot: bool,
slots_per_epoch: u64,
) -> Result<(), String> {
let vote = self.votes.get_mut(validator_index);
if attestation_slot > vote.next_slot || *vote == VoteTracker::default() {
let is_newer_vote = if update_by_slot {
attestation_slot > vote.next_slot
} else {
attestation_slot.epoch(slots_per_epoch) > vote.next_slot.epoch(slots_per_epoch)
};
if is_newer_vote || *vote == VoteTracker::default() {
vote.next_root = block_root;
vote.next_slot = attestation_slot;
vote.next_payload_present = payload_present;