2022-09-26 03:54:42 +00:00
|
|
|
package exec3
|
2022-06-10 15:18:43 +00:00
|
|
|
|
|
|
|
import (
|
2022-11-30 01:31:39 +00:00
|
|
|
"github.com/holiman/uint256"
|
2023-01-13 18:12:18 +00:00
|
|
|
libcommon "github.com/ledgerwatch/erigon-lib/common"
|
2022-06-10 15:18:43 +00:00
|
|
|
"github.com/ledgerwatch/erigon/core/vm"
|
|
|
|
)
|
|
|
|
|
|
|
|
type CallTracer struct {
|
2023-01-13 18:12:18 +00:00
|
|
|
froms map[libcommon.Address]struct{}
|
|
|
|
tos map[libcommon.Address]struct{}
|
2022-06-10 15:18:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewCallTracer() *CallTracer {
|
2023-03-01 07:59:56 +00:00
|
|
|
return &CallTracer{}
|
|
|
|
}
|
|
|
|
func (ct *CallTracer) Reset() {
|
|
|
|
ct.froms, ct.tos = nil, nil
|
2022-06-10 15:18:43 +00:00
|
|
|
}
|
2023-01-13 18:12:18 +00:00
|
|
|
func (ct *CallTracer) Froms() map[libcommon.Address]struct{} { return ct.froms }
|
|
|
|
func (ct *CallTracer) Tos() map[libcommon.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) {}
|
2023-02-25 05:44:45 +00:00
|
|
|
func (ct *CallTracer) CaptureStart(env vm.VMInterface, from libcommon.Address, to libcommon.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte) {
|
2023-03-01 07:59:56 +00:00
|
|
|
if ct.froms == nil {
|
|
|
|
ct.froms = map[libcommon.Address]struct{}{}
|
|
|
|
ct.tos = map[libcommon.Address]struct{}{}
|
|
|
|
}
|
|
|
|
ct.froms[from], ct.tos[to] = struct{}{}, struct{}{}
|
2022-06-10 15:18:43 +00:00
|
|
|
}
|
2023-01-13 18:12:18 +00:00
|
|
|
func (ct *CallTracer) CaptureEnter(typ vm.OpCode, from libcommon.Address, to libcommon.Address, precompile bool, create bool, input []byte, gas uint64, value *uint256.Int, code []byte) {
|
2023-03-01 07:59:56 +00:00
|
|
|
if ct.froms == nil {
|
|
|
|
ct.froms = map[libcommon.Address]struct{}{}
|
|
|
|
ct.tos = map[libcommon.Address]struct{}{}
|
|
|
|
}
|
|
|
|
ct.froms[from], ct.tos[to] = struct{}{}, struct{}{}
|
2022-12-18 16:11:31 +00:00
|
|
|
}
|
2022-12-18 17:06:40 +00:00
|
|
|
func (ct *CallTracer) CaptureState(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, rData []byte, depth int, err error) {
|
2022-06-10 15:18:43 +00:00
|
|
|
}
|
2022-12-18 17:06:40 +00:00
|
|
|
func (ct *CallTracer) CaptureFault(pc uint64, op vm.OpCode, gas, cost uint64, scope *vm.ScopeContext, depth int, err error) {
|
2022-06-10 15:18:43 +00:00
|
|
|
}
|
2022-12-23 05:43:08 +00:00
|
|
|
func (ct *CallTracer) CaptureEnd(output []byte, usedGas uint64, err error) {
|
2022-12-18 16:11:31 +00:00
|
|
|
}
|
2022-12-23 05:43:08 +00:00
|
|
|
func (ct *CallTracer) CaptureExit(output []byte, usedGas uint64, err error) {
|
2022-06-10 15:18:43 +00:00
|
|
|
}
|