2022-05-24 13:39:40 -05:00
|
|
|
// Copyright 2015 The go-ethereum Authors
|
2015-07-22 11:48:40 -05:00
|
|
|
// This file is part of the go-ethereum library.
|
2015-07-06 19:54:22 -05:00
|
|
|
//
|
2015-07-23 11:35:11 -05:00
|
|
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
2015-07-06 19:54:22 -05: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 11:48:40 -05:00
|
|
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
2015-07-06 19:54:22 -05:00
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-07-22 11:48:40 -05:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2015-07-06 19:54:22 -05: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 11:48:40 -05:00
|
|
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
2015-07-06 19:54:22 -05:00
|
|
|
|
2015-06-10 12:56:40 -05:00
|
|
|
package vm
|
2015-06-10 05:23:49 -05:00
|
|
|
|
|
|
|
import (
|
2016-02-03 16:46:27 -06:00
|
|
|
"math/big"
|
2015-06-10 05:23:49 -05:00
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
)
|
|
|
|
|
2021-11-05 05:48:21 -05:00
|
|
|
// EVMLogger is used to collect execution traces from an EVM transaction
|
2016-08-19 09:19:51 -05: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 05:48:21 -05:00
|
|
|
type EVMLogger interface {
|
2022-03-31 04:51:44 -05:00
|
|
|
// Transaction level
|
|
|
|
CaptureTxStart(gasLimit uint64)
|
|
|
|
CaptureTxEnd(restGas uint64)
|
|
|
|
// Top call frame
|
2021-03-25 04:13:14 -05:00
|
|
|
CaptureStart(env *EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int)
|
2022-12-05 09:57:47 -06:00
|
|
|
CaptureEnd(output []byte, gasUsed uint64, err error)
|
2022-03-31 04:51:44 -05:00
|
|
|
// 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 02:31:22 -05: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 04:51:44 -05:00
|
|
|
// Opcode level
|
|
|
|
CaptureState(pc uint64, op OpCode, gas, cost uint64, scope *ScopeContext, rData []byte, depth int, err error)
|
2021-11-09 05:09:35 -06:00
|
|
|
CaptureFault(pc uint64, op OpCode, gas, cost uint64, scope *ScopeContext, depth int, err error)
|
2016-08-19 09:19:51 -05:00
|
|
|
}
|