From 78d3a812f9fec4ee9ba545c69ab5914c1b6ede92 Mon Sep 17 00:00:00 2001 From: Dzmitry Kalabuk Date: Thu, 18 Jun 2026 14:23:06 +0300 Subject: [PATCH] Decouple finalization from head ingestion Part of NET-408 --- evm/evm-rpc/src/data-source/finalizer.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/evm/evm-rpc/src/data-source/finalizer.ts b/evm/evm-rpc/src/data-source/finalizer.ts index 0b113b819..251caeb34 100644 --- a/evm/evm-rpc/src/data-source/finalizer.ts +++ b/evm/evm-rpc/src/data-source/finalizer.ts @@ -50,11 +50,12 @@ class Finalizer { if (info.hash === ref.hash) { this.unshift(probes.slice(i + 1)) + // Record the finalized head only. Emitting it as its own batch + // would share the `output` queue with head blocks and stall + // ingestion; `visit()` attaches `current` to the next head batch + // instead. this.current = ref - return this.output.put({ - blocks: [], - finalizedHead: ref - }) + return } else { probes.splice(i, 1) } @@ -97,7 +98,11 @@ class Finalizer { } this.checks.forcePut(null) return { - blocks: batch.blocks + blocks: batch.blocks, + // Attach the latest finalized head to the head batch (see + // `probe()`). Deferring it to the next head batch is safe: + // finality lags the head by minutes, and the consumer max-guards it. + finalizedHead: this.current } } }