From c42ec29019973c8e0ab10f48bfee9bc7167b674f Mon Sep 17 00:00:00 2001 From: Jerry Date: Sat, 13 Dec 2025 13:11:56 +0900 Subject: [PATCH 1/5] Remove unnecessary time sleep in prepare --- consensus/bor/bor.go | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index bcbd2f3925..e51314aff1 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -1031,16 +1031,6 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header) e if header.Time < uint64(time.Now().Unix()) { header.Time = uint64(time.Now().Unix()) - } else { - // For primary validators, wait until the current block production window - // starts. This prevents bor from starting to build next block before time - // as we'd like to wait for new transactions. Although this change doesn't - // need a check for hard fork as it doesn't change any consensus rules, we - // still keep it for safety and testing. - if c.config.IsBhilai(big.NewInt(int64(number))) && succession == 0 { - startTime := header.GetActualTime().Add(-time.Duration(c.config.CalculatePeriod(number)) * time.Second) - time.Sleep(time.Until(startTime)) - } } return nil From 5eb2ab37c66f46b6153ce43b7859e9bc15a07b4a Mon Sep 17 00:00:00 2001 From: Jerry Date: Sat, 13 Dec 2025 13:14:04 +0900 Subject: [PATCH 2/5] Update version number --- params/version.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/params/version.go b/params/version.go index d69ed35323..b6994b8843 100644 --- a/params/version.go +++ b/params/version.go @@ -23,10 +23,10 @@ import ( ) const ( - VersionMajor = 2 // Major version component of the current release - VersionMinor = 5 // Minor version component of the current release - VersionPatch = 4 // Patch version component of the current release - VersionMeta = "" // Version metadata to append to the version string + VersionMajor = 2 // Major version component of the current release + VersionMinor = 5 // Minor version component of the current release + VersionPatch = 5 // Patch version component of the current release + VersionMeta = "beta2" // Version metadata to append to the version string ) var ( From 4043143f1cf835e219c1337fbc3a3aa4963dc7c4 Mon Sep 17 00:00:00 2001 From: Krishang <109511742+kamuikatsurgi@users.noreply.github.com> Date: Fri, 12 Dec 2025 23:02:21 +0530 Subject: [PATCH 3/5] fix(miner): delete pending task after successful block sealing to prevent node stall (#1929) * fix(miner): delete pending task after successful block sealing to prevent node stall * chore: nits * chore: set staleThreshold to 0 * chore: update comment --- miner/worker.go | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/miner/worker.go b/miner/worker.go index 6315c8de60..5bc989c75f 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -77,7 +77,12 @@ const ( intervalAdjustBias = 200 * 1000.0 * 1000.0 // staleThreshold is the maximum depth of the acceptable stale block. - staleThreshold = 7 + // In PoW chains (like pre-merge Ethereum), this is set to 7 because orphaned blocks + // can still be included as "uncle blocks" up to 6-7 blocks deep, earning partial rewards. + // In Bor's PoS consensus, validators take turns producing blocks deterministically, + // so there are no competing miners and no uncle block concept. Any non-canonical block + // is immediately stale and can be discarded, hence staleThreshold is set to 0. + staleThreshold = 0 ) var ( @@ -522,27 +527,17 @@ func (w *worker) newWorkLoop(recommit time.Duration) { veblopTimer.Reset(veblopTimeout) w.newTxs.Store(0) } - // clearPending cleans the stale pending tasks. - clearPending := func(number uint64) { - w.pendingMu.Lock() - for h, t := range w.pendingTasks { - if t.block.NumberU64()+staleThreshold <= number { - delete(w.pendingTasks, h) - } - } - w.pendingMu.Unlock() - } for { select { case <-w.startCh: - clearPending(w.chain.CurrentBlock().Number.Uint64()) + w.clearPending(w.chain.CurrentBlock().Number.Uint64()) timestamp = time.Now().Unix() commit(false, commitInterruptNewHead) case head := <-w.chainHeadCh: - clearPending(head.Header.Number.Uint64()) + w.clearPending(head.Header.Number.Uint64()) timestamp = time.Now().Unix() commit(false, commitInterruptNewHead) @@ -869,6 +864,10 @@ func (w *worker) resultLoop() { if err != nil { log.Error("Failed writing block to chain", "err", err) + // Error writing block to chain, delete the pending task. + w.pendingMu.Lock() + delete(w.pendingTasks, sealhash) + w.pendingMu.Unlock() continue } @@ -884,6 +883,10 @@ func (w *worker) resultLoop() { sealedEmptyBlocksCounter.Inc(1) } + // Clear all pending tasks for blocks at or below the sealed block number. + // These tasks are now obsolete since the chain has progressed past them. + w.clearPending(block.NumberU64()) + case <-w.exitCh: return } @@ -1732,6 +1735,17 @@ func (w *worker) adjustResubmitInterval(message *intervalAdjust) { } } +// clearPending cleans the stale pending tasks. +func (w *worker) clearPending(number uint64) { + w.pendingMu.Lock() + for h, t := range w.pendingTasks { + if t.block.NumberU64()+staleThreshold <= number { + delete(w.pendingTasks, h) + } + } + w.pendingMu.Unlock() +} + // copyReceipts makes a deep copy of the given receipts. func copyReceipts(receipts []*types.Receipt) []*types.Receipt { result := make([]*types.Receipt, len(receipts)) From e346376a86499ffda3827d4606217b82a061d470 Mon Sep 17 00:00:00 2001 From: kamuikatsurgi Date: Sat, 13 Dec 2025 15:39:36 +0530 Subject: [PATCH 4/5] chore: bump version --- params/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/params/version.go b/params/version.go index b6994b8843..a394c69ed3 100644 --- a/params/version.go +++ b/params/version.go @@ -26,7 +26,7 @@ const ( VersionMajor = 2 // Major version component of the current release VersionMinor = 5 // Minor version component of the current release VersionPatch = 5 // Patch version component of the current release - VersionMeta = "beta2" // Version metadata to append to the version string + VersionMeta = "beta3" // Version metadata to append to the version string ) var ( From b34e734ce7e8368a3ee62fd34551d7cd33dc2210 Mon Sep 17 00:00:00 2001 From: kamuikatsurgi Date: Mon, 15 Dec 2025 15:38:57 +0530 Subject: [PATCH 5/5] chore: release v2.5.5 --- params/version.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/params/version.go b/params/version.go index a394c69ed3..1548dc223c 100644 --- a/params/version.go +++ b/params/version.go @@ -23,10 +23,10 @@ import ( ) const ( - VersionMajor = 2 // Major version component of the current release - VersionMinor = 5 // Minor version component of the current release - VersionPatch = 5 // Patch version component of the current release - VersionMeta = "beta3" // Version metadata to append to the version string + VersionMajor = 2 // Major version component of the current release + VersionMinor = 5 // Minor version component of the current release + VersionPatch = 5 // Patch version component of the current release + VersionMeta = "" // Version metadata to append to the version string ) var (