Conversation
d83dffd to
cbe4b7a
Compare
895a4a2 to
d45b137
Compare
d45b137 to
3435df5
Compare
|
|
||
| let metrics = Arc::new(OpRBuilderMetrics::default()); | ||
| let task_metrics = Arc::new(FlashblocksTaskMetrics::new()); | ||
| let pool_change_epoch = Arc::new(AtomicU64::new(0)); |
There was a problem hiding this comment.
What is the purpose of this pool change atomic?
There was a problem hiding this comment.
It lets the continuous loop detect pool changes without awaiting pool events (i.e. avoiding async overhead in the hot path). It coalesces all pool events into a single 'pool changed' signal, which also lets the loop skip useless iterations (if the pool hasn't changed, we can't produce a better candidate)
|
did you push your changes correctly? don't see code changes for comments |
932b00a to
88c1026
Compare
| last_seen_pool_change_epoch = current_epoch; | ||
| idle_backoff = Duration::from_millis(1); | ||
|
|
||
| // Yield CPU briefly to avoid starving the tokio runtime |
There was a problem hiding this comment.
Shouldn't you run most of this (creating a new candidate) in a blocking task and then await it in each loop iteration?
| ); | ||
| } | ||
|
|
||
| if payload_cancel.is_resolved() || payload_cancel.is_new_fcu() { |
There was a problem hiding this comment.
Are you not able to make this function async and race against this token?
|
|
||
| state.ctx = state.ctx.with_cancel(new_fb_cancel); | ||
| let build_start = Instant::now(); | ||
| let new_shared_best: SharedBest = Arc::new(std::sync::Mutex::new(None)); |
There was a problem hiding this comment.
You already create a SharedBest up in run_continuous_flashblocks so you should use that one
3c71766 to
dbdcaf3
Compare
📝 Summary
Adds a continuous flashblock building mode (under
--flashblocks.continuous-buildflag) that pre-seals candidates between scheduler triggers, so the best block is ready for instant publish when the timer fires.Built on top of #438
How it works
cumulative_gas_used)pool_change_epochfrom a pool event listener)fb_cancelfires (scheduler trigger), the loop exits and returns the best candidateDetails
AddressGasLimiterwrapsArc<DashMap>, newsnapshot()/restore()methods deep-copy the token buckets so each candidate starts with the same gas budgetPendingandReplacedpool events, incrementing anAtomicU64epoch. The candidate loop skips rebuilds when the epoch hasn't changedState<DB>from(CacheState, TransitionState)+state_by_block_hashsinceStateisn'tSend.build_blockis designed to leavetransition_stateintact (saves/restores it internally)BestCandidatestruct: All best-candidate state (cache, transitions, info, committed txs, sealed payload) grouped in a single struct, all updates are structurally enforced to be in same locksteppublish_and_spawn_nextfunction: returnsFlashblockAction::Continue { fb_span, build_rx, build_start }orExitreserve_builder_tx_budgethelper: Shared between sequential and continuous paths, adjusts gas/DA/uncompressed limits for bottom-of-block builder txsnext_after_seal: Shared between sequential and continuous paths, encapsulates the DA/gas limit advancement for the next flashblockcontinuous_build_duration,candidate_staleness,continuous_candidates_evaluated,continuous_candidates_improved