go-ethereum/eth/tracers/native/noop.go
HAOYUatHZ 4ebc036d75
feat: add scroll trace (#620)
* add rollup/tracing/tracing.go

* update eth/tracers/logger/access_list_tracer.go

* update core/types/l2trace.go

* update core/vm/evm.go

* update core/evm.go

* update core/vm/interpreter.go

* update eth/tracers/logger/logger_json.go

* update core/vm/logger_trace.go

* mv core/vm/logger_trace.go

mv core/vm/logger_trace.go

* update eth/tracers/api_blocktrace.go

* update eth/tracers/js/tracer.go

* update `EVMLogger` interface

* fix `JSONLogger`'s `CaptureStateAfter`

* fix `OpcodeExecs`

* minor fixes

* fix eth/tracers/api_blocktrace.go

* comment out eth/tracers/logger/logger_trace.go

* fix

* update eth/tracers/api.go

* some renamings

* update cmd/utils/flags.go

* update rollup/tracing/tracing.go WIP

* fix interface

* minor

* fix `FormatLogs`

* Fix tracers (#663)

* export `CallTracer`

* export `CallTracer`

* export `PrestateTracer`

* export `MuxTracer`

* refactor

* merge `StructLogRes` (#662)

* merge `StructLogRes`

* clean up

* fix

* fix

* update core/block_validator.go

* update ethclient/ethclient.go

* merge `ExecutionResult` (#667)

* merge `ExecutionResult`

* fix l1datafee

* fix eth/tracers/api_test.go (#669)

* clean up

* WIP: update eth/tracers/logger/logger.go

* update `CaptureStart`

* update `CaptureExit`

* init `CaptureEnter`

* update `CaptureEnter` 1

* fix `CaptureEnter` 1

* fix depth

* fix `CaptureEnter` 2

* update `CaptureEnter` 2
2024-03-16 10:26:10 +08:00

85 lines
3.3 KiB
Go

// Copyright 2021 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/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/eth/tracers"
)
func init() {
tracers.DefaultDirectory.Register("noopTracer", newNoopTracer, false)
}
// noopTracer is a go implementation of the Tracer interface which
// performs no action. It's mostly useful for testing purposes.
type noopTracer struct{}
// newNoopTracer returns a new noop tracer.
func newNoopTracer(ctx *tracers.Context, _ json.RawMessage) (tracers.Tracer, error) {
return &noopTracer{}, nil
}
// CaptureStart implements the EVMLogger interface to initialize the tracing operation.
func (t *noopTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int) {
}
// CaptureEnd is called after the call finishes to finalize the tracing.
func (t *noopTracer) CaptureEnd(output []byte, gasUsed uint64, err error) {
}
// CaptureState implements the EVMLogger interface to trace a single step of VM execution.
func (t *noopTracer) CaptureState(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 *noopTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, _ *vm.ScopeContext, depth int, err error) {
}
// CaptureStateAfter for special needs, tracks SSTORE ops and records the storage change.
func (t *noopTracer) CaptureStateAfter(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) {
}
// CaptureEnter is called when EVM enters a new scope (via call, create or selfdestruct).
func (t *noopTracer) CaptureEnter(typ vm.OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) {
}
// CaptureExit is called when EVM exits a scope, even if the scope didn't
// execute any code.
func (t *noopTracer) CaptureExit(output []byte, gasUsed uint64, err error) {
}
func (*noopTracer) CaptureTxStart(gasLimit uint64) {}
func (*noopTracer) CaptureTxEnd(restGas uint64) {}
// GetResult returns an empty json object.
func (t *noopTracer) GetResult() (json.RawMessage, error) {
return json.RawMessage(`{}`), nil
}
func (t *noopTracer) GetResultWithL1DataFee(l1DataFee *big.Int) (json.RawMessage, error) {
panic("not supported")
}
// Stop terminates execution of the tracer at the first opportune moment.
func (t *noopTracer) Stop(err error) {
}