From 0476172e20fd9f45cc95a819c03cb6b04d1a3f45 Mon Sep 17 00:00:00 2001 From: maskpp Date: Fri, 13 Sep 2024 22:51:06 +0800 Subject: [PATCH 1/3] avoid posible zero index panic --- core/txpool/blobpool/blobpool.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index d66a08aa17a4..465cd26733dd 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -566,7 +566,7 @@ func (p *BlobPool) recheck(addr common.Address, inclusions map[common.Hash]uint6 ids []uint64 nonces []uint64 ) - for txs[0].nonce < next { + for ; len(txs) > 0 && txs[0].nonce < next; txs = txs[1:] { ids = append(ids, txs[0].id) nonces = append(nonces, txs[0].nonce) @@ -578,7 +578,6 @@ func (p *BlobPool) recheck(addr common.Address, inclusions map[common.Hash]uint6 if inclusions != nil { p.offload(addr, txs[0].nonce, txs[0].id, inclusions) } - txs = txs[1:] } log.Trace("Dropping overlapped blob transactions", "from", addr, "overlapped", nonces, "ids", ids, "left", len(txs)) dropOverlappedMeter.Mark(int64(len(ids))) From 64cc8eb4f710fa52e163ddef3c1cbb71b29fcdfa Mon Sep 17 00:00:00 2001 From: maskpp Date: Sat, 14 Sep 2024 09:32:55 +0800 Subject: [PATCH 2/3] Update core/txpool/blobpool/blobpool.go Co-authored-by: Martin HS --- core/txpool/blobpool/blobpool.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 465cd26733dd..2748bb85555f 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -566,7 +566,7 @@ func (p *BlobPool) recheck(addr common.Address, inclusions map[common.Hash]uint6 ids []uint64 nonces []uint64 ) - for ; len(txs) > 0 && txs[0].nonce < next; txs = txs[1:] { + for len(txs) > 0 && txs[0].nonce < next { ids = append(ids, txs[0].id) nonces = append(nonces, txs[0].nonce) From 0654bc35e129abd3288f2677a56664e659bf7c79 Mon Sep 17 00:00:00 2001 From: maskpp Date: Sat, 14 Sep 2024 15:27:04 +0800 Subject: [PATCH 3/3] fix comments --- core/txpool/blobpool/blobpool.go | 1 + 1 file changed, 1 insertion(+) diff --git a/core/txpool/blobpool/blobpool.go b/core/txpool/blobpool/blobpool.go index 2748bb85555f..aa76ef774df0 100644 --- a/core/txpool/blobpool/blobpool.go +++ b/core/txpool/blobpool/blobpool.go @@ -578,6 +578,7 @@ func (p *BlobPool) recheck(addr common.Address, inclusions map[common.Hash]uint6 if inclusions != nil { p.offload(addr, txs[0].nonce, txs[0].id, inclusions) } + txs = txs[1:] } log.Trace("Dropping overlapped blob transactions", "from", addr, "overlapped", nonces, "ids", ids, "left", len(txs)) dropOverlappedMeter.Mark(int64(len(ids)))