diff --git a/consensus/proto_array/src/proto_array_fork_choice.rs b/consensus/proto_array/src/proto_array_fork_choice.rs index 5269957dff..f6427ba863 100644 --- a/consensus/proto_array/src/proto_array_fork_choice.rs +++ b/consensus/proto_array/src/proto_array_fork_choice.rs @@ -34,12 +34,12 @@ pub struct VoteTracker { } // Can be deleted once the V28 schema migration is buried. +// Matches the on-disk format from schema v28: current_root, next_root, next_epoch. #[derive(Default, PartialEq, Clone, Encode, Decode)] pub struct VoteTrackerV28 { current_root: Hash256, next_root: Hash256, - current_slot: Slot, - next_slot: Slot, + next_epoch: Epoch, } // This impl is only used upon upgrade from pre-Gloas to Gloas with all pre-Gloas nodes. @@ -49,9 +49,10 @@ impl From for VoteTracker { VoteTracker { current_root: v.current_root, next_root: v.next_root, - current_slot: v.current_slot, - next_slot: v.next_slot, - // TODO(gloas): check that this is correct + // The v28 format stored next_epoch rather than slots. Default to 0 since the + // vote tracker will be updated on the next attestation. + current_slot: Slot::new(0), + next_slot: Slot::new(0), current_payload_present: false, next_payload_present: false, } @@ -61,13 +62,14 @@ impl From for VoteTracker { // This impl is only used upon downgrade from V29 to V28, with exclusively pre-Gloas nodes. impl From for VoteTrackerV28 { fn from(v: VoteTracker) -> Self { - // Drop the payload_present, but this is safe because this is only called on pre-Gloas + // Drop the payload_present fields. This is safe because this is only called on pre-Gloas // nodes. VoteTrackerV28 { current_root: v.current_root, next_root: v.next_root, - current_slot: v.current_slot, - next_slot: v.next_slot, + // The v28 format stored next_epoch. Default to 0 since the vote tracker will be + // updated on the next attestation. + next_epoch: Epoch::new(0), } } }