mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-11 06:23:47 +00:00
fix: Initialize nextL1MsgIndex before commit (#444)
* initialize nextL1MsgIndex before commit * bump version --------- Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
This commit is contained in:
parent
2f0a17d36d
commit
e70a07cc98
2 changed files with 12 additions and 16 deletions
|
|
@ -792,7 +792,14 @@ func (w *worker) makeCurrent(parent *types.Block, header *types.Header) error {
|
||||||
env.tcount = 0
|
env.tcount = 0
|
||||||
env.blockSize = 0
|
env.blockSize = 0
|
||||||
env.l1TxCount = 0
|
env.l1TxCount = 0
|
||||||
env.nextL1MsgIndex = 0 // initialized in commitNewWork
|
|
||||||
|
// find next L1 message queue index
|
||||||
|
nextQueueIndex := rawdb.ReadFirstQueueIndexNotInL2Block(w.eth.ChainDb(), parent.Hash())
|
||||||
|
if nextQueueIndex == nil {
|
||||||
|
// the parent must have been processed before we start a new mining job.
|
||||||
|
log.Crit("Failed to read last L1 message in L2 block", "parent.Hash()", parent.Hash().String())
|
||||||
|
}
|
||||||
|
env.nextL1MsgIndex = *nextQueueIndex
|
||||||
|
|
||||||
// Swap out the old work with the new one, terminating any leftover prefetcher
|
// Swap out the old work with the new one, terminating any leftover prefetcher
|
||||||
// processes in the mean time and starting a new one.
|
// processes in the mean time and starting a new one.
|
||||||
|
|
@ -1086,15 +1093,9 @@ loop:
|
||||||
return false, circuitCapacityReached
|
return false, circuitCapacityReached
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *worker) collectPendingL1Messages() (uint64, []types.L1MessageTx) {
|
func (w *worker) collectPendingL1Messages(startIndex uint64) []types.L1MessageTx {
|
||||||
nextQueueIndex := rawdb.ReadFirstQueueIndexNotInL2Block(w.eth.ChainDb(), w.chain.CurrentHeader().Hash())
|
|
||||||
if nextQueueIndex == nil {
|
|
||||||
// the parent (w.chain.CurrentHeader) must have been processed before we start a new mining job.
|
|
||||||
log.Crit("Failed to read last L1 message in L2 block", "l2BlockHash", w.chain.CurrentHeader().Hash())
|
|
||||||
}
|
|
||||||
startIndex := *nextQueueIndex
|
|
||||||
maxCount := w.chainConfig.Scroll.L1Config.NumL1MessagesPerBlock
|
maxCount := w.chainConfig.Scroll.L1Config.NumL1MessagesPerBlock
|
||||||
return startIndex, rawdb.ReadL1MessagesFrom(w.eth.ChainDb(), startIndex, maxCount)
|
return rawdb.ReadL1MessagesFrom(w.eth.ChainDb(), startIndex, maxCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
// commitNewWork generates several new sealing tasks based on the parent block.
|
// commitNewWork generates several new sealing tasks based on the parent block.
|
||||||
|
|
@ -1203,12 +1204,7 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool, timestamp int64)
|
||||||
l1Txs := make(map[common.Address]types.Transactions)
|
l1Txs := make(map[common.Address]types.Transactions)
|
||||||
pendingL1Txs := 0
|
pendingL1Txs := 0
|
||||||
if w.chainConfig.Scroll.ShouldIncludeL1Messages() {
|
if w.chainConfig.Scroll.ShouldIncludeL1Messages() {
|
||||||
nextQueueIndex, l1Messages := w.collectPendingL1Messages()
|
l1Messages := w.collectPendingL1Messages(env.nextL1MsgIndex)
|
||||||
|
|
||||||
// If l1Messages is empty, we should still set this
|
|
||||||
// to the same value as the parent block.
|
|
||||||
env.nextL1MsgIndex = nextQueueIndex
|
|
||||||
|
|
||||||
pendingL1Txs = len(l1Messages)
|
pendingL1Txs = len(l1Messages)
|
||||||
for _, l1msg := range l1Messages {
|
for _, l1msg := range l1Messages {
|
||||||
tx := types.NewTx(&l1msg)
|
tx := types.NewTx(&l1msg)
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 4 // Major version component of the current release
|
VersionMajor = 4 // Major version component of the current release
|
||||||
VersionMinor = 3 // Minor version component of the current release
|
VersionMinor = 3 // Minor version component of the current release
|
||||||
VersionPatch = 24 // Patch version component of the current release
|
VersionPatch = 25 // Patch version component of the current release
|
||||||
VersionMeta = "sepolia" // Version metadata to append to the version string
|
VersionMeta = "sepolia" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue