feat: drive the batch builder through a typestate seal-ahead pipeline - #124
Conversation
3aa6096 to
a2b1884
Compare
Security Scan - CodeSeverity: HIGH, CRITICAL No vulnerabilities found View scan results |
- BatchOrdering publishes an executed_own_watermark watch, seeded from the persisted last_executed_seq for this node's own authority - advance the watch wherever last_executed_seq moves forward: in-order accept, overflow-forced accept, and parked-batch drain; it marks acceptance into execution order, not block finalization - new and from_history take the node address so the watch reflects only this authority's own batches, ignoring others'
- replace the poll-based BatchBuilder future with an async run loop over a BatchPipeline typestate, so an illegal build/seal ordering cannot be represented - seal up to MAX_SEAL_AHEAD batches ahead of the authority's own execution watermark, then stall until execution advances, keeping the in-flight prefix within the per-authority parking budget - collapse the budget to one batch inside the boundary quiesce window and end the builder once the canonical tip reaches the epoch boundary - resume the sequence from the execution watermark on restart rather than from the persisted counter alone - new takes a BatchBuilderConfig and the OwnWatermarkReceiver; node_inner captures the watermark from BatchOrdering and drives the builder via run() - add pool.pending_transactions_listener so the loop wakes promptly on new pending candidates - end the builder instead of spinning once the worker seal loop disconnects
a2b1884 to
cb0ab3f
Compare
|
Claude finished @bronxyz's task in 3m 36s —— View job Code Review
This is an independent review against the current diff. The structural shape — typestate machine, Required fix (carried over, still blocking approval)Bug:
|
| Severity | Finding | Status |
|---|---|---|
| Bug | elapsed_ms always ~0 (lib.rs:322) |
Unaddressed — required for approval |
| Medium | check_boundary body duplicated 4× (pipeline.rs:183,214,244,310) |
Unaddressed |
| Medium | Inner spawn_blocking invisible to task_spawner shutdown tracking |
Unaddressed |
| Medium | AwaitingQuorum::check_boundary needs doc comment explaining intentional result-drop |
Unaddressed |
| Low | Unconditional on_event() at startup fires empty build (lib.rs:181) |
Unaddressed |
| Nit | No live-builder test for Quiescing budget cap |
Unaddressed |
| Nit | node_inner.rs:175 expect vs .ok_or_eyre |
Unaddressed |
| Nit | Typo "becuase" in error.rs:38 |
New |
The elapsed_ms logging bug remains the single required fix for approval.
- `elapsed_ms` was stamped after the quorum result had already arrived, so it logged the resolution overhead, never the wait; `AwaitingQuorum` now carries the spawn instant - fix "becuase" in the max-batch-size error text - addresses the PR #124 (feature/txpool-in-flight-tracker-builder-pipeline) review: `elapsed_ms` always ~0, plus the typo nit
Summary
BatchOrderingpublishes this authority's accepted batch sequence as a watch, seeded from the persistedlast_executed_seqand advanced on in-order accept, overflow-forced accept, and parked-batch drain. It marks acceptance into execution order, not block finalization.BatchBuilderfuture with an async run loop over aBatchPipelinetypestate, so an illegal build/seal ordering cannot be represented. The builder seals up toMAX_SEAL_AHEADbatches ahead of its own watermark and then stalls until execution advances, keeping the in-flight prefix inside the per-authority parking budget; the budget collapses to one batch inside the boundary quiesce window and the builder ends once the canonical tip reaches the epoch boundary.Stack 5/9 of the txpool in-flight tracker and observer-forwarder series.
Surface areas touched
eth_*,rayls_*, faucet)rayls-contracts/)etc/, scripts, Docker, compose).github/workflows/,Makefile)doc/, in-crate READMEs, root docs)Breaking / compatibility
None. Node-local pacing only; no wire, storage, or fork changes. A fast proposer now seals at most
MAX_SEAL_AHEADbatches past its own executed sequence.Test plan
tests/it/pipeline_typestate.rscovers the phase transitions and the seal-ahead / quiesce / closed budget.tests/it/build_batches.rsruns the builder through the newrun()loop end to end.make checkon the stack tip; CI on this branch.