feat(miner): update logs in worker (#429)

This commit is contained in:
David 2025-05-17 11:07:28 +08:00 committed by GitHub
parent 965043b977
commit 6caf96ffda
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 44 additions and 10 deletions

View file

@ -46,7 +46,8 @@ func (w *Miner) buildTransactionsLists(
currentHead = w.chain.CurrentBlock()
)
log.Info("buildTransactionsLists",
log.Info(
"Start building transactions lists",
"blockMaxGasLimit", blockMaxGasLimit,
"maxBytesPerTxList", maxBytesPerTxList,
"maxTransactionsLists", maxTransactionsLists,
@ -55,7 +56,14 @@ func (w *Miner) buildTransactionsLists(
)
if currentHead == nil {
log.Error("buildTransactionsLists failed to find current head")
log.Error(
"Failed to find current head",
"blockMaxGasLimit", blockMaxGasLimit,
"maxBytesPerTxList", maxBytesPerTxList,
"maxTransactionsLists", maxTransactionsLists,
"localAccounts", localAccounts,
"minTip", minTip,
)
return nil, fmt.Errorf("failed to find current head")
}
@ -67,8 +75,10 @@ func (w *Miner) buildTransactionsLists(
OnlyPlainTxs: true,
},
)) == 0 {
log.Warn("buildTransactionsLists: tx pool is empty",
log.Warn(
"Transaction pool for building transactions lists is empty",
"minTip", minTip,
"baseFee", baseFee,
"onlyPlainTxs", true,
)
return txsLists, nil
@ -84,12 +94,15 @@ func (w *Miner) buildTransactionsLists(
baseFeePerGas: baseFee,
}
log.Info("buildTransactionsLists: prepare work",
log.Info(
"Prepare the sealing task for building transactions lists",
"timestamp", params.timestamp,
"forceTime", params.forceTime,
"parentHash", params.parentHash,
"coinbase", params.coinbase,
"random", params.random,
"minTip", minTip,
"baseFee", baseFee,
"noTxs", params.noTxs,
)
@ -121,12 +134,24 @@ func (w *Miner) buildTransactionsLists(
minTip,
)
if err != nil {
log.Error("buildTransactionsLists: commit transactions failed", "error", err)
log.Error(
"Failed to commit transactions for building transactions lists",
"timestamp", params.timestamp,
"forceTime", params.forceTime,
"parentHash", params.parentHash,
"coinbase", params.coinbase,
"random", params.random,
"minTip", minTip,
"baseFee", baseFee,
"noTxs", params.noTxs,
"error", err,
)
return nil, nil, err
}
log.Info("buildTransactionsLists: commit transactions",
log.Info(
"New transactions committed for building transactions lists",
"localTxs", len(localTxs),
"remoteTxs", len(remoteTxs),
"txsPruned", len(pruningResult.TxsPruned),
@ -161,7 +186,16 @@ func (w *Miner) buildTransactionsLists(
txsLists = append(txsLists, preBuiltTxList)
}
log.Info("buildTransactionsLists: commit transactions finished",
log.Info(
"Finished building transactions lists",
"timestamp", params.timestamp,
"forceTime", params.forceTime,
"parentHash", params.parentHash,
"coinbase", params.coinbase,
"random", params.random,
"minTip", minTip,
"baseFee", baseFee,
"noTxs", params.noTxs,
"txLists", len(txsLists),
)

View file

@ -33,12 +33,12 @@ import (
)
const (
wsReadBuffer = 10 * 1024 * 1024 // CHANGE(taiko): change to 10 * 1024 * 1024
wsWriteBuffer = 10 * 1024 * 1024 // CHANGE(taiko): change to 10 * 1024 * 1024
wsReadBuffer = 1024
wsWriteBuffer = 1024
wsPingInterval = 30 * time.Second
wsPingWriteTimeout = 5 * time.Second
wsPongTimeout = 30 * time.Second
wsDefaultReadLimit = 100 * 1024 * 1024 // CHANGE(taiko): change to 100 * 1024 * 1024
wsDefaultReadLimit = 32 * 1024 * 1024
)
var wsBufferPool = new(sync.Pool)