Skip to content

feat(metrics): measure fcu lateness and missed flashblocks#29

Open
avalonche wants to merge 1 commit into
mainfrom
feat/authrpc-fcu-lateness-metrics
Open

feat(metrics): measure fcu lateness and missed flashblocks#29
avalonche wants to merge 1 commit into
mainfrom
feat/authrpc-fcu-lateness-metrics

Conversation

@avalonche

@avalonche avalonche commented Jul 7, 2026

Copy link
Copy Markdown

What

Adds measurement of how late the first engine_forkchoiceUpdated* with payload attributes lands in each block, and how many flashblocks missed as two Prometheus metrics.

  • Off the hot path: emitted from the postprocessor, after the response is returned to the client.
  • First-per-block: repeated FCUs-with-attributes for the same block (same payload timestamp) are deduped by only accepting a monotonically increasing block timestamp. Does not account for reorgs.

Config (authrpc)

  • --authrpc-block-time (RPROXY_AUTHRPC_BLOCK_TIME, default 1s) — block duration
  • --authrpc-flashblocks-per-block (RPROXY_AUTHRPC_FLASHBLOCKS_PER_BLOCK, default 0) — number of flashblocks per block; 0 disables the measurement

Metrics

  • rproxy_fcu_arrival (milliseconds) — how far into the block's building window the FCU arrived (negative if early). Based on block timestamp in the payload attribute.
  • rproxy_fcu_reduced_flashblocks — flashblocks that are reduced than the expected number due to the fcu timing

Add authrpc config for block time and flashblocks-per-block, and emit two
metrics from the proxy postprocessor (off the client-response hot path):

- fcu_lateness (ms): how late the first forkchoice-update with attributes
  lands into each block's building window, anchored on the payload's block
  timestamp
- fcu_missed_flashblocks: flashblocks that no longer fit before the block's
  sealing deadline as a result (deadline-based attribution)

Scoped to the first fcu-with-attributes per block via a monotonic
block-timestamp high-water mark, with a clock-skew guard. Measurement is
opt-in (--authrpc-flashblocks-per-block defaults to 0) and inert for the rpc
proxy. block_time/flashblocks_per_block are exposed on the ConfigProxyHttp
trait so the shared emit path can read them.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@avalonche avalonche changed the title feat(authrpc): measure fcu lateness and missed flashblocks feat(metrics): measure fcu lateness and missed flashblocks Jul 7, 2026
@avalonche avalonche requested review from KA-ROM and Copilot and removed request for KA-ROM July 7, 2026 04:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Prometheus instrumentation to quantify (1) how late the first engine_forkchoiceUpdated* call with payload attributes arrives within a block’s building window, and (2) how many flashblocks are missed as a result, with authrpc-specific configuration knobs.

Changes:

  • Emit two new per-proxy metrics (fcu_arrival, fcu_reduced_flashblocks) from the HTTP proxy postprocessor path.
  • Extend the HTTP proxy config trait with block_time and flashblocks_per_block, implemented for authrpc (real values) and rpc (disabled via zeroes).
  • Add authrpc CLI/env configuration and validation for the new measurement inputs.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/rproxy/src/server/proxy/http/proxy.rs Adds FCU lateness/flashblock-loss metric emission on successful proxied responses.
crates/rproxy/src/server/proxy/http/config.rs Extends ConfigProxyHttp with block/flashblock timing accessors.
crates/rproxy/src/server/proxy/config/rpc.rs Implements new config trait methods for rpc as disabled (zero values).
crates/rproxy/src/server/proxy/config/authrpc.rs Adds authrpc CLI/env flags and validation + implements new config trait methods.
crates/rproxy/src/server/metrics.rs Introduces metric families/counters and an atomic dedupe guard for “first FCU per block”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1274 to +1282
let arrival_ms = (req.start().unix_timestamp_nanos() / 1_000_000) as i64;
let block_ts_ms = block_ts_secs * 1_000;
let block_time_ms = block_time.as_millis() as i64;

let ms_into_slot = arrival_ms - (block_ts_ms - block_time_ms);
let interval_ms = block_time_ms / flashblocks_per_block as i64;
let remaining_flashblocks = ((block_ts_ms - arrival_ms) / interval_ms)
.clamp(0, flashblocks_per_block as i64) as u64;
let reduced_flashblocks = flashblocks_per_block - remaining_flashblocks;
fcu_arrival: Family::default(),
fcu_reduced_flashblocks: Family::default(),

fcu_block_timestamp_latest: AtomicI64::new(0),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants