|
| 1 | +package live |
| 2 | + |
| 3 | +import ( |
| 4 | + "encoding/json" |
| 5 | + "math/big" |
| 6 | + |
| 7 | + "github.com/ethereum/go-ethereum/common" |
| 8 | + "github.com/ethereum/go-ethereum/core/tracing" |
| 9 | + "github.com/ethereum/go-ethereum/core/types" |
| 10 | + "github.com/ethereum/go-ethereum/eth/tracers" |
| 11 | + "github.com/ethereum/go-ethereum/params" |
| 12 | +) |
| 13 | + |
| 14 | +func init() { |
| 15 | + tracers.LiveDirectory.Register("noop", newNoopTracer) |
| 16 | +} |
| 17 | + |
| 18 | +// noop is a no-op live tracer. It's there to |
| 19 | +// catch changes in the tracing interface, as well as |
| 20 | +// for testing live tracing performance. Can be removed |
| 21 | +// as soon as we have a real live tracer. |
| 22 | +type noop struct{} |
| 23 | + |
| 24 | +func newNoopTracer(_ json.RawMessage) (*tracing.Hooks, error) { |
| 25 | + t := &noop{} |
| 26 | + return &tracing.Hooks{ |
| 27 | + OnTxStart: t.OnTxStart, |
| 28 | + OnTxEnd: t.OnTxEnd, |
| 29 | + OnEnter: t.OnEnter, |
| 30 | + OnExit: t.OnExit, |
| 31 | + OnOpcode: t.OnOpcode, |
| 32 | + OnFault: t.OnFault, |
| 33 | + OnGasChange: t.OnGasChange, |
| 34 | + OnBlockchainInit: t.OnBlockchainInit, |
| 35 | + OnBlockStart: t.OnBlockStart, |
| 36 | + OnBlockEnd: t.OnBlockEnd, |
| 37 | + OnSkippedBlock: t.OnSkippedBlock, |
| 38 | + OnGenesisBlock: t.OnGenesisBlock, |
| 39 | + OnBalanceChange: t.OnBalanceChange, |
| 40 | + OnNonceChange: t.OnNonceChange, |
| 41 | + OnCodeChange: t.OnCodeChange, |
| 42 | + OnStorageChange: t.OnStorageChange, |
| 43 | + OnLog: t.OnLog, |
| 44 | + }, nil |
| 45 | +} |
| 46 | + |
| 47 | +func (t *noop) OnOpcode(pc uint64, op byte, gas, cost uint64, scope tracing.OpContext, rData []byte, depth int, err error) { |
| 48 | +} |
| 49 | + |
| 50 | +func (t *noop) OnFault(pc uint64, op byte, gas, cost uint64, _ tracing.OpContext, depth int, err error) { |
| 51 | +} |
| 52 | + |
| 53 | +func (t *noop) OnEnter(depth int, typ byte, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int, order uint64) { |
| 54 | +} |
| 55 | + |
| 56 | +func (t *noop) OnExit(depth int, output []byte, gasUsed uint64, err error, reverted bool) { |
| 57 | +} |
| 58 | + |
| 59 | +func (t *noop) OnTxStart(vm *tracing.VMContext, tx *types.Transaction, from common.Address) { |
| 60 | +} |
| 61 | + |
| 62 | +func (t *noop) OnTxEnd(receipt *types.Receipt, err error) { |
| 63 | +} |
| 64 | + |
| 65 | +func (t *noop) OnBlockStart(ev tracing.BlockEvent) { |
| 66 | +} |
| 67 | + |
| 68 | +func (t *noop) OnBlockEnd(err error) { |
| 69 | +} |
| 70 | + |
| 71 | +func (t *noop) OnSkippedBlock(ev tracing.BlockEvent) {} |
| 72 | + |
| 73 | +func (t *noop) OnBlockchainInit(chainConfig *params.ChainConfig) { |
| 74 | +} |
| 75 | + |
| 76 | +func (t *noop) OnGenesisBlock(b *types.Block, alloc types.GenesisAlloc) { |
| 77 | +} |
| 78 | + |
| 79 | +func (t *noop) OnBalanceChange(a common.Address, prev, new *big.Int, reason tracing.BalanceChangeReason) { |
| 80 | +} |
| 81 | + |
| 82 | +func (t *noop) OnNonceChange(a common.Address, prev, new uint64) { |
| 83 | +} |
| 84 | + |
| 85 | +func (t *noop) OnCodeChange(a common.Address, prevCodeHash common.Hash, prev []byte, codeHash common.Hash, code []byte) { |
| 86 | +} |
| 87 | + |
| 88 | +func (t *noop) OnStorageChange(a common.Address, k, prev, new common.Hash) { |
| 89 | +} |
| 90 | + |
| 91 | +func (t *noop) OnLog(l *types.Log) { |
| 92 | + |
| 93 | +} |
| 94 | + |
| 95 | +func (t *noop) OnGasChange(old, new uint64, reason tracing.GasChangeReason) { |
| 96 | +} |
0 commit comments