forked from cyl19970726/EVM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
evm.puml
330 lines (330 loc) · 8.55 KB
/
evm.puml
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
@startuml
namespace go_ethereum\\core\\vm {
class Contract {
CallerAddress common.Address
caller ContractRef
self ContractRef
jumpdests map[common.Hash]bitvec
analysis bitvec
Code []byte
CodeHash common.Hash
CodeAddr *common.Address
Input []byte
Gas uint64
value *big.Int
}
}
namespace go_ethereum\\core\\vm {
class ecrecover {
}
}
namespace go_ethereum\\core\\vm {
class sha256hash {
}
}
namespace go_ethereum\\core\\vm {
class ripemd160hash {
}
}
namespace go_ethereum\\core\\vm {
class dataCopy {
}
}
namespace go_ethereum\\core\\vm {
class bigModExp {
}
}
namespace go_ethereum\\core\\vm {
class bn256AddIstanbul {
}
}
namespace go_ethereum\\core\\vm {
class bn256AddByzantium {
}
}
namespace go_ethereum\\core\\vm {
class bn256ScalarMulIstanbul {
}
}
namespace go_ethereum\\core\\vm {
class bn256ScalarMulByzantium {
}
}
namespace go_ethereum\\core\\vm {
class bn256PairingIstanbul {
}
}
namespace go_ethereum\\core\\vm {
class bn256PairingByzantium {
}
}
namespace go_ethereum\\core\\vm {
class blake2F {
}
}
namespace go_ethereum\\core\\vm {
class Context {
CanTransfer CanTransferFunc
Transfer TransferFunc
GetHash GetHashFunc
Origin common.Address
GasPrice *big.Int
Coinbase common.Address
GasLimit uint64
BlockNumber *big.Int
Time *big.Int
Difficulty *big.Int
}
}
namespace go_ethereum\\core\\vm {
class EVM {
Context
StateDB StateDB
depth int
chainConfig *params.ChainConfig
chainRules params.Rules
vmConfig Config
interpreters []Interpreter
interpreter Interpreter
abort int32
callGasTemp uint64
}
}
namespace go_ethereum\\core\\vm {
class codeAndHash {
code []byte
hash common.Hash
}
}
namespace go_ethereum\\core\\vm {
class Config {
Debug bool
Tracer Tracer
NoRecursion bool
EnablePreimageRecording bool
JumpTable []operation
EWASMInterpreter string
EVMInterpreter string
ExtraEips []int
}
}
namespace go_ethereum\\core\\vm {
class callCtx {
memory *Memory
stack *Stack
contract *Contract
}
}
namespace go_ethereum\\core\\vm {
class EVMInterpreter {
evm *EVM
cfg Config
intPool *intPool
hasher keccakState
hasherBuf common.Hash
readOnly bool
returnData []byte
}
}
namespace go_ethereum\\core\\vm {
class intPool {
pool *Stack
}
}
namespace go_ethereum\\core\\vm {
class intPoolPool {
pools []*intPool
lock sync.Mutex
}
}
namespace go_ethereum\\core\\vm {
class operation {
execute executionFunc
constantGas uint64
dynamicGas gasFunc
minStack int
maxStack int
memorySize memorySizeFunc
halts bool
jumps bool
writes bool
valid bool
reverts bool
returns bool
}
}
namespace go_ethereum\\core\\vm {
class LogConfig {
DisableMemory bool
DisableStack bool
DisableStorage bool
Debug bool
Limit int
}
}
namespace go_ethereum\\core\\vm {
class StructLog {
Pc uint64
Op OpCode
Gas uint64
GasCost uint64
Memory []byte
MemorySize int
Stack []*big.Int
Storage map[common.Hash]common.Hash
Depth int
RefundCounter uint64
Err error
}
}
namespace go_ethereum\\core\\vm {
class structLogMarshaling {
Stack []*math.HexOrDecimal256
Gas math.HexOrDecimal64
GasCost math.HexOrDecimal64
Memory hexutil.Bytes
OpName string
ErrorString string
}
}
namespace go_ethereum\\core\\vm {
class StructLogger {
cfg LogConfig
logs []StructLog
changedValues map[common.Address]Storage
output []byte
err error
}
}
namespace go_ethereum\\core\\vm {
class JSONLogger {
encoder *json.Encoder
cfg *LogConfig
}
}
namespace go_ethereum\\core\\vm {
class Memory {
store []byte
lastGasCost uint64
}
}
namespace go_ethereum\\core\\vm\\runtime {
class Config {
ChainConfig *params.ChainConfig
Difficulty *big.Int
Origin common.Address
Coinbase common.Address
BlockNumber *big.Int
Time *big.Int
GasLimit uint64
GasPrice *big.Int
Value *big.Int
Debug bool
EVMConfig vm.Config
State *state.StateDB
GetHashFn func(n uint64)common.Hash
}
}
namespace go_ethereum\\core\\vm {
class Stack {
data []*big.Int
}
}
namespace go_ethereum\\core\\vm {
interface ContractRef {
Address()common.Address
}
}
namespace go_ethereum\\core\\vm {
interface PrecompiledContract {
RequiredGas(input []byte)uint64
Run(input []byte)([]byte,error)
}
}
namespace go_ethereum\\core\\vm {
interface StateDB {
CreateAccount(common.Address)
SubBalance(common.Address,*big.Int)
AddBalance(common.Address,*big.Int)
GetBalance(common.Address)*big.Int
GetNonce(common.Address)uint64
SetNonce(common.Address,uint64)
GetCodeHash(common.Address)common.Hash
GetCode(common.Address)[]byte
SetCode(common.Address,[]byte)
GetCodeSize(common.Address)int
AddRefund(uint64)
SubRefund(uint64)
GetRefund()uint64
GetCommittedState(common.Address,common.Hash)common.Hash
GetState(common.Address,common.Hash)common.Hash
SetState(common.Address,common.Hash,common.Hash)
Suicide(common.Address)bool
HasSuicided(common.Address)bool
Exist(common.Address)bool
Empty(common.Address)bool
RevertToSnapshot(int)
Snapshot()int
AddLog(*types.Log)
AddPreimage(common.Hash,[]byte)
ForEachStorage(common.Address,func(common.Hash,common.Hash)bool)error
}
}
namespace go_ethereum\\core\\vm {
interface CallContext {
Call(env *EVM,me ContractRef,addr common.Address,data []byte,gas,value *big.Int)([]byte,error)
CallCode(env *EVM,me ContractRef,addr common.Address,data []byte,gas,value *big.Int)([]byte,error)
DelegateCall(env *EVM,me ContractRef,addr common.Address,data []byte,gas *big.Int)([]byte,error)
Create(env *EVM,me ContractRef,data []byte,gas,value *big.Int)([]byte,common.Address,error)
}
}
namespace go_ethereum\\core\\vm {
interface Interpreter {
Run(contract *Contract,input []byte,static bool)([]byte,error)
CanRun([]byte)bool
}
}
namespace go_ethereum\\core\\vm {
interface keccakState {
Read([]byte)(int,error)
}
}
namespace go_ethereum\\core\\vm {
interface Tracer {
CaptureStart(from common.Address,to common.Address,create bool,input []byte,gas uint64,value *big.Int)error
CaptureState(env *EVM,pc uint64,op OpCode,gas,cost uint64,memory *Memory,stack *Stack,contract *Contract,depth int,err error)error
CaptureFault(env *EVM,pc uint64,op OpCode,gas,cost uint64,memory *Memory,stack *Stack,contract *Contract,depth int,err error)error
CaptureEnd(output []byte,gasUsed uint64,t time.Duration,err error)error
}
}
go_ethereum\\core\\vm.EVM -|> go_ethereum\\core\\vm.Context
go_ethereum\\core\\vm.EVM ---> go_ethereum\\core\\vm.Config : vmConfig
go_ethereum\\core\\vm.Config ---> "*" go_ethereum\\core\\vm.operation : JumpTable
go_ethereum\\core\\vm.callCtx ---> go_ethereum\\core\\vm.Memory : memory
go_ethereum\\core\\vm.callCtx ---> go_ethereum\\core\\vm.Stack : stack
go_ethereum\\core\\vm.callCtx ---> go_ethereum\\core\\vm.Contract : contract
go_ethereum\\core\\vm.EVMInterpreter ---> go_ethereum\\core\\vm.EVM : evm
go_ethereum\\core\\vm.EVMInterpreter ---> go_ethereum\\core\\vm.Config : cfg
go_ethereum\\core\\vm.EVMInterpreter ---> go_ethereum\\core\\vm.intPool : intPool
go_ethereum\\core\\vm.intPool ---> go_ethereum\\core\\vm.Stack : pool
go_ethereum\\core\\vm.intPoolPool ---> "*" go_ethereum\\core\\vm.intPool : pools
go_ethereum\\core\\vm.StructLogger ---> go_ethereum\\core\\vm.LogConfig : cfg
go_ethereum\\core\\vm.StructLogger ---> "*" go_ethereum\\core\\vm.StructLog : logs
go_ethereum\\core\\vm.JSONLogger ---> go_ethereum\\core\\vm.LogConfig : cfg
go_ethereum\\core\\vm.ContractRef <|- go_ethereum\\core\\vm.Contract
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.ecrecover
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.sha256hash
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.ripemd160hash
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.dataCopy
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.bigModExp
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.bn256AddIstanbul
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.bn256AddByzantium
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.bn256ScalarMulIstanbul
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.bn256ScalarMulByzantium
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.bn256PairingIstanbul
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.bn256PairingByzantium
go_ethereum\\core\\vm.PrecompiledContract <|- go_ethereum\\core\\vm.blake2F
go_ethereum\\core\\vm.Interpreter <|- go_ethereum\\core\\vm.EVMInterpreter
go_ethereum\\core\\vm.Tracer <|- go_ethereum\\core\\vm.StructLogger
go_ethereum\\core\\vm.Tracer <|- go_ethereum\\core\\vm.JSONLogger
@enduml