mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-13 23:43:47 +00:00
rename LiveLogger to hooks
This commit is contained in:
parent
7d8db9b503
commit
a2829c6f49
30 changed files with 51 additions and 51 deletions
|
|
@ -51,7 +51,7 @@ func blockTestCmd(ctx *cli.Context) error {
|
||||||
return errors.New("path-to-test argument required")
|
return errors.New("path-to-test argument required")
|
||||||
}
|
}
|
||||||
|
|
||||||
var tracer *tracing.LiveLogger
|
var tracer *tracing.Hooks
|
||||||
// Configure the EVM logger
|
// Configure the EVM logger
|
||||||
if ctx.Bool(MachineFlag.Name) {
|
if ctx.Bool(MachineFlag.Name) {
|
||||||
tracer = logger.NewJSONLogger(&logger.Config{
|
tracer = logger.NewJSONLogger(&logger.Config{
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
||||||
return nil, nil, nil, err
|
return nil, nil, nil, err
|
||||||
}
|
}
|
||||||
if vmConfig.Tracer != nil {
|
if vmConfig.Tracer != nil {
|
||||||
vmConfig.Tracer = tracer.LiveLogger
|
vmConfig.Tracer = tracer.Hooks
|
||||||
}
|
}
|
||||||
statedb.SetTxContext(tx.Hash(), txIndex)
|
statedb.SetTxContext(tx.Hash(), txIndex)
|
||||||
|
|
||||||
|
|
@ -301,7 +301,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
||||||
receipt.TransactionIndex = uint(txIndex)
|
receipt.TransactionIndex = uint(txIndex)
|
||||||
receipts = append(receipts, receipt)
|
receipts = append(receipts, receipt)
|
||||||
if tracer != nil {
|
if tracer != nil {
|
||||||
tracer.LiveLogger.CaptureTxEnd(receipt, nil)
|
tracer.Hooks.CaptureTxEnd(receipt, nil)
|
||||||
writeTraceResult(tracer, traceOutput)
|
writeTraceResult(tracer, traceOutput)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ func Transition(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
logger := logger.NewJSONLogger(logConfig, traceFile).Logger()
|
logger := logger.NewJSONLogger(logConfig, traceFile).Logger()
|
||||||
tracer := &directory.Tracer{
|
tracer := &directory.Tracer{
|
||||||
LiveLogger: logger,
|
Hooks: logger,
|
||||||
// JSONLogger streams out result to file.
|
// JSONLogger streams out result to file.
|
||||||
GetResult: func() (json.RawMessage, error) { return nil, nil },
|
GetResult: func() (json.RawMessage, error) { return nil, nil },
|
||||||
Stop: func(err error) {},
|
Stop: func(err error) {},
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,7 @@ func runCmd(ctx *cli.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
tracer *tracing.LiveLogger
|
tracer *tracing.Hooks
|
||||||
debugLogger *logger.StructLogger
|
debugLogger *logger.StructLogger
|
||||||
statedb *state.StateDB
|
statedb *state.StateDB
|
||||||
chainConfig *params.ChainConfig
|
chainConfig *params.ChainConfig
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,7 @@ type BlockChain struct {
|
||||||
processor Processor // Block transaction processor interface
|
processor Processor // Block transaction processor interface
|
||||||
forker *ForkChoice
|
forker *ForkChoice
|
||||||
vmConfig vm.Config
|
vmConfig vm.Config
|
||||||
logger *tracing.LiveLogger
|
logger *tracing.Hooks
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBlockChain returns a fully initialised block chain using information
|
// NewBlockChain returns a fully initialised block chain using information
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ type StateDB struct {
|
||||||
prefetcher *triePrefetcher
|
prefetcher *triePrefetcher
|
||||||
trie Trie
|
trie Trie
|
||||||
hasher crypto.KeccakState
|
hasher crypto.KeccakState
|
||||||
logger *tracing.LiveLogger
|
logger *tracing.Hooks
|
||||||
snaps *snapshot.Tree // Nil if snapshot is not available
|
snaps *snapshot.Tree // Nil if snapshot is not available
|
||||||
snap snapshot.Snapshot // Nil if snapshot is not available
|
snap snapshot.Snapshot // Nil if snapshot is not available
|
||||||
|
|
||||||
|
|
@ -176,7 +176,7 @@ func New(root common.Hash, db Database, snaps *snapshot.Tree) (*StateDB, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetLogger sets the logger for account update hooks.
|
// SetLogger sets the logger for account update hooks.
|
||||||
func (s *StateDB) SetLogger(l *tracing.LiveLogger) {
|
func (s *StateDB) SetLogger(l *tracing.Hooks) {
|
||||||
s.logger = l
|
s.logger = l
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ type BlockEvent struct {
|
||||||
// TODO: provide utils for consumers
|
// TODO: provide utils for consumers
|
||||||
type OpCode byte
|
type OpCode byte
|
||||||
|
|
||||||
type LiveLogger struct {
|
type Hooks struct {
|
||||||
/*
|
/*
|
||||||
- VM events -
|
- VM events -
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ func (c *Contract) Caller() common.Address {
|
||||||
}
|
}
|
||||||
|
|
||||||
// UseGas attempts the use gas and subtracts it and returns true on success
|
// UseGas attempts the use gas and subtracts it and returns true on success
|
||||||
func (c *Contract) UseGas(gas uint64, logger *tracing.LiveLogger, reason tracing.GasChangeReason) (ok bool) {
|
func (c *Contract) UseGas(gas uint64, logger *tracing.Hooks, reason tracing.GasChangeReason) (ok bool) {
|
||||||
if c.Gas < gas {
|
if c.Gas < gas {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ func ActivePrecompiles(rules params.Rules) []common.Address {
|
||||||
// - the returned bytes,
|
// - the returned bytes,
|
||||||
// - the _remaining_ gas,
|
// - the _remaining_ gas,
|
||||||
// - any error that occurred
|
// - any error that occurred
|
||||||
func RunPrecompiledContract(p PrecompiledContract, input []byte, suppliedGas uint64, logger *tracing.LiveLogger) (ret []byte, remainingGas uint64, err error) {
|
func RunPrecompiledContract(p PrecompiledContract, input []byte, suppliedGas uint64, logger *tracing.Hooks) (ret []byte, remainingGas uint64, err error) {
|
||||||
gasCost := p.RequiredGas(input)
|
gasCost := p.RequiredGas(input)
|
||||||
if suppliedGas < gasCost {
|
if suppliedGas < gasCost {
|
||||||
return nil, 0, ErrOutOfGas
|
return nil, 0, ErrOutOfGas
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ import (
|
||||||
|
|
||||||
// Config are the configuration options for the Interpreter
|
// Config are the configuration options for the Interpreter
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Tracer *tracing.LiveLogger
|
Tracer *tracing.Hooks
|
||||||
NoBaseFee bool // Forces the EIP-1559 baseFee to 0 (needed for 0 price calls)
|
NoBaseFee bool // Forces the EIP-1559 baseFee to 0 (needed for 0 price calls)
|
||||||
EnablePreimageRecording bool // Enables recording of SHA3/keccak preimages
|
EnablePreimageRecording bool // Enables recording of SHA3/keccak preimages
|
||||||
ExtraEips []int // Additional EIPS that are to be enabled
|
ExtraEips []int // Additional EIPS that are to be enabled
|
||||||
|
|
|
||||||
|
|
@ -143,7 +143,7 @@ type Config struct {
|
||||||
EnablePreimageRecording bool
|
EnablePreimageRecording bool
|
||||||
|
|
||||||
// Enables VM tracing
|
// Enables VM tracing
|
||||||
VMTracer *tracing.LiveLogger
|
VMTracer *tracing.Hooks
|
||||||
|
|
||||||
// Miscellaneous options
|
// Miscellaneous options
|
||||||
DocRoot string `toml:"-"`
|
DocRoot string `toml:"-"`
|
||||||
|
|
|
||||||
|
|
@ -957,8 +957,8 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vmenv := vm.NewEVM(vmctx, vm.TxContext{GasPrice: big.NewInt(0)}, statedb, api.backend.ChainConfig(), vm.Config{Tracer: tracer.LiveLogger, NoBaseFee: true})
|
vmenv := vm.NewEVM(vmctx, vm.TxContext{GasPrice: big.NewInt(0)}, statedb, api.backend.ChainConfig(), vm.Config{Tracer: tracer.Hooks, NoBaseFee: true})
|
||||||
statedb.SetLogger(tracer.LiveLogger)
|
statedb.SetLogger(tracer.Hooks)
|
||||||
|
|
||||||
// Define a meaningful timeout of a single transaction trace
|
// Define a meaningful timeout of a single transaction trace
|
||||||
if config.Timeout != nil {
|
if config.Timeout != nil {
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core/tracing"
|
"github.com/ethereum/go-ethereum/core/tracing"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ctorFunc func(config json.RawMessage) (*tracing.LiveLogger, error)
|
type ctorFunc func(config json.RawMessage) (*tracing.Hooks, error)
|
||||||
|
|
||||||
// Directory is the collection of tracers which can be used
|
// Directory is the collection of tracers which can be used
|
||||||
// during normal block import operations.
|
// during normal block import operations.
|
||||||
|
|
@ -23,7 +23,7 @@ func (d *directory) Register(name string, f ctorFunc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// New instantiates a tracer by name.
|
// New instantiates a tracer by name.
|
||||||
func (d *directory) New(name string, config json.RawMessage) (*tracing.LiveLogger, error) {
|
func (d *directory) New(name string, config json.RawMessage) (*tracing.Hooks, error) {
|
||||||
if f, ok := d.elems[name]; ok {
|
if f, ok := d.elems[name]; ok {
|
||||||
return f(config)
|
return f(config)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ type NoopTracer struct{}
|
||||||
func newNoopTracer(ctx *Context, _ json.RawMessage) (*Tracer, error) {
|
func newNoopTracer(ctx *Context, _ json.RawMessage) (*Tracer, error) {
|
||||||
t := &NoopTracer{}
|
t := &NoopTracer{}
|
||||||
return &Tracer{
|
return &Tracer{
|
||||||
LiveLogger: &tracing.LiveLogger{
|
Hooks: &tracing.Hooks{
|
||||||
CaptureTxStart: t.CaptureTxStart,
|
CaptureTxStart: t.CaptureTxStart,
|
||||||
CaptureTxEnd: t.CaptureTxEnd,
|
CaptureTxEnd: t.CaptureTxEnd,
|
||||||
CaptureStart: t.CaptureStart,
|
CaptureStart: t.CaptureStart,
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ type Context struct {
|
||||||
// This involves a method to retrieve results and one to
|
// This involves a method to retrieve results and one to
|
||||||
// stop tracing.
|
// stop tracing.
|
||||||
type Tracer struct {
|
type Tracer struct {
|
||||||
*tracing.LiveLogger
|
*tracing.Hooks
|
||||||
GetResult func() (json.RawMessage, error)
|
GetResult func() (json.RawMessage, error)
|
||||||
// Stop terminates execution of the tracer at the first opportune moment.
|
// Stop terminates execution of the tracer at the first opportune moment.
|
||||||
Stop func(err error)
|
Stop func(err error)
|
||||||
|
|
|
||||||
|
|
@ -144,12 +144,12 @@ func testCallTracer(tracerName string, dirPath string, t *testing.T) {
|
||||||
t.Fatalf("failed to create call tracer: %v", err)
|
t.Fatalf("failed to create call tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
state.StateDB.SetLogger(tracer.LiveLogger)
|
state.StateDB.SetLogger(tracer.Hooks)
|
||||||
msg, err := core.TransactionToMessage(tx, signer, context.BaseFee)
|
msg, err := core.TransactionToMessage(tx, signer, context.BaseFee)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to prepare transaction for tracing: %v", err)
|
t.Fatalf("failed to prepare transaction for tracing: %v", err)
|
||||||
}
|
}
|
||||||
evm := vm.NewEVM(context, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.LiveLogger})
|
evm := vm.NewEVM(context, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.Hooks})
|
||||||
tracer.CaptureTxStart(evm.GetVMContext(), tx, msg.From)
|
tracer.CaptureTxStart(evm.GetVMContext(), tx, msg.From)
|
||||||
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -251,7 +251,7 @@ func benchTracer(tracerName string, test *callTracerTest, b *testing.B) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatalf("failed to create call tracer: %v", err)
|
b.Fatalf("failed to create call tracer: %v", err)
|
||||||
}
|
}
|
||||||
evm := vm.NewEVM(context, txContext, state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.LiveLogger})
|
evm := vm.NewEVM(context, txContext, state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.Hooks})
|
||||||
snap := state.StateDB.Snapshot()
|
snap := state.StateDB.Snapshot()
|
||||||
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
||||||
if _, err = st.TransitionDb(); err != nil {
|
if _, err = st.TransitionDb(); err != nil {
|
||||||
|
|
@ -379,7 +379,7 @@ func TestInternals(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, false, rawdb.HashScheme)
|
}, false, rawdb.HashScheme)
|
||||||
defer state.Close()
|
defer state.Close()
|
||||||
state.StateDB.SetLogger(tc.tracer.LiveLogger)
|
state.StateDB.SetLogger(tc.tracer.Hooks)
|
||||||
tx, err := types.SignNewTx(key, signer, &types.LegacyTx{
|
tx, err := types.SignNewTx(key, signer, &types.LegacyTx{
|
||||||
To: &to,
|
To: &to,
|
||||||
Value: big.NewInt(0),
|
Value: big.NewInt(0),
|
||||||
|
|
@ -393,7 +393,7 @@ func TestInternals(t *testing.T) {
|
||||||
Origin: origin,
|
Origin: origin,
|
||||||
GasPrice: tx.GasPrice(),
|
GasPrice: tx.GasPrice(),
|
||||||
}
|
}
|
||||||
evm := vm.NewEVM(context, txContext, state.StateDB, config, vm.Config{Tracer: tc.tracer.LiveLogger})
|
evm := vm.NewEVM(context, txContext, state.StateDB, config, vm.Config{Tracer: tc.tracer.Hooks})
|
||||||
msg, err := core.TransactionToMessage(tx, signer, big.NewInt(0))
|
msg, err := core.TransactionToMessage(tx, signer, big.NewInt(0))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("test %v: failed to create message: %v", tc.name, err)
|
t.Fatalf("test %v: failed to create message: %v", tc.name, err)
|
||||||
|
|
|
||||||
|
|
@ -102,12 +102,12 @@ func flatCallTracerTestRunner(tracerName string, filename string, dirPath string
|
||||||
return fmt.Errorf("failed to create call tracer: %v", err)
|
return fmt.Errorf("failed to create call tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
state.StateDB.SetLogger(tracer.LiveLogger)
|
state.StateDB.SetLogger(tracer.Hooks)
|
||||||
msg, err := core.TransactionToMessage(tx, signer, context.BaseFee)
|
msg, err := core.TransactionToMessage(tx, signer, context.BaseFee)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to prepare transaction for tracing: %v", err)
|
return fmt.Errorf("failed to prepare transaction for tracing: %v", err)
|
||||||
}
|
}
|
||||||
evm := vm.NewEVM(context, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.LiveLogger})
|
evm := vm.NewEVM(context, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.Hooks})
|
||||||
tracer.CaptureTxStart(evm.GetVMContext(), tx, msg.From)
|
tracer.CaptureTxStart(evm.GetVMContext(), tx, msg.From)
|
||||||
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -112,12 +112,12 @@ func testPrestateDiffTracer(tracerName string, dirPath string, t *testing.T) {
|
||||||
t.Fatalf("failed to create call tracer: %v", err)
|
t.Fatalf("failed to create call tracer: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
state.StateDB.SetLogger(tracer.LiveLogger)
|
state.StateDB.SetLogger(tracer.Hooks)
|
||||||
msg, err := core.TransactionToMessage(tx, signer, context.BaseFee)
|
msg, err := core.TransactionToMessage(tx, signer, context.BaseFee)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to prepare transaction for tracing: %v", err)
|
t.Fatalf("failed to prepare transaction for tracing: %v", err)
|
||||||
}
|
}
|
||||||
evm := vm.NewEVM(context, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.LiveLogger})
|
evm := vm.NewEVM(context, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.Hooks})
|
||||||
tracer.CaptureTxStart(evm.GetVMContext(), tx, msg.From)
|
tracer.CaptureTxStart(evm.GetVMContext(), tx, msg.From)
|
||||||
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,7 @@ func newJsTracer(code string, ctx *directory.Context, cfg json.RawMessage) (*dir
|
||||||
t.logValue = t.log.setupObject()
|
t.logValue = t.log.setupObject()
|
||||||
|
|
||||||
return &directory.Tracer{
|
return &directory.Tracer{
|
||||||
LiveLogger: &tracing.LiveLogger{
|
Hooks: &tracing.Hooks{
|
||||||
CaptureTxStart: t.CaptureTxStart,
|
CaptureTxStart: t.CaptureTxStart,
|
||||||
CaptureTxEnd: t.CaptureTxEnd,
|
CaptureTxEnd: t.CaptureTxEnd,
|
||||||
CaptureStart: t.CaptureStart,
|
CaptureStart: t.CaptureStart,
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ func testCtx() *vmContext {
|
||||||
|
|
||||||
func runTrace(tracer *directory.Tracer, vmctx *vmContext, chaincfg *params.ChainConfig, contractCode []byte) (json.RawMessage, error) {
|
func runTrace(tracer *directory.Tracer, vmctx *vmContext, chaincfg *params.ChainConfig, contractCode []byte) (json.RawMessage, error) {
|
||||||
var (
|
var (
|
||||||
env = vm.NewEVM(vmctx.blockCtx, vmctx.txCtx, &dummyStatedb{}, chaincfg, vm.Config{Tracer: tracer.LiveLogger})
|
env = vm.NewEVM(vmctx.blockCtx, vmctx.txCtx, &dummyStatedb{}, chaincfg, vm.Config{Tracer: tracer.Hooks})
|
||||||
gasLimit uint64 = 31000
|
gasLimit uint64 = 31000
|
||||||
startGas uint64 = 10000
|
startGas uint64 = 10000
|
||||||
value = uint256.NewInt(0)
|
value = uint256.NewInt(0)
|
||||||
|
|
@ -186,7 +186,7 @@ func TestHaltBetweenSteps(t *testing.T) {
|
||||||
scope := &vm.ScopeContext{
|
scope := &vm.ScopeContext{
|
||||||
Contract: vm.NewContract(&account{}, &account{}, uint256.NewInt(0), 0),
|
Contract: vm.NewContract(&account{}, &account{}, uint256.NewInt(0), 0),
|
||||||
}
|
}
|
||||||
env := vm.NewEVM(vm.BlockContext{BlockNumber: big.NewInt(1)}, vm.TxContext{GasPrice: big.NewInt(1)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Tracer: tracer.LiveLogger})
|
env := vm.NewEVM(vm.BlockContext{BlockNumber: big.NewInt(1)}, vm.TxContext{GasPrice: big.NewInt(1)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Tracer: tracer.Hooks})
|
||||||
tracer.CaptureTxStart(env.GetVMContext(), types.NewTx(&types.LegacyTx{}), common.Address{})
|
tracer.CaptureTxStart(env.GetVMContext(), types.NewTx(&types.LegacyTx{}), common.Address{})
|
||||||
tracer.CaptureStart(common.Address{}, common.Address{}, false, []byte{}, 0, big.NewInt(0))
|
tracer.CaptureStart(common.Address{}, common.Address{}, false, []byte{}, 0, big.NewInt(0))
|
||||||
tracer.CaptureState(0, 0, 0, 0, scope, nil, 0, nil)
|
tracer.CaptureState(0, 0, 0, 0, scope, nil, 0, nil)
|
||||||
|
|
@ -208,7 +208,7 @@ func TestNoStepExec(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
env := vm.NewEVM(vm.BlockContext{BlockNumber: big.NewInt(1)}, vm.TxContext{GasPrice: big.NewInt(100)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Tracer: tracer.LiveLogger})
|
env := vm.NewEVM(vm.BlockContext{BlockNumber: big.NewInt(1)}, vm.TxContext{GasPrice: big.NewInt(100)}, &dummyStatedb{}, params.TestChainConfig, vm.Config{Tracer: tracer.Hooks})
|
||||||
tracer.CaptureTxStart(env.GetVMContext(), types.NewTx(&types.LegacyTx{}), common.Address{})
|
tracer.CaptureTxStart(env.GetVMContext(), types.NewTx(&types.LegacyTx{}), common.Address{})
|
||||||
tracer.CaptureStart(common.Address{}, common.Address{}, false, []byte{}, 1000, big.NewInt(0))
|
tracer.CaptureStart(common.Address{}, common.Address{}, false, []byte{}, 1000, big.NewInt(0))
|
||||||
tracer.CaptureEnd(nil, 0, nil, false)
|
tracer.CaptureEnd(nil, 0, nil, false)
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,9 @@ func init() {
|
||||||
// as soon as we have a real live tracer.
|
// as soon as we have a real live tracer.
|
||||||
type noop struct{}
|
type noop struct{}
|
||||||
|
|
||||||
func newNoopTracer(_ json.RawMessage) (*tracing.LiveLogger, error) {
|
func newNoopTracer(_ json.RawMessage) (*tracing.Hooks, error) {
|
||||||
t := &noop{}
|
t := &noop{}
|
||||||
return &tracing.LiveLogger{
|
return &tracing.Hooks{
|
||||||
CaptureTxStart: t.CaptureTxStart,
|
CaptureTxStart: t.CaptureTxStart,
|
||||||
CaptureTxEnd: t.CaptureTxEnd,
|
CaptureTxEnd: t.CaptureTxEnd,
|
||||||
CaptureStart: t.CaptureStart,
|
CaptureStart: t.CaptureStart,
|
||||||
|
|
|
||||||
|
|
@ -133,8 +133,8 @@ func NewAccessListTracer(acl types.AccessList, from, to common.Address, precompi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *AccessListTracer) GetLogger() *tracing.LiveLogger {
|
func (a *AccessListTracer) GetLogger() *tracing.Hooks {
|
||||||
return &tracing.LiveLogger{
|
return &tracing.Hooks{
|
||||||
CaptureState: a.CaptureState,
|
CaptureState: a.CaptureState,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -134,8 +134,8 @@ func NewStructLogger(cfg *Config) *StructLogger {
|
||||||
return logger
|
return logger
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *StructLogger) Logger() *tracing.LiveLogger {
|
func (l *StructLogger) Logger() *tracing.Hooks {
|
||||||
return &tracing.LiveLogger{
|
return &tracing.Hooks{
|
||||||
CaptureTxStart: l.CaptureTxStart,
|
CaptureTxStart: l.CaptureTxStart,
|
||||||
CaptureTxEnd: l.CaptureTxEnd,
|
CaptureTxEnd: l.CaptureTxEnd,
|
||||||
CaptureEnd: l.CaptureEnd,
|
CaptureEnd: l.CaptureEnd,
|
||||||
|
|
@ -145,9 +145,9 @@ func (l *StructLogger) Logger() *tracing.LiveLogger {
|
||||||
|
|
||||||
func (l *StructLogger) Tracer() *directory.Tracer {
|
func (l *StructLogger) Tracer() *directory.Tracer {
|
||||||
return &directory.Tracer{
|
return &directory.Tracer{
|
||||||
LiveLogger: l.Logger(),
|
Hooks: l.Logger(),
|
||||||
GetResult: l.GetResult,
|
GetResult: l.GetResult,
|
||||||
Stop: l.Stop,
|
Stop: l.Stop,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -353,8 +353,8 @@ func NewMarkdownLogger(cfg *Config, writer io.Writer) *mdLogger {
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *mdLogger) Logger() *tracing.LiveLogger {
|
func (t *mdLogger) Logger() *tracing.Hooks {
|
||||||
return &tracing.LiveLogger{
|
return &tracing.Hooks{
|
||||||
CaptureTxStart: t.CaptureTxStart,
|
CaptureTxStart: t.CaptureTxStart,
|
||||||
CaptureStart: t.CaptureStart,
|
CaptureStart: t.CaptureStart,
|
||||||
CaptureState: t.CaptureState,
|
CaptureState: t.CaptureState,
|
||||||
|
|
|
||||||
|
|
@ -45,8 +45,8 @@ func NewJSONLogger(cfg *Config, writer io.Writer) *JSONLogger {
|
||||||
return l
|
return l
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *JSONLogger) Logger() *tracing.LiveLogger {
|
func (l *JSONLogger) Logger() *tracing.Hooks {
|
||||||
return &tracing.LiveLogger{
|
return &tracing.Hooks{
|
||||||
CaptureTxStart: l.CaptureTxStart,
|
CaptureTxStart: l.CaptureTxStart,
|
||||||
CaptureEnd: l.CaptureEnd,
|
CaptureEnd: l.CaptureEnd,
|
||||||
CaptureState: l.CaptureState,
|
CaptureState: l.CaptureState,
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ func newFourByteTracer(ctx *directory.Context, _ json.RawMessage) (*directory.Tr
|
||||||
ids: make(map[string]int),
|
ids: make(map[string]int),
|
||||||
}
|
}
|
||||||
return &directory.Tracer{
|
return &directory.Tracer{
|
||||||
LiveLogger: &tracing.LiveLogger{
|
Hooks: &tracing.Hooks{
|
||||||
CaptureTxStart: t.CaptureTxStart,
|
CaptureTxStart: t.CaptureTxStart,
|
||||||
CaptureStart: t.CaptureStart,
|
CaptureStart: t.CaptureStart,
|
||||||
CaptureEnter: t.CaptureEnter,
|
CaptureEnter: t.CaptureEnter,
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ func newCallTracer(ctx *directory.Context, cfg json.RawMessage) (*directory.Trac
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &directory.Tracer{
|
return &directory.Tracer{
|
||||||
LiveLogger: &tracing.LiveLogger{
|
Hooks: &tracing.Hooks{
|
||||||
CaptureTxStart: t.CaptureTxStart,
|
CaptureTxStart: t.CaptureTxStart,
|
||||||
CaptureTxEnd: t.CaptureTxEnd,
|
CaptureTxEnd: t.CaptureTxEnd,
|
||||||
CaptureStart: t.CaptureStart,
|
CaptureStart: t.CaptureStart,
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ func newFlatCallTracer(ctx *directory.Context, cfg json.RawMessage) (*directory.
|
||||||
|
|
||||||
ft := &flatCallTracer{tracer: t, ctx: ctx, config: config}
|
ft := &flatCallTracer{tracer: t, ctx: ctx, config: config}
|
||||||
return &directory.Tracer{
|
return &directory.Tracer{
|
||||||
LiveLogger: &tracing.LiveLogger{
|
Hooks: &tracing.Hooks{
|
||||||
CaptureTxStart: ft.CaptureTxStart,
|
CaptureTxStart: ft.CaptureTxStart,
|
||||||
CaptureTxEnd: ft.CaptureTxEnd,
|
CaptureTxEnd: ft.CaptureTxEnd,
|
||||||
CaptureStart: ft.CaptureStart,
|
CaptureStart: ft.CaptureStart,
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ func newMuxTracer(ctx *directory.Context, cfg json.RawMessage) (*directory.Trace
|
||||||
|
|
||||||
t := &muxTracer{names: names, tracers: objects}
|
t := &muxTracer{names: names, tracers: objects}
|
||||||
return &directory.Tracer{
|
return &directory.Tracer{
|
||||||
LiveLogger: &tracing.LiveLogger{
|
Hooks: &tracing.Hooks{
|
||||||
CaptureTxStart: t.CaptureTxStart,
|
CaptureTxStart: t.CaptureTxStart,
|
||||||
CaptureTxEnd: t.CaptureTxEnd,
|
CaptureTxEnd: t.CaptureTxEnd,
|
||||||
CaptureStart: t.CaptureStart,
|
CaptureStart: t.CaptureStart,
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ func newPrestateTracer(ctx *directory.Context, cfg json.RawMessage) (*directory.
|
||||||
deleted: make(map[common.Address]bool),
|
deleted: make(map[common.Address]bool),
|
||||||
}
|
}
|
||||||
return &directory.Tracer{
|
return &directory.Tracer{
|
||||||
LiveLogger: &tracing.LiveLogger{
|
Hooks: &tracing.Hooks{
|
||||||
CaptureTxStart: t.CaptureTxStart,
|
CaptureTxStart: t.CaptureTxStart,
|
||||||
CaptureTxEnd: t.CaptureTxEnd,
|
CaptureTxEnd: t.CaptureTxEnd,
|
||||||
CaptureState: t.CaptureState,
|
CaptureState: t.CaptureState,
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ type btHeaderMarshaling struct {
|
||||||
ExcessBlobGas *math.HexOrDecimal64
|
ExcessBlobGas *math.HexOrDecimal64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *BlockTest) Run(snapshotter bool, scheme string, tracer *tracing.LiveLogger, postCheck func(error, *core.BlockChain)) (result error) {
|
func (t *BlockTest) Run(snapshotter bool, scheme string, tracer *tracing.Hooks, postCheck func(error, *core.BlockChain)) (result error) {
|
||||||
config, ok := Forks[t.json.Network]
|
config, ok := Forks[t.json.Network]
|
||||||
if !ok {
|
if !ok {
|
||||||
return UnsupportedForkError{t.json.Network}
|
return UnsupportedForkError{t.json.Network}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue