2022-09-26 03:54:42 +00:00
|
|
|
package exec3
|
2022-06-10 15:18:43 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
|
2022-11-30 01:31:39 +00:00
|
|
|
"github.com/holiman/uint256"
|
2022-06-10 15:18:43 +00:00
|
|
|
"github.com/ledgerwatch/erigon/common"
|
|
|
|
"github.com/ledgerwatch/erigon/core/vm"
|
|
|
|
)
|
|
|
|
|
|
|
|
type CallTracer struct {
|
|
|
|
froms map[common.Address]struct{}
|
|
|
|
tos map[common.Address]struct{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func NewCallTracer() *CallTracer {
|
|
|
|
return &CallTracer{
|
|
|
|
froms: map[common.Address]struct{}{},
|
|
|
|
tos: map[common.Address]struct{}{},
|
|
|
|
}
|
|
|
|
}
|
2022-08-09 03:39:34 +00:00
|
|
|
func (ct *CallTracer) Froms() map[common.Address]struct{} { return ct.froms }
|
|
|
|
func (ct *CallTracer) Tos() map[common.Address]struct{} { return ct.tos }
|
2022-06-10 15:18:43 +00:00
|
|
|
|
2022-12-18 04:36:57 +00:00
|
|
|
func (ct *CallTracer) CaptureTxStart(gasLimit uint64) {}
|
|
|
|
func (ct *CallTracer) CaptureTxEnd(restGas uint64) {}
|
2022-12-18 16:11:31 +00:00
|
|
|
func (ct *CallTracer) captureStartOrEnter(from, to common.Address) {
|
2022-06-10 15:18:43 +00:00
|
|
|
ct.froms[from] = struct{}{}
|
|
|
|
ct.tos[to] = struct{}{}
|
|
|
|
}
|
2022-12-18 16:11:31 +00:00
|
|
|
func (ct *CallTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Address, precompile bool, create bool, callType vm.CallType, input []byte, gas uint64, value *uint256.Int, code []byte) {
|
|
|
|
ct.captureStartOrEnter(from, to)
|
|
|
|
}
|
|
|
|
func (ct *CallTracer) CaptureEnter(env *vm.EVM, from common.Address, to common.Address, precompile bool, create bool, callType vm.CallType, input []byte, gas uint64, value *uint256.Int, code []byte) {
|
|
|
|
ct.captureStartOrEnter(from, to)
|
|
|
|
}
|
2022-06-10 15:18:43 +00:00
|
|
|
func (ct *CallTracer) CaptureState(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) {
|
|
|
|
}
|
|
|
|
func (ct *CallTracer) CaptureFault(env *vm.EVM, pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error) {
|
|
|
|
}
|
2022-12-18 16:11:31 +00:00
|
|
|
func (ct *CallTracer) CaptureEnd(output []byte, startGas, endGas uint64, t time.Duration, err error) {
|
|
|
|
}
|
|
|
|
func (ct *CallTracer) CaptureExit(output []byte, startGas, endGas uint64, t time.Duration, err error) {
|
2022-06-10 15:18:43 +00:00
|
|
|
}
|
2022-12-03 14:43:53 +00:00
|
|
|
func (ct *CallTracer) CaptureSelfDestruct(from common.Address, to common.Address, value *uint256.Int) {
|
2022-06-10 15:18:43 +00:00
|
|
|
ct.froms[from] = struct{}{}
|
|
|
|
ct.tos[to] = struct{}{}
|
|
|
|
}
|
|
|
|
func (ct *CallTracer) CaptureAccountRead(account common.Address) error {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
func (ct *CallTracer) CaptureAccountWrite(account common.Address) error {
|
|
|
|
return nil
|
|
|
|
}
|