mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
refactor: add more ccc logs (#436)
* refactor: add more ccc logs * format hashes * more logs * more logs
This commit is contained in:
parent
f87eb3127a
commit
5611b8296a
3 changed files with 61 additions and 2 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue