From 61dec3080f1de54bba70a1e4d200d53458c31cbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Duchesneau?= Date: Thu, 14 May 2026 15:44:03 -0400 Subject: [PATCH 1/3] call SetFinalized when successfully processing a milestone --- eth/handler_bor.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eth/handler_bor.go b/eth/handler_bor.go index 567fc74ecd..83bea57266 100644 --- a/eth/handler_bor.go +++ b/eth/handler_bor.go @@ -128,6 +128,11 @@ func (h *ethHandler) handleMilestone(ctx context.Context, eth *Ethereum, milesto h.downloader.ProcessMilestone(num, hash) + // set milestone block as finalized (used by tracer) + if header := eth.blockchain.GetHeaderByHash(hash); header != nil { + eth.blockchain.SetFinalized(header) + } + return nil } From 05c624e63b0afa94380ae1efebcf3715407dc1b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Duchesneau?= Date: Thu, 21 May 2026 11:11:09 -0400 Subject: [PATCH 2/3] eth: also publish milestone block as safe and re-check canonical at write time handleMilestone now resolves the milestone block via GetBlockByNumber and verifies the canonical hash matches milestone.Hash before calling SetFinalized/SetSafe to avoid promoting a stale header if a reorg lands before this write. Calls SetSafe alongside SetFinalized so both advance in real time. --- eth/handler_bor.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/eth/handler_bor.go b/eth/handler_bor.go index 83bea57266..922ce1aeef 100644 --- a/eth/handler_bor.go +++ b/eth/handler_bor.go @@ -128,9 +128,12 @@ func (h *ethHandler) handleMilestone(ctx context.Context, eth *Ethereum, milesto h.downloader.ProcessMilestone(num, hash) - // set milestone block as finalized (used by tracer) - if header := eth.blockchain.GetHeaderByHash(hash); header != nil { - eth.blockchain.SetFinalized(header) + // Publish the milestone block as finalized and safe. Re-resolve via the + // canonical number→hash mapping so a reorg between verification and this + // write can't promote a stale or non-canonical header. + if block := eth.blockchain.GetBlockByNumber(num); block != nil && block.Hash() == hash { + eth.blockchain.SetFinalized(block.Header()) + eth.blockchain.SetSafe(block.Header()) } return nil From bc0fd91f8d4ab0a35ae8200bf6ad2b1ea0767a4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Duchesneau?= Date: Fri, 22 May 2026 13:39:35 -0400 Subject: [PATCH 3/3] remove SetSafe as was suggested by @kamuikatsurgi --- eth/handler_bor.go | 1 - 1 file changed, 1 deletion(-) diff --git a/eth/handler_bor.go b/eth/handler_bor.go index 922ce1aeef..4918875e76 100644 --- a/eth/handler_bor.go +++ b/eth/handler_bor.go @@ -133,7 +133,6 @@ func (h *ethHandler) handleMilestone(ctx context.Context, eth *Ethereum, milesto // write can't promote a stale or non-canonical header. if block := eth.blockchain.GetBlockByNumber(num); block != nil && block.Hash() == hash { eth.blockchain.SetFinalized(block.Header()) - eth.blockchain.SetSafe(block.Header()) } return nil