Skip to content

Commit 034b28e

Browse files
committed
add flag
1 parent 4298232 commit 034b28e

File tree

7 files changed

+18
-7
lines changed

7 files changed

+18
-7
lines changed

cmd/geth/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ var (
130130
utils.MinerExtraDataFlag,
131131
utils.MinerRecommitIntervalFlag,
132132
utils.MinerNoVerifyFlag,
133+
utils.MinerStoreSkippedTxTracesFlag,
133134
utils.NATFlag,
134135
utils.NoDiscoverFlag,
135136
utils.DiscoveryV5Flag,

cmd/geth/usage.go

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ var AppHelpFlagGroups = []flags.FlagGroup{
192192
utils.MinerExtraDataFlag,
193193
utils.MinerRecommitIntervalFlag,
194194
utils.MinerNoVerifyFlag,
195+
utils.MinerStoreSkippedTxTracesFlag,
195196
},
196197
},
197198
{

cmd/utils/flags.go

+7
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,10 @@ var (
491491
Name: "miner.noverify",
492492
Usage: "Disable remote sealing verification",
493493
}
494+
MinerStoreSkippedTxTracesFlag = cli.BoolFlag{
495+
Name: "miner.storeskippedtxtraces",
496+
Usage: "Store the wrapped traces when storing a skipped tx",
497+
}
494498
// Account settings
495499
UnlockedAccountFlag = cli.StringFlag{
496500
Name: "unlock",
@@ -1488,6 +1492,9 @@ func setMiner(ctx *cli.Context, cfg *miner.Config) {
14881492
if ctx.GlobalIsSet(MinerNoVerifyFlag.Name) {
14891493
cfg.Noverify = ctx.GlobalBool(MinerNoVerifyFlag.Name)
14901494
}
1495+
if ctx.GlobalIsSet(MinerStoreSkippedTxTracesFlag.Name) {
1496+
cfg.StoreSkippedTxTraces = ctx.GlobalBool(MinerStoreSkippedTxTracesFlag.Name)
1497+
}
14911498
if ctx.GlobalIsSet(LegacyMinerGasTargetFlag.Name) {
14921499
log.Warn("The generic --miner.gastarget flag is deprecated and will be removed in the future!")
14931500
}

core/rawdb/accessors_skipped_txs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ type SkippedTransaction struct {
5252
Tx *types.Transaction
5353

5454
// Traces is the wrapped traces of the skipped transaction.
55-
// We only store it when flag is enabled, so it may return nil.
55+
// We only store it when `MinerStoreSkippedTxTracesFlag` is enabled, so it may return nil.
5656
Traces *types.BlockTrace
5757

5858
// Reason is the skip reason.

internal/ethapi/api.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1336,7 +1336,7 @@ type RPCTransaction struct {
13361336
Sender common.Address `json:"sender,omitempty"`
13371337
QueueIndex *hexutil.Uint64 `json:"queueIndex,omitempty"`
13381338

1339-
// wrapped traces, currently only available for `scroll_getSkippedTransaction` API, when flag is set
1339+
// wrapped traces, currently only available for `scroll_getSkippedTransaction` API, when `MinerStoreSkippedTxTracesFlag` is set
13401340
Traces *types.BlockTrace `json:"traces,omitempty"`
13411341
}
13421342

miner/miner.go

+2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ type Config struct {
5656
GasPrice *big.Int // Minimum gas price for mining a transaction
5757
Recommit time.Duration // The time interval for miner to re-create mining work.
5858
Noverify bool // Disable remote mining solution verification(only useful in ethash).
59+
60+
StoreSkippedTxTraces bool // Whether store the wrapped traces when storing a skipped tx
5961
}
6062

6163
// Miner creates blocks and searches for proof-of-work values.

miner/worker.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ loop:
10381038
log.Info("Skipping L1 message", "queueIndex", queueIndex, "tx", tx.Hash().String(), "block", w.current.header.Number, "reason", "gas limit exceeded")
10391039
w.current.nextL1MsgIndex = queueIndex + 1
10401040
txs.Shift()
1041-
if false {
1041+
if w.config.StoreSkippedTxTraces {
10421042
rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, traces, "gas limit exceeded", w.current.header.Number.Uint64(), nil)
10431043
} else {
10441044
rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, nil, "gas limit exceeded", w.current.header.Number.Uint64(), nil)
@@ -1119,7 +1119,7 @@ loop:
11191119
circuitCapacityReached = false
11201120

11211121
// Store skipped transaction in local db
1122-
if false {
1122+
if w.config.StoreSkippedTxTraces {
11231123
rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, traces, "row consumption overflow", w.current.header.Number.Uint64(), nil)
11241124
} else {
11251125
rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, nil, "row consumption overflow", w.current.header.Number.Uint64(), nil)
@@ -1134,7 +1134,7 @@ loop:
11341134
log.Info("Skipping L1 message", "queueIndex", queueIndex, "tx", tx.Hash().String(), "block", w.current.header.Number, "reason", "unknown row consumption error")
11351135
w.current.nextL1MsgIndex = queueIndex + 1
11361136
// TODO: propagate more info about the error from CCC
1137-
if false {
1137+
if w.config.StoreSkippedTxTraces {
11381138
rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, traces, "unknown circuit capacity checker error", w.current.header.Number.Uint64(), nil)
11391139
} else {
11401140
rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, nil, "unknown circuit capacity checker error", w.current.header.Number.Uint64(), nil)
@@ -1152,7 +1152,7 @@ loop:
11521152
log.Trace("Unknown circuit capacity checker error for L2MessageTx", "tx", tx.Hash().String())
11531153
log.Info("Skipping L2 message", "tx", tx.Hash().String(), "block", w.current.header.Number, "reason", "unknown row consumption error")
11541154
// TODO: propagate more info about the error from CCC
1155-
if false {
1155+
if w.config.StoreSkippedTxTraces {
11561156
rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, traces, "unknown circuit capacity checker error", w.current.header.Number.Uint64(), nil)
11571157
} else {
11581158
rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, nil, "unknown circuit capacity checker error", w.current.header.Number.Uint64(), nil)
@@ -1174,7 +1174,7 @@ loop:
11741174
queueIndex := tx.AsL1MessageTx().QueueIndex
11751175
log.Info("Skipping L1 message", "queueIndex", queueIndex, "tx", tx.Hash().String(), "block", w.current.header.Number, "reason", "strange error", "err", err)
11761176
w.current.nextL1MsgIndex = queueIndex + 1
1177-
if false {
1177+
if w.config.StoreSkippedTxTraces {
11781178
rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, traces, fmt.Sprintf("strange error: %v", err), w.current.header.Number.Uint64(), nil)
11791179
} else {
11801180
rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, nil, fmt.Sprintf("strange error: %v", err), w.current.header.Number.Uint64(), nil)

0 commit comments

Comments
 (0)