mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
fix: do not overwrite correct L1 index on signer startup (#443)
* fix signer worker * add logs * bump version * Fix
This commit is contained in:
parent
8f431845c3
commit
69dd39afba
3 changed files with 64 additions and 8 deletions
|
|
@ -1186,9 +1186,28 @@ func (bc *BlockChain) writeBlockWithoutState(block *types.Block, td *big.Int) (e
|
|||
// note: we can insert blocks with header-only ancestors here,
|
||||
// so queueIndex might not yet be available in DB.
|
||||
if queueIndex != nil {
|
||||
numProcessed := uint64(block.NumL1MessagesProcessed(*queueIndex))
|
||||
// do not overwrite the index written by the miner worker
|
||||
if index := rawdb.ReadFirstQueueIndexNotInL2Block(bc.db, block.Hash()); index == nil {
|
||||
rawdb.WriteFirstQueueIndexNotInL2Block(batch, block.Hash(), *queueIndex+uint64(block.NumL1MessagesProcessed(*queueIndex)))
|
||||
newIndex := *queueIndex + numProcessed
|
||||
log.Trace(
|
||||
"Blockchain.writeBlockWithoutState WriteFirstQueueIndexNotInL2Block",
|
||||
"number", block.Number(),
|
||||
"hash", block.Hash().String(),
|
||||
"queueIndex", *queueIndex,
|
||||
"numProcessed", numProcessed,
|
||||
"newIndex", newIndex,
|
||||
)
|
||||
rawdb.WriteFirstQueueIndexNotInL2Block(batch, block.Hash(), newIndex)
|
||||
} else {
|
||||
log.Trace(
|
||||
"Blockchain.writeBlockWithoutState WriteFirstQueueIndexNotInL2Block: not overwriting existing index",
|
||||
"number", block.Number(),
|
||||
"hash", block.Hash().String(),
|
||||
"queueIndex", *queueIndex,
|
||||
"numProcessed", numProcessed,
|
||||
"index", *index,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1253,9 +1272,28 @@ func (bc *BlockChain) writeBlockWithState(block *types.Block, receipts []*types.
|
|||
// so the parent will always be inserted first.
|
||||
log.Crit("Queue index in DB is nil", "parent", block.ParentHash(), "hash", block.Hash())
|
||||
}
|
||||
numProcessed := uint64(block.NumL1MessagesProcessed(*queueIndex))
|
||||
// do not overwrite the index written by the miner worker
|
||||
if index := rawdb.ReadFirstQueueIndexNotInL2Block(bc.db, block.Hash()); index == nil {
|
||||
rawdb.WriteFirstQueueIndexNotInL2Block(blockBatch, block.Hash(), *queueIndex+uint64(block.NumL1MessagesProcessed(*queueIndex)))
|
||||
newIndex := *queueIndex + numProcessed
|
||||
log.Trace(
|
||||
"Blockchain.writeBlockWithState WriteFirstQueueIndexNotInL2Block",
|
||||
"number", block.Number(),
|
||||
"hash", block.Hash().String(),
|
||||
"queueIndex", *queueIndex,
|
||||
"numProcessed", numProcessed,
|
||||
"newIndex", newIndex,
|
||||
)
|
||||
rawdb.WriteFirstQueueIndexNotInL2Block(blockBatch, block.Hash(), newIndex)
|
||||
} else {
|
||||
log.Trace(
|
||||
"Blockchain.writeBlockWithState WriteFirstQueueIndexNotInL2Block: not overwriting existing index",
|
||||
"number", block.Number(),
|
||||
"hash", block.Hash().String(),
|
||||
"queueIndex", *queueIndex,
|
||||
"numProcessed", numProcessed,
|
||||
"index", *index,
|
||||
)
|
||||
}
|
||||
|
||||
if err := blockBatch.Write(); err != nil {
|
||||
|
|
|
|||
|
|
@ -698,11 +698,29 @@ func (w *worker) resultLoop() {
|
|||
}
|
||||
logs = append(logs, receipt.Logs...)
|
||||
}
|
||||
// It's possible that we've stored L1 queue index for this block previously,
|
||||
// in this case do not overwrite it.
|
||||
if index := rawdb.ReadFirstQueueIndexNotInL2Block(w.eth.ChainDb(), hash); index == nil {
|
||||
// Store first L1 queue index not processed by this block.
|
||||
// Note: This accounts for both included and skipped messages. This
|
||||
// way, if a block only skips messages, we won't reprocess the same
|
||||
// messages from the next block.
|
||||
log.Trace(
|
||||
"Worker WriteFirstQueueIndexNotInL2Block",
|
||||
"number", block.Number(),
|
||||
"hash", hash.String(),
|
||||
"task.nextL1MsgIndex", task.nextL1MsgIndex,
|
||||
)
|
||||
rawdb.WriteFirstQueueIndexNotInL2Block(w.eth.ChainDb(), hash, task.nextL1MsgIndex)
|
||||
} else {
|
||||
log.Trace(
|
||||
"Worker WriteFirstQueueIndexNotInL2Block: not overwriting existing index",
|
||||
"number", block.Number(),
|
||||
"hash", hash.String(),
|
||||
"index", *index,
|
||||
"task.nextL1MsgIndex", task.nextL1MsgIndex,
|
||||
)
|
||||
}
|
||||
// Store circuit row consumption.
|
||||
log.Trace(
|
||||
"Worker write block row consumption",
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import (
|
|||
const (
|
||||
VersionMajor = 4 // Major version component of the current release
|
||||
VersionMinor = 3 // Minor version component of the current release
|
||||
VersionPatch = 23 // Patch version component of the current release
|
||||
VersionPatch = 24 // Patch version component of the current release
|
||||
VersionMeta = "sepolia" // Version metadata to append to the version string
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue