@@ -6,8 +6,6 @@ use vprogs_core_atomics::AtomicAsyncLatch;
66use vprogs_core_macros:: smart_pointer;
77use vprogs_l1_types:: SettlementInfo ;
88
9- use crate :: SettlementArtifact ;
10-
119/// The L1 block span a bundle proves over.
1210#[ derive( Clone , Copy ) ]
1311pub struct BundleBlocks {
@@ -17,26 +15,25 @@ pub struct BundleBlocks {
1715 pub block_prove_to : Hash ,
1816}
1917
20- /// A bundle the aggregate prover has formed and published to the settlement queue.
18+ /// A formed bundle of proved batches, published to a settlement consumer before its artifact
19+ /// exists.
2120///
22- /// Mirrors [`ScheduledBatch`](vprogs_scheduling_scheduler::ScheduledBatch)'s artifact mechanism:
23- /// the handle is pushed onto the settlement queue *before* its proof exists, so a consumer can pop
24- /// it, read the immediate metadata (e.g. reconcile pacing against `batches`), and then await the
25- /// proved [`SettlementArtifact`]. The aggregate worker fills the artifact via
21+ /// Mirrors [`ScheduledBatch`](crate::ScheduledBatch)'s artifact mechanism: the handle is published
22+ /// *before* its artifact exists, so a consumer can pop it, read the immediate metadata (e.g.
23+ /// reconcile pacing against `batches`), and then await the proved artifact `A`, filled via
2624/// [`publish_artifact`](Self::publish_artifact) once proving completes.
2725///
2826/// A no-op bundle (all-empty prefix, or one that advanced no state) carries no artifact: it is
2927/// constructed already resolved (latch open, artifact `None`) and the consumer skips it. Every
3028/// formed bundle still produces exactly one handle, so a consumer that paces itself against proving
3129/// can account for all submitted batches by summing each handle's `batches`.
3230#[ smart_pointer]
33- pub struct ScheduledBundle < R > {
31+ pub struct ScheduledBundle < A > {
3432 /// Number of scheduled batches this bundle consumed (including empty batches in the ready
3533 /// prefix). Readable immediately, before the artifact is published.
3634 batches : usize ,
37- /// The bundle's first checkpoint index (bundle-start). With `from_block` it is the
38- /// bundle-start coordinate that keys the aggregator receipt's prefix in the proof-receipt
39- /// store. Immediate.
35+ /// The bundle's first checkpoint index (bundle-start). With `from_block`, the coordinate that
36+ /// keys the bundle's aggregate receipt. Immediate.
4037 checkpoint_index : u64 ,
4138 /// L1 block at the bundle's first checkpoint (the block it proves *from*), pairing with
4239 /// `block_prove_to`. Together with `checkpoint_index` it keys the aggregator receipt and keeps
@@ -45,19 +42,18 @@ pub struct ScheduledBundle<R> {
4542 /// L1 block the bundle proves through (its final block). Immediate, for logging / pacing.
4643 block_prove_to : Hash ,
4744 /// Most-recent covenant settlement visible on chain as of the bundle's final block, or `None`
48- /// until one lands. Lets the settler skip a bundle an external settlement already covered: the
49- /// same redundancy the aggregate prover applies when forming bundles. Immediate.
45+ /// until one lands. Immediate.
5046 latest_settlement : Option < SettlementInfo > ,
51- /// The proved settlement , filled via [`publish_artifact`](Self::publish_artifact). `None` for
52- /// a no-op bundle that advanced no state.
53- settlement : ArcSwapOption < SettlementArtifact < R > > ,
47+ /// The proved artifact , filled via [`publish_artifact`](Self::publish_artifact). `None` for a
48+ /// no-op bundle that advanced no state.
49+ artifact : ArcSwapOption < A > ,
5450 /// Opens when the artifact has been published (or resolved as a no-op).
5551 artifact_published : AtomicAsyncLatch ,
5652}
5753
58- impl < R > ScheduledBundle < R > {
59- /// Creates an unresolved bundle handle: its metadata is readable immediately, the settlement
60- /// artifact is filled later via [`publish_artifact`](Self::publish_artifact).
54+ impl < A > ScheduledBundle < A > {
55+ /// Creates an unresolved bundle handle: its metadata is readable immediately, the artifact is
56+ /// filled later via [`publish_artifact`](Self::publish_artifact).
6157 pub fn new (
6258 batches : usize ,
6359 checkpoint_index : u64 ,
@@ -71,13 +67,13 @@ impl<R> ScheduledBundle<R> {
7167 from_block,
7268 block_prove_to,
7369 latest_settlement,
74- settlement : ArcSwapOption :: empty ( ) ,
70+ artifact : ArcSwapOption :: empty ( ) ,
7571 artifact_published : AtomicAsyncLatch :: new ( ) ,
7672 } ) )
7773 }
7874
7975 /// Creates an immediately-resolved no-op bundle: it advanced no state, so it carries no
80- /// settlement and its artifact latch is already open.
76+ /// artifact and its artifact latch is already open.
8177 pub fn resolved_noop (
8278 batches : usize ,
8379 checkpoint_index : u64 ,
@@ -93,7 +89,7 @@ impl<R> ScheduledBundle<R> {
9389 from_block,
9490 block_prove_to,
9591 latest_settlement,
96- settlement : ArcSwapOption :: empty ( ) ,
92+ artifact : ArcSwapOption :: empty ( ) ,
9793 artifact_published,
9894 } ) )
9995 }
@@ -124,22 +120,22 @@ impl<R> ScheduledBundle<R> {
124120 self . latest_settlement
125121 }
126122
127- /// Publishes the bundle's settlement artifact and opens the `artifact_published` latch. A
128- /// `None` artifact resolves the handle as a no-op (the consumer skips it).
129- pub fn publish_artifact ( & self , artifact : Option < SettlementArtifact < R > > ) {
123+ /// Publishes the bundle's artifact and opens the `artifact_published` latch. A `None` artifact
124+ /// resolves the handle as a no-op (the consumer skips it).
125+ pub fn publish_artifact ( & self , artifact : Option < A > ) {
130126 if let Some ( artifact) = artifact {
131- self . settlement . store ( Some ( Arc :: new ( artifact) ) ) ;
127+ self . artifact . store ( Some ( Arc :: new ( artifact) ) ) ;
132128 }
133129 self . artifact_published . open ( ) ;
134130 }
135131
136- /// Returns the published settlement artifact, or `None` if the bundle resolved as a no-op.
132+ /// Returns the published artifact, or `None` if the bundle resolved as a no-op.
137133 ///
138134 /// Must be called after [`wait_artifact_published`](Self::wait_artifact_published): the handle
139135 /// is visible to consumers before its artifact exists, so an early call returns `None` for an
140136 /// unresolved bundle rather than panicking.
141- pub fn artifact ( & self ) -> Option < Arc < SettlementArtifact < R > > > {
142- self . settlement . load_full ( )
137+ pub fn artifact ( & self ) -> Option < Arc < A > > {
138+ self . artifact . load_full ( )
143139 }
144140
145141 /// Waits until the bundle's artifact has been published (or resolved as a no-op).
0 commit comments