diff --git a/core/block_validator.go b/core/block_validator.go index dd31b11eac..16f5b20301 100644 --- a/core/block_validator.go +++ b/core/block_validator.go @@ -108,6 +108,12 @@ func (v *BlockValidator) ValidateBody(block *types.Block) error { if err != nil { return err } + log.Trace( + "Validator write block row consumption", + "id", v.circuitCapacityChecker.ID, + "sealHash", block.Hash().String(), + "rowConsumption", rowConsumption, + ) rawdb.WriteBlockRowConsumption(v.db, block.Hash(), rowConsumption) } return nil @@ -263,6 +269,14 @@ func (v *BlockValidator) createTraceEnv(block *types.Block) (*TraceEnv, error) { } func (v *BlockValidator) validateCircuitRowConsumption(block *types.Block) (*types.RowConsumption, error) { + log.Trace( + "Validator apply ccc for block", + "id", v.circuitCapacityChecker.ID, + "number", block.Number(), + "hash", block.Hash().String(), + "len(txs)", block.Transactions().Len(), + ) + env, err := v.createTraceEnv(block) if err != nil { return nil, err @@ -277,5 +291,18 @@ func (v *BlockValidator) validateCircuitRowConsumption(block *types.Block) (*typ defer v.cMu.Unlock() v.circuitCapacityChecker.Reset() - return v.circuitCapacityChecker.ApplyBlock(traces) + log.Trace("Validator reset ccc") + rc, err := v.circuitCapacityChecker.ApplyBlock(traces) + + log.Trace( + "Validator apply ccc for block result", + "id", v.circuitCapacityChecker.ID, + "number", block.Number(), + "hash", block.Hash().String(), + "len(txs)", block.Transactions().Len(), + "rc", rc, + "err", err, + ) + + return rc, err } diff --git a/miner/worker.go b/miner/worker.go index 285c42cb65..42c2d4cbc0 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -644,6 +644,12 @@ func (w *worker) taskLoop() { rawdb.WriteFirstQueueIndexNotInL2Block(w.eth.ChainDb(), sealHash, task.maxL1Index+1) // Store circuit row consumption. + log.Trace( + "Worker write block row consumption", + "id", w.circuitCapacityChecker.ID, + "sealHash", sealHash.String(), + "accRows", task.accRows, + ) rawdb.WriteBlockRowConsumption(w.eth.ChainDb(), sealHash, task.accRows) } case <-w.exitCh: @@ -834,6 +840,12 @@ func (w *worker) updateSnapshot() { func (w *worker) commitTransaction(tx *types.Transaction, coinbase common.Address) ([]*types.Log, error) { snap := w.current.state.Snapshot() + log.Trace( + "Worker apply ccc for tx", + "id", w.circuitCapacityChecker.ID, + "txhash", tx.Hash(), + ) + // has to check circuit capacity before `core.ApplyTransaction`, // because if the tx can be successfully executed but circuit capacity overflows, it will be inconvenient to revert traces, err := w.current.traceEnv.GetBlockTrace( @@ -850,6 +862,12 @@ func (w *worker) commitTransaction(tx *types.Transaction, coinbase common.Addres w.current.state.RevertToSnapshot(snap) return nil, err } + log.Trace( + "Worker apply ccc for tx result", + "id", w.circuitCapacityChecker.ID, + "txhash", tx.Hash(), + "accRows", accRows, + ) // revert to snapshot for calling `core.ApplyMessage` again, (both `traceEnv.GetBlockTrace` & `core.ApplyTransaction` will call `core.ApplyMessage`) w.current.state.RevertToSnapshot(snap) @@ -1061,6 +1079,7 @@ func (w *worker) commitNewWork(interrupt *int32, noempty bool, timestamp int64) tstart := time.Now() parent := w.chain.CurrentBlock() w.circuitCapacityChecker.Reset() + log.Trace("Worker reset ccc") if parent.Time() >= uint64(timestamp) { timestamp = int64(parent.Time() + 1) @@ -1229,6 +1248,12 @@ func (w *worker) commit(uncles []*types.Header, interval func(), update bool, st // set w.current.accRows for empty-but-not-genesis block if (w.current.header.Number.Uint64() != 0) && (w.current.accRows == nil || len(*w.current.accRows) == 0) { + log.Trace( + "Worker apply ccc for empty block", + "id", w.circuitCapacityChecker.ID, + "number", w.current.header.Number, + "hash", w.current.header.Hash().String(), + ) traces, err := w.current.traceEnv.GetBlockTrace(types.NewBlockWithHeader(w.current.header)) if err != nil { return err @@ -1241,6 +1266,13 @@ func (w *worker) commit(uncles []*types.Header, interval func(), update bool, st if err != nil { return err } + log.Trace( + "Worker apply ccc for empty block result", + "id", w.circuitCapacityChecker.ID, + "number", w.current.header.Number, + "hash", w.current.header.Hash().String(), + "accRows", accRows, + ) w.current.accRows = accRows } diff --git a/params/version.go b/params/version.go index aa64a808f3..b8890c4af4 100644 --- a/params/version.go +++ b/params/version.go @@ -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 = 16 // Patch version component of the current release + VersionPatch = 17 // Patch version component of the current release VersionMeta = "sepolia" // Version metadata to append to the version string )