1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! `Checkpoint` — the FFG `(epoch, root)` vote pair.
//!
//! Traces to: [SPEC.md §3.3](../../docs/resources/SPEC.md), catalogue row
//! [DSL-003](../../docs/requirements/domains/evidence/specs/DSL-003.md).
//!
//! # Role
//!
//! A `Checkpoint` pins a vote to a specific epoch and to a specific beacon
//! block root at that epoch. Consumed by:
//!
//! - [`AttestationData::source`](super::attestation_data::AttestationData) —
//! the justified checkpoint the attester is voting from (DSL-004).
//! - [`AttestationData::target`](super::attestation_data::AttestationData) —
//! the checkpoint the attester is voting for (DSL-004).
//! - [`JustificationView`] trait (DSL-143) — the
//! `current_justified_checkpoint` / `previous_justified_checkpoint` /
//! `finalized_checkpoint` accessors.
//!
//! # Determinism + leafness
//!
//! `Checkpoint` has no nested types beyond the 32-byte root. Every derive
//! (`Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash`) is
//! defaulted. The type is `Copy` so it can be passed by value across every
//! downstream API without lifetime or borrow friction.
use Bytes32;
use ;
/// A `(epoch, root)` FFG vote pair.
///
/// Per [SPEC §3.3](../../docs/resources/SPEC.md), `Checkpoint` is the
/// primitive finality-gadget vote: the attester's source and target votes
/// both carry an epoch number and a beacon block root that pins the vote
/// to a specific history.
///
/// # Fields
///
/// - `epoch` — the L2 epoch number of the vote.
/// - `root` — the canonical beacon block root at the end of that epoch's
/// canonical chain (the target-root for target votes; the last-justified
/// root for source votes).
///
/// # Equality + hashing
///
/// `Checkpoint`s are `PartialEq` iff both `epoch` and `root` match; `Hash`
/// output is consistent with `Eq` per the Rust stdlib contract. This enables
/// use as a `HashMap`/`HashSet` key in consumer crates (e.g. a
/// justification-graph crate).
///
/// # Serde
///
/// Both `bincode` and `serde_json` round-trip byte-exactly; see
/// `tests/dsl_003_checkpoint_roundtrip_test.rs` for the full suite.