github.com/MetalBlockchain/subnet-evm@v0.4.9/core/vm/logger.go (about)

     1  // (c) 2019-2020, Ava Labs, Inc.
     2  //
     3  // This file is a derived work, based on the go-ethereum library whose original
     4  // notices appear below.
     5  //
     6  // It is distributed under a license compatible with the licensing terms of the
     7  // original code from which it is derived.
     8  //
     9  // Much love to the original authors for their work.
    10  // **********
    11  // Copyright 2015 The go-ethereum Authors
    12  // This file is part of the go-ethereum library.
    13  //
    14  // The go-ethereum library is free software: you can redistribute it and/or modify
    15  // it under the terms of the GNU Lesser General Public License as published by
    16  // the Free Software Foundation, either version 3 of the License, or
    17  // (at your option) any later version.
    18  //
    19  // The go-ethereum library is distributed in the hope that it will be useful,
    20  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    21  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    22  // GNU Lesser General Public License for more details.
    23  //
    24  // You should have received a copy of the GNU Lesser General Public License
    25  // along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
    26  
    27  package vm
    28  
    29  import (
    30  	"math/big"
    31  	"time"
    32  
    33  	"github.com/ethereum/go-ethereum/common"
    34  )
    35  
    36  // EVMLogger is used to collect execution traces from an EVM transaction
    37  // execution. CaptureState is called for each step of the VM with the
    38  // current VM state.
    39  // Note that reference types are actual VM data structures; make copies
    40  // if you need to retain them beyond the current call.
    41  type EVMLogger interface {
    42  	// Transaction level
    43  	CaptureTxStart(gasLimit uint64)
    44  	CaptureTxEnd(restGas uint64)
    45  	// Top call frame
    46  	CaptureStart(env *EVM, from common.Address, to common.Address, create bool, input []byte, gas uint64, value *big.Int)
    47  	CaptureEnd(output []byte, gasUsed uint64, t time.Duration, err error)
    48  	// Rest of call frames
    49  	CaptureEnter(typ OpCode, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int)
    50  	CaptureExit(output []byte, gasUsed uint64, err error)
    51  	// Opcode level
    52  	CaptureState(pc uint64, op OpCode, gas, cost uint64, scope *ScopeContext, rData []byte, depth int, err error)
    53  	CaptureFault(pc uint64, op OpCode, gas, cost uint64, scope *ScopeContext, depth int, err error)
    54  }