From c5fcc6128834cdc9a6e0e6dd9be9cdf65ae70eb9 Mon Sep 17 00:00:00 2001 From: irrun Date: Sun, 28 Apr 2024 14:23:44 +0800 Subject: [PATCH 1/3] fix: reduce mev recommit log --- miner/bid_simulator.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/miner/bid_simulator.go b/miner/bid_simulator.go index 477f2052ea..8a8c44e420 100644 --- a/miner/bid_simulator.go +++ b/miner/bid_simulator.go @@ -623,11 +623,6 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) { if b.config.GreedyMergeTx { delay := b.engine.Delay(b.chain, bidRuntime.env.header, &b.delayLeftOver) if delay != nil && *delay > 0 { - log.Debug("BidSimulator: greedy merge stopTimer", "block", bidRuntime.env.header.Number, - "builder", bidRuntime.bid.Builder, - "header time", time.Until(time.Unix(int64(bidRuntime.env.header.Time), 0)), - "commit delay", *delay, "DelayLeftOver", b.delayLeftOver) - stopTimer := time.NewTimer(*delay) bidTxsSet := mapset.NewSet[common.Hash]() @@ -636,7 +631,7 @@ func (b *bidSimulator) simBid(interruptCh chan int32, bidRuntime *BidRuntime) { } fillErr := b.bidWorker.fillTransactions(interruptCh, bidRuntime.env, stopTimer, bidTxsSet) - log.Info("BidSimulator: greedy merge stopped", "block", bidRuntime.env.header.Number, + log.Trace("BidSimulator: greedy merge stopped", "block", bidRuntime.env.header.Number, "builder", bidRuntime.bid.Builder, "tx count", bidRuntime.env.tcount-bidTxLen+1, "err", fillErr) // recalculate the packed reward From 236b39ae918381ac15d14c93ca65d3717b2e6cdb Mon Sep 17 00:00:00 2001 From: irrun Date: Sun, 28 Apr 2024 15:21:54 +0800 Subject: [PATCH 2/3] fix: oom of mev bid env --- miner/bid_simulator.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/miner/bid_simulator.go b/miner/bid_simulator.go index 8a8c44e420..b33c873e9c 100644 --- a/miner/bid_simulator.go +++ b/miner/bid_simulator.go @@ -249,6 +249,12 @@ func (b *bidSimulator) SetBestBid(prevBlockHash common.Hash, bid *BidRuntime) { b.bestBidMu.Lock() defer b.bestBidMu.Unlock() + // must discard the environment of the last best bid, otherwise it will cause memory leak + last := b.bestBid[prevBlockHash] + if last != nil { + last.env.discard() + } + b.bestBid[prevBlockHash] = bid } From 13b7211e2fb8650e35896965c44a51e8f6131f6d Mon Sep 17 00:00:00 2001 From: irrun Date: Sun, 28 Apr 2024 15:30:28 +0800 Subject: [PATCH 3/3] fix: oom of mev bid env --- miner/bid_simulator.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/miner/bid_simulator.go b/miner/bid_simulator.go index b33c873e9c..fd4c912257 100644 --- a/miner/bid_simulator.go +++ b/miner/bid_simulator.go @@ -251,7 +251,7 @@ func (b *bidSimulator) SetBestBid(prevBlockHash common.Hash, bid *BidRuntime) { // must discard the environment of the last best bid, otherwise it will cause memory leak last := b.bestBid[prevBlockHash] - if last != nil { + if last != nil && last.env != nil { last.env.discard() }