-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathruntimeContextWrapper.go
More file actions
563 lines (461 loc) · 29.6 KB
/
runtimeContextWrapper.go
File metadata and controls
563 lines (461 loc) · 29.6 KB
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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
package mock
import (
vmcommon "github.com/multiversx/mx-chain-vm-common-go"
"github.com/multiversx/mx-chain-vm-go/executor"
"github.com/multiversx/mx-chain-vm-go/vmhost"
)
// making sure we implement all functions of RuntimeContext
var _ vmhost.RuntimeContext = (*RuntimeContextWrapper)(nil)
// RuntimeContextWrapper a wrapper over a RuntimeContext that delegates to if if function is not redefined
type RuntimeContextWrapper struct {
runtimeContext vmhost.RuntimeContext
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
InitStateFromContractCallInputFunc func(input *vmcommon.ContractCallInput)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
SetCustomCallFunctionFunc func(callFunction string)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetVMInputFunc func() *vmcommon.ContractCallInput
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
SetVMInputFunc func(vmInput *vmcommon.ContractCallInput)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetSCAddressFunc func() []byte
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetOriginalCallerAddressFunc func() []byte
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
SetCodeAddressFunc func(scAddress []byte)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetSCCodeFunc func() ([]byte, error)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetSCCodeSizeFunc func() uint64
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetVMTypeFunc func() []byte
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
FunctionFunc func() string
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
ArgumentsFunc func() [][]byte
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetCurrentTxHashFunc func() []byte
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetOriginalTxHashFunc func() []byte
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
RemoveCodeUpgradeFromArgsFunc func()
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
SignalUserErrorFunc func(message string)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
FailExecutionFunc func(err error)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
MustVerifyNextContractCodeFunc func()
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
SetRuntimeBreakpointValueFunc func(value vmhost.BreakpointValue)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetRuntimeBreakpointValueFunc func() vmhost.BreakpointValue
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetAsyncCallInfoFunc func() *vmhost.AsyncCallInfo
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
SetAsyncCallInfoFunc func(asyncCallInfo *vmhost.AsyncCallInfo)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
AddAsyncContextCallFunc func(contextIdentifier []byte, asyncCall *vmhost.AsyncGeneratedCall) error
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetAsyncContextFunc func(contextIdentifier []byte) (*vmhost.AsyncContext, error)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetInstanceStackSizeFunc func() uint64
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
CountSameContractInstancesOnStackFunc func(address []byte) uint64
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
IsFunctionImportedFunc func(name string) bool
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
ReadOnlyFunc func() bool
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
SetReadOnlyFunc func(readOnly bool)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
StartWasmerInstanceFunc func(contract []byte, gasLimit uint64, newCode bool) error
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
ClearWarmInstanceCacheFunc func()
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
SetMaxInstanceStackSizeFunc func(maxInstanceStackSize uint64)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
VerifyContractCodeFunc func() error
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetInstanceFunc func() executor.Instance
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
FunctionNameCheckedFunc func() (string, error)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
CallSCFunctionFunc func(string) error
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetPointsUsedFunc func() uint64
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
SetPointsUsedFunc func(gasPoints uint64)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
BaseOpsErrorShouldFailExecutionFunc func() bool
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
SyncExecAPIErrorShouldFailExecutionFunc func() bool
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
CryptoAPIErrorShouldFailExecutionFunc func() bool
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
BigIntAPIErrorShouldFailExecutionFunc func() bool
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
BigFloatAPIErrorShouldFailExecutionFunc func() bool
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
ManagedBufferAPIErrorShouldFailExecutionFunc func() bool
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetVMExecutorFunc func() executor.Executor
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
AddErrorFunc func(err error, otherInfo ...string)
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetAllErrorsFunc func() error
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
InitStateFunc func()
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
PushStateFunc func()
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
PopSetActiveStateFunc func()
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
PopDiscardFunc func()
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
ClearStateStackFunc func()
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
CleanInstanceFunc func()
// function that will be called by the corresponding RuntimeContext function implementation (by default this will call the same wrapped context function)
GetInstanceTrackerFunc func() vmhost.InstanceTracker
}
// NewRuntimeContextWrapper builds a new runtimeContextWrapper that by default will delagate all calls to the provided RuntimeContext
func NewRuntimeContextWrapper(inputRuntimeContext *vmhost.RuntimeContext) *RuntimeContextWrapper {
runtimeWrapper := &RuntimeContextWrapper{runtimeContext: *inputRuntimeContext}
/*
default implementations delegate to wrapped context
*/
runtimeWrapper.InitStateFromContractCallInputFunc = func(input *vmcommon.ContractCallInput) {
runtimeWrapper.runtimeContext.InitStateFromContractCallInput(input)
}
runtimeWrapper.SetCustomCallFunctionFunc = func(callFunction string) {
runtimeWrapper.runtimeContext.SetCustomCallFunction(callFunction)
}
runtimeWrapper.GetVMInputFunc = func() *vmcommon.ContractCallInput {
return runtimeWrapper.runtimeContext.GetVMInput()
}
runtimeWrapper.SetVMInputFunc = func(vmInput *vmcommon.ContractCallInput) {
runtimeWrapper.runtimeContext.SetVMInput(vmInput)
}
runtimeWrapper.GetSCAddressFunc = func() []byte {
return runtimeWrapper.runtimeContext.GetContextAddress()
}
runtimeWrapper.SetCodeAddressFunc = func(scAddress []byte) {
runtimeWrapper.runtimeContext.SetCodeAddress(scAddress)
}
runtimeWrapper.GetSCCodeFunc = func() ([]byte, error) {
return runtimeWrapper.runtimeContext.GetSCCode()
}
runtimeWrapper.GetSCCodeSizeFunc = func() uint64 {
return runtimeWrapper.runtimeContext.GetSCCodeSize()
}
runtimeWrapper.GetVMTypeFunc = func() []byte {
return runtimeWrapper.runtimeContext.GetVMType()
}
runtimeWrapper.FunctionFunc = func() string {
return runtimeWrapper.runtimeContext.FunctionName()
}
runtimeWrapper.ArgumentsFunc = func() [][]byte {
return runtimeWrapper.runtimeContext.Arguments()
}
runtimeWrapper.GetCurrentTxHashFunc = func() []byte {
return runtimeWrapper.runtimeContext.GetCurrentTxHash()
}
runtimeWrapper.GetOriginalTxHashFunc = func() []byte {
return runtimeWrapper.runtimeContext.GetOriginalTxHash()
}
runtimeWrapper.RemoveCodeUpgradeFromArgsFunc = func() {
runtimeWrapper.runtimeContext.RemoveCodeUpgradeFromArgs()
}
runtimeWrapper.SignalUserErrorFunc = func(message string) {
runtimeWrapper.runtimeContext.SignalUserError(message)
}
runtimeWrapper.FailExecutionFunc = func(err error) {
runtimeWrapper.runtimeContext.FailExecution(err)
}
runtimeWrapper.MustVerifyNextContractCodeFunc = func() {
runtimeWrapper.runtimeContext.MustVerifyNextContractCode()
}
runtimeWrapper.SetRuntimeBreakpointValueFunc = func(value vmhost.BreakpointValue) {
runtimeWrapper.runtimeContext.SetRuntimeBreakpointValue(value)
}
runtimeWrapper.GetRuntimeBreakpointValueFunc = func() vmhost.BreakpointValue {
return runtimeWrapper.runtimeContext.GetRuntimeBreakpointValue()
}
runtimeWrapper.GetInstanceStackSizeFunc = func() uint64 {
return runtimeWrapper.runtimeContext.GetInstanceStackSize()
}
runtimeWrapper.IsFunctionImportedFunc = func(name string) bool {
return runtimeWrapper.runtimeContext.IsFunctionImported(name)
}
runtimeWrapper.ReadOnlyFunc = func() bool {
return runtimeWrapper.runtimeContext.ReadOnly()
}
runtimeWrapper.SetReadOnlyFunc = func(readOnly bool) {
runtimeWrapper.runtimeContext.SetReadOnly(readOnly)
}
runtimeWrapper.StartWasmerInstanceFunc = func(contract []byte, gasLimit uint64, newCode bool) error {
return runtimeWrapper.runtimeContext.StartWasmerInstance(contract, gasLimit, newCode)
}
runtimeWrapper.ClearWarmInstanceCacheFunc = func() {
runtimeWrapper.runtimeContext.ClearWarmInstanceCache()
}
runtimeWrapper.SetMaxInstanceStackSizeFunc = func(maxInstanceStackSize uint64) {
runtimeWrapper.runtimeContext.SetMaxInstanceStackSize(maxInstanceStackSize)
}
runtimeWrapper.VerifyContractCodeFunc = func() error {
return runtimeWrapper.runtimeContext.VerifyContractCode()
}
runtimeWrapper.GetInstanceFunc = func() executor.Instance {
return runtimeWrapper.runtimeContext.GetInstance()
}
runtimeWrapper.FunctionNameCheckedFunc = func() (string, error) {
return runtimeWrapper.runtimeContext.FunctionNameChecked()
}
runtimeWrapper.CallSCFunctionFunc = func(functionName string) error {
return runtimeWrapper.runtimeContext.CallSCFunction(functionName)
}
runtimeWrapper.GetPointsUsedFunc = func() uint64 {
return runtimeWrapper.runtimeContext.GetPointsUsed()
}
runtimeWrapper.SetPointsUsedFunc = func(gasPoints uint64) {
runtimeWrapper.runtimeContext.SetPointsUsed(gasPoints)
}
runtimeWrapper.AddErrorFunc = func(err error, otherInfo ...string) {
runtimeWrapper.runtimeContext.AddError(err, otherInfo...)
}
runtimeWrapper.GetAllErrorsFunc = func() error {
return runtimeWrapper.runtimeContext.GetAllErrors()
}
runtimeWrapper.InitStateFunc = func() {
runtimeWrapper.runtimeContext.InitState()
}
runtimeWrapper.PushStateFunc = func() {
runtimeWrapper.runtimeContext.PushState()
}
runtimeWrapper.PopSetActiveStateFunc = func() {
runtimeWrapper.runtimeContext.PopSetActiveState()
}
runtimeWrapper.PopDiscardFunc = func() {
runtimeWrapper.runtimeContext.PopDiscard()
}
runtimeWrapper.ClearStateStackFunc = func() {
runtimeWrapper.runtimeContext.ClearStateStack()
}
runtimeWrapper.CleanInstanceFunc = func() {
runtimeWrapper.runtimeContext.CleanInstance()
}
runtimeWrapper.GetInstanceTrackerFunc = func() vmhost.InstanceTracker {
return runtimeWrapper.runtimeContext.GetInstanceTracker()
}
return runtimeWrapper
}
// GetWrappedRuntimeContext gets the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetWrappedRuntimeContext() vmhost.RuntimeContext {
return contextWrapper.runtimeContext
}
// InitStateFromContractCallInput calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) InitStateFromContractCallInput(input *vmcommon.ContractCallInput) {
contextWrapper.InitStateFromContractCallInputFunc(input)
}
// SetCustomCallFunction calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) SetCustomCallFunction(callFunction string) {
contextWrapper.SetCustomCallFunctionFunc(callFunction)
}
// GetVMInput calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetVMInput() *vmcommon.ContractCallInput {
return contextWrapper.GetVMInputFunc()
}
// SetVMInput calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) SetVMInput(vmInput *vmcommon.ContractCallInput) {
contextWrapper.SetVMInputFunc(vmInput)
}
// GetContextAddress calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetContextAddress() []byte {
return contextWrapper.GetSCAddressFunc()
}
// GetOriginalCallerAddress calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetOriginalCallerAddress() []byte {
return contextWrapper.GetOriginalCallerAddressFunc()
}
// SetCodeAddress calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) SetCodeAddress(scAddress []byte) {
contextWrapper.SetCodeAddressFunc(scAddress)
}
// GetSCCode calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetSCCode() ([]byte, error) {
return contextWrapper.GetSCCodeFunc()
}
// GetSCCodeSize calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetSCCodeSize() uint64 {
return contextWrapper.GetSCCodeSizeFunc()
}
// GetVMType calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetVMType() []byte {
return contextWrapper.GetVMTypeFunc()
}
// FunctionName calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) FunctionName() string {
return contextWrapper.FunctionFunc()
}
// Arguments calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) Arguments() [][]byte {
return contextWrapper.ArgumentsFunc()
}
// GetCurrentTxHash calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetCurrentTxHash() []byte {
return contextWrapper.GetCurrentTxHashFunc()
}
// GetOriginalTxHash calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetOriginalTxHash() []byte {
return contextWrapper.GetOriginalTxHashFunc()
}
// RemoveCodeUpgradeFromArgs calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) RemoveCodeUpgradeFromArgs() {
contextWrapper.RemoveCodeUpgradeFromArgsFunc()
}
// SignalUserError calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) SignalUserError(message string) {
contextWrapper.SignalUserErrorFunc(message)
}
// FailExecution calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) FailExecution(err error) {
contextWrapper.FailExecutionFunc(err)
}
// MustVerifyNextContractCode calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) MustVerifyNextContractCode() {
contextWrapper.MustVerifyNextContractCodeFunc()
}
// SetRuntimeBreakpointValue calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) SetRuntimeBreakpointValue(value vmhost.BreakpointValue) {
contextWrapper.SetRuntimeBreakpointValueFunc(value)
}
// GetRuntimeBreakpointValue calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetRuntimeBreakpointValue() vmhost.BreakpointValue {
return contextWrapper.GetRuntimeBreakpointValueFunc()
}
// CountSameContractInstancesOnStack calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) CountSameContractInstancesOnStack(address []byte) uint64 {
return contextWrapper.CountSameContractInstancesOnStackFunc(address)
}
// GetInstanceStackSize calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetInstanceStackSize() uint64 {
return contextWrapper.GetInstanceStackSizeFunc()
}
// IsFunctionImported calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) IsFunctionImported(name string) bool {
return contextWrapper.IsFunctionImportedFunc(name)
}
// ReadOnly calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) ReadOnly() bool {
return contextWrapper.ReadOnlyFunc()
}
// SetReadOnly calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) SetReadOnly(readOnly bool) {
contextWrapper.SetReadOnlyFunc(readOnly)
}
// StartWasmerInstance calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) StartWasmerInstance(contract []byte, gasLimit uint64, newCode bool) error {
return contextWrapper.StartWasmerInstanceFunc(contract, gasLimit, newCode)
}
// ClearWarmInstanceCache calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) ClearWarmInstanceCache() {
contextWrapper.ClearWarmInstanceCacheFunc()
}
// SetMaxInstanceStackSize calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) SetMaxInstanceStackSize(maxInstanceStackSize uint64) {
contextWrapper.SetMaxInstanceStackSizeFunc(maxInstanceStackSize)
}
// VerifyContractCode calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) VerifyContractCode() error {
return contextWrapper.VerifyContractCodeFunc()
}
// GetInstance calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetInstance() executor.Instance {
return contextWrapper.GetInstanceFunc()
}
// FunctionNameChecked calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) FunctionNameChecked() (string, error) {
return contextWrapper.FunctionNameCheckedFunc()
}
// CallSCFunction calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) CallSCFunction(functionName string) error {
return contextWrapper.CallSCFunctionFunc(functionName)
}
// GetPointsUsed calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetPointsUsed() uint64 {
return contextWrapper.GetPointsUsedFunc()
}
// SetPointsUsed calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) SetPointsUsed(gasPoints uint64) {
contextWrapper.SetPointsUsedFunc(gasPoints)
}
// UseGasBoundedShouldFailExecution calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) UseGasBoundedShouldFailExecution() bool {
return contextWrapper.runtimeContext.UseGasBoundedShouldFailExecution()
}
// GetVMExecutor calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetVMExecutor() executor.Executor {
return contextWrapper.GetVMExecutorFunc()
}
// ReplaceVMExecutor mocked method
func (contextWrapper *RuntimeContextWrapper) ReplaceVMExecutor(_ executor.Executor) {
}
// AddError calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) AddError(err error, otherInfo ...string) {
contextWrapper.AddErrorFunc(err, otherInfo...)
}
// GetAllErrors calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetAllErrors() error {
return contextWrapper.GetAllErrorsFunc()
}
// InitState calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) InitState() {
contextWrapper.InitStateFunc()
}
// PushState calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) PushState() {
contextWrapper.PushStateFunc()
}
// PopSetActiveState calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) PopSetActiveState() {
contextWrapper.PopSetActiveStateFunc()
}
// PopDiscard calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) PopDiscard() {
contextWrapper.PopDiscardFunc()
}
// ClearStateStack calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) ClearStateStack() {
contextWrapper.ClearStateStackFunc()
}
// ValidateCallbackName calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) ValidateCallbackName(callbackName string) error {
return contextWrapper.runtimeContext.ValidateCallbackName(callbackName)
}
// IsReservedFunctionName calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) IsReservedFunctionName(functionName string) bool {
return contextWrapper.runtimeContext.IsReservedFunctionName(functionName)
}
// HasFunction calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) HasFunction(functionName string) bool {
return contextWrapper.runtimeContext.HasFunction(functionName)
}
// GetPrevTxHash calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) GetPrevTxHash() []byte {
return contextWrapper.runtimeContext.GetPrevTxHash()
}
// CleanInstance calls corresponding xxxFunc function, that by default in turn calls the original method of the wrapped RuntimeContext
func (contextWrapper *RuntimeContextWrapper) CleanInstance() {
contextWrapper.CleanInstanceFunc()
}
// EndExecution -
func (contextWrapper *RuntimeContextWrapper) EndExecution() {
}
// ValidateInstances -
func (contextWrapper *RuntimeContextWrapper) ValidateInstances() error {
return nil
}
// GetInstanceTracker -
func (contextWrapper *RuntimeContextWrapper) GetInstanceTracker() vmhost.InstanceTracker {
return contextWrapper.GetInstanceTrackerFunc()
}