2022-05-24 18:39:40 +00:00
|
|
|
// Copyright 2015 The go-ethereum Authors
|
2015-07-22 16:48:40 +00:00
|
|
|
// This file is part of the go-ethereum library.
|
2015-07-07 00:54:22 +00:00
|
|
|
//
|
2015-07-23 16:35:11 +00:00
|
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
2015-07-07 00:54:22 +00:00
|
|
|
// 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.
|
|
|
|
//
|
2015-07-22 16:48:40 +00:00
|
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
2015-07-07 00:54:22 +00:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-07-22 16:48:40 +00:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2015-07-07 00:54:22 +00:00
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
2015-07-22 16:48:40 +00:00
|
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
2015-07-07 00:54:22 +00:00
|
|
|
|
2015-06-10 17:56:40 +00:00
|
|
|
package vm
|
2015-06-10 10:23:49 +00:00
|
|
|
|
|
|
|
import (
|
2016-02-03 22:46:27 +00:00
|
|
|
"math/big"
|
2017-06-07 15:09:08 +00:00
|
|
|
"time"
|
2015-06-10 10:23:49 +00:00
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
)
|
|
|
|
|
2021-11-05 10:48:21 +00:00
|
|
|
// EVMLogger is used to collect execution traces from an EVM transaction
|
2016-08-19 14:19:51 +00:00
|
|
|
// execution. CaptureState is called for each step of the VM with the
|
|
|
|
// current VM state.
|
|
|
|
// Note that reference types are actual VM data structures; make copies
|
|
|
|
// if you need to retain them beyond the current call.
|
2021-11-05 10:48:21 +00:00
|
|
|
type EVMLogger interface {
|
2022-03-31 09:51:44 +00:00
|
|
|
// Transaction level
|
|
|
|
CaptureTxStart(gasLimit uint64)
|
|
|
|
CaptureTxEnd(restGas uint64)
|
|
|
|
// Top call frame
|
2021-03-25 09:13:14 +00:00
|
|
|
CaptureStart(env *EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int)
|
2022-03-31 09:51:44 +00:00
|
|
|
CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error)
|
|
|
|
// Rest of call frames
|
core,eth: call frame tracing (#23087)
This change introduces 2 new optional methods; `enter()` and `exit()` for js tracers, and makes `step()` optiona. The two new methods are invoked when entering and exiting a call frame (but not invoked for the outermost scope, which has it's own methods). Currently these are the data fields passed to each of them:
enter: type (opcode), from, to, input, gas, value
exit: output, gasUsed, error
The PR also comes with a re-write of the callTracer. As a backup we keep the previous tracing script under the name `callTracerLegacy`. Behaviour of both tracers are equivalent for the most part, although there are some small differences (improvements), where the new tracer is more correct / has more information.
2021-09-17 07:31:22 +00:00
|
|
|
CaptureEnter(typ OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int)
|
|
|
|
CaptureExit(output []byte, gasUsed uint64, err error)
|
2022-03-31 09:51:44 +00:00
|
|
|
// Opcode level
|
|
|
|
CaptureState(pc uint64, op OpCode, gas, cost uint64, scope *ScopeContext, rData []byte, depth int, err error)
|
2021-11-09 11:09:35 +00:00
|
|
|
CaptureFault(pc uint64, op OpCode, gas, cost uint64, scope *ScopeContext, depth int, err error)
|
2016-08-19 14:19:51 +00:00
|
|
|
}
|