mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 10:22:23 +00:00
* add rollup/ccc/logger.go * update Cargo.toml & Cargo.lock * update miner/miner.go * update miner/miner_test.go * update eth/backend.go * update `Message` type * update interfaces.go * update core/rawdb/accessors_row_consumption.go * update evm.go * update accounts/abi/bind/backends/simulated.go * fix rollup/ccc/logger.go * update core/state_processor.go * update rollup/ccc/async_checker_test.go * update rollup/ccc/async_checker.go * scroll_worker: var * scroll_worker: work * scroll_worker: reorgTrigger * scroll_worker: worker * scroll_worker: newWorker * scroll_worker: rm getCCC * scroll_worker: checkHeadRowConsumption * scroll_worker: mainLoop * scroll_worker: updateSnapshot * scroll_worker: newWork * scroll_worker: handlePipelineResult * scroll_worker: tryCommitNewWork * scroll_worker: handleForks * scroll_worker: processTxPool * scroll_worker: processTxnSlice * scroll_worker: processReorgedTxns * scroll_worker: processTxns * scroll_worker: processTxn * scroll_worker: commit * scroll_worker: onTxFailing * scroll_worker: skipTransaction * scroll_worker: forceTestErr, scheduleCCCError, skip, onBlockFailingCCC, handleReorg, isCanonical * scroll_worker: fix 1 * scroll_worker: fix 2 * scroll_worker: fix 3 * scroll_worker: fix 4 * scroll_worker: fix 5 * scroll_worker: fix 6 * scroll_worker: fix 7 * fix: disable headCCCCheck for follower nodes * feat: double check ancestor RowConsumption before committing * feat: add miner idle metric * fix: nil-check curRc * fix: skip ccc.ErrUnknown txns immediately * fix: increase keccak usage safety buffer * fix: ignore RC check if force committing * fix: properly handle wrapped retryable errors
155 lines
4.8 KiB
Go
155 lines
4.8 KiB
Go
// Copyright 2022 The go-ethereum Authors
|
|
// This file is part of the go-ethereum library.
|
|
//
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU Lesser General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
package native
|
|
|
|
import (
|
|
"encoding/json"
|
|
"math/big"
|
|
|
|
"github.com/scroll-tech/go-ethereum/common"
|
|
"github.com/scroll-tech/go-ethereum/core/vm"
|
|
"github.com/scroll-tech/go-ethereum/eth/tracers"
|
|
)
|
|
|
|
func init() {
|
|
tracers.DefaultDirectory.Register("muxTracer", newMuxTracer, false)
|
|
}
|
|
|
|
// MuxTracer is a go implementation of the Tracer interface which
|
|
// runs multiple tracers in one go.
|
|
type MuxTracer struct {
|
|
names []string
|
|
tracers []tracers.Tracer
|
|
}
|
|
|
|
func (mt *MuxTracer) Append(name string, tracer tracers.Tracer) {
|
|
mt.names = append(mt.names, name)
|
|
mt.tracers = append(mt.tracers, tracer)
|
|
}
|
|
|
|
// newMuxTracer returns a new mux tracer.
|
|
func newMuxTracer(ctx *tracers.Context, cfg json.RawMessage) (tracers.Tracer, error) {
|
|
var config map[string]json.RawMessage
|
|
if cfg != nil {
|
|
if err := json.Unmarshal(cfg, &config); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
objects := make([]tracers.Tracer, 0, len(config))
|
|
names := make([]string, 0, len(config))
|
|
for k, v := range config {
|
|
t, err := tracers.DefaultDirectory.New(k, ctx, v)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
objects = append(objects, t)
|
|
names = append(names, k)
|
|
}
|
|
|
|
return &MuxTracer{names: names, tracers: objects}, nil
|
|
}
|
|
|
|
// CaptureStart implements the EVMLogger interface to initialize the tracing operation.
|
|
func (t *MuxTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) {
|
|
for _, t := range t.tracers {
|
|
t.CaptureStart(env, from, to, create, input, gas, value)
|
|
}
|
|
}
|
|
|
|
// CaptureEnd is called after the call finishes to finalize the tracing.
|
|
func (t *MuxTracer) CaptureEnd(output []byte, gasUsed uint64, err error) {
|
|
for _, t := range t.tracers {
|
|
t.CaptureEnd(output, gasUsed, err)
|
|
}
|
|
}
|
|
|
|
// CaptureState implements the EVMLogger interface to trace a single step of VM execution.
|
|
func (t *MuxTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) {
|
|
for _, t := range t.tracers {
|
|
t.CaptureState(pc, op, gas, cost, scope, rData, depth, err)
|
|
}
|
|
}
|
|
|
|
// CaptureStateAfter for special needs, tracks SSTORE ops and records the storage change.
|
|
func (t *MuxTracer) CaptureStateAfter(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) {
|
|
}
|
|
|
|
// CaptureFault implements the EVMLogger interface to trace an execution fault.
|
|
func (t *MuxTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error) {
|
|
for _, t := range t.tracers {
|
|
t.CaptureFault(pc, op, gas, cost, scope, depth, err)
|
|
}
|
|
}
|
|
|
|
// CaptureEnter is called when EVM enters a new scope (via call, create or selfdestruct).
|
|
func (t *MuxTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
|
|
for _, t := range t.tracers {
|
|
t.CaptureEnter(typ, from, to, input, gas, value)
|
|
}
|
|
}
|
|
|
|
// CaptureExit is called when EVM exits a scope, even if the scope didn't
|
|
// execute any code.
|
|
func (t *MuxTracer) CaptureExit(output []byte, gasUsed uint64, err error) {
|
|
for _, t := range t.tracers {
|
|
t.CaptureExit(output, gasUsed, err)
|
|
}
|
|
}
|
|
|
|
func (t *MuxTracer) CaptureTxStart(gasLimit uint64) {
|
|
for _, t := range t.tracers {
|
|
t.CaptureTxStart(gasLimit)
|
|
}
|
|
}
|
|
|
|
func (t *MuxTracer) CaptureTxEnd(restGas uint64) {
|
|
for _, t := range t.tracers {
|
|
t.CaptureTxEnd(restGas)
|
|
}
|
|
}
|
|
|
|
func (t *MuxTracer) IsDebug() bool {
|
|
return false
|
|
}
|
|
|
|
// GetResult returns an empty json object.
|
|
func (t *MuxTracer) GetResult() (json.RawMessage, error) {
|
|
resObject := make(map[string]json.RawMessage)
|
|
for i, tt := range t.tracers {
|
|
r, err := tt.GetResult()
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
resObject[t.names[i]] = r
|
|
}
|
|
res, err := json.Marshal(resObject)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return res, nil
|
|
}
|
|
|
|
func (t *MuxTracer) GetResultWithL1DataFee(l1DataFee *big.Int) (json.RawMessage, error) {
|
|
panic("not supported")
|
|
}
|
|
|
|
// Stop terminates execution of the tracer at the first opportune moment.
|
|
func (t *MuxTracer) Stop(err error) {
|
|
for _, t := range t.tracers {
|
|
t.Stop(err)
|
|
}
|
|
}
|