-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.go
70 lines (62 loc) · 1.29 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package tracer
import (
"math/big"
"github.com/esportzvio/frietorchain/types"
)
// RuntimeHost is the interface defining the methods for accessing state by tracer
type RuntimeHost interface {
// GetRefund returns refunded value
GetRefund() uint64
// GetStorage access the storage slot at the given address and slot hash
GetStorage(types.Address, types.Hash) types.Hash
}
type VMState interface {
// Halt tells VM to terminate its process
Halt()
}
type Tracer interface {
// Cancel tells termination of execution and tracing
Cancel(error)
// Clear clears the tracked data
Clear()
// GetResult returns a result based on tracked data
GetResult() (interface{}, error)
// Tx-level
TxStart(gasLimit uint64)
TxEnd(gasLeft uint64)
// Call-level
CallStart(
depth int, // begins from 1
from, to types.Address,
callType int,
gas uint64,
value *big.Int,
input []byte,
)
CallEnd(
depth int, // begins from 1
output []byte,
err error,
)
// Op-level
CaptureState(
memory []byte,
stack []*big.Int,
opCode int,
contractAddress types.Address,
sp int,
host RuntimeHost,
state VMState,
)
ExecuteState(
contractAddress types.Address,
ip uint64,
opcode string,
availableGas uint64,
cost uint64,
lastReturnData []byte,
depth int,
err error,
host RuntimeHost,
)
}