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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
//! The run reservation: `KairosRun`, the receipt of one bulk mint.
//!
//! A run mint ([`Clock::now_run`](super::Clock::now_run) /
//! [`LocalClock::now_run`](super::LocalClock::now_run)) reserves `len`
//! consecutive send positions in one commitment, and this type is what it
//! hands back: the first stamp plus the length, with every later member
//! *derived* by the fold's own frozen-reading send step (the successor rule
//! the snapshot codec shares as `rank_successor`, proven equal to the fold by
//! the S197 Kani harness). Nothing here is a second time semantics: a member
//! read is arithmetic over the reserved interval, and the clock has already
//! committed past the whole run, so members never collide with later mints.
//!
//! Construction is crate-private on purpose: within this crate the only
//! sources are the two minting shells, so holding a `KairosRun` is holding a
//! genuine reservation (the witness discipline the crate's `Cut` and
//! `Retired` types set). It is *affine*: neither `Copy` nor `Clone`, and the
//! consuming weave takes it by value, so a reservation is spent at most
//! once. Re-weaving one run under other identities would forge rank ties an
//! honest mint never produces, and the type makes that a move error rather
//! than a discipline. (`Kairos::new` being public means fabricated *stamps*
//! are always possible; the run type simply never launders a fabricated
//! *interval* as a reservation.)
use Kairos;
use fold;
/// A contiguous reservation of rank stamps: the first stamp and how many
/// consecutive send positions were reserved from it, all sharing one station
/// and one kairotic tag.
///
/// Member `i` (zero-based) is the first stamp advanced `i` send steps: the
/// logical component steps by one, rolling into the next physical unit at
/// the sentinel, exactly the succession an equal number of individual mints
/// against a frozen reading would have committed. Members therefore strictly
/// ascend and chain under the `metis` chain law (anchor-After, equal
/// kairotic, equal station, successor rank), which is what lets a woven run
/// coalesce by birthright in the identity plane, the snapshot codec, and the
/// order thread.
///
/// The strict-ascent guarantee shares the clock's documented saturation
/// edge: a run whose carry would cross the `u64::MAX` physical ceiling pins
/// there (never wraps), and domination past the pin is arithmetically
/// impossible. Every proof carries the same precondition the single mint's
/// proofs do.
///
/// Affine on purpose (no `Clone`, no `Copy`): the consuming weave
/// ([`Rhapsody::weave_run`](crate::metis::Rhapsody::weave_run)) takes the
/// reservation by value, so spending it twice is a compile error. A refused
/// weave consumes the reservation too; mint another (the clock only skips
/// positions, which is always lawful).
// A reservation is never empty (`len` is at least one by construction), so
// there is deliberately no `is_empty` beside `len`.
/// The member iterator of a [`KairosRun`]: exactly `len` stamps, in order.