-
Notifications
You must be signed in to change notification settings - Fork 175
/
environment.go
868 lines (698 loc) · 20.5 KB
/
environment.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
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
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
// Code generated by mockery v2.12.1. DO NOT EDIT.
package mock
import (
atree "github.com/onflow/atree"
ast "github.com/onflow/cadence/runtime/ast"
cadence "github.com/onflow/cadence"
common "github.com/onflow/cadence/runtime/common"
fvm "github.com/onflow/flow-go/fvm"
interpreter "github.com/onflow/cadence/runtime/interpreter"
mock "github.com/stretchr/testify/mock"
opentracing "github.com/opentracing/opentracing-go"
runtime "github.com/onflow/cadence/runtime"
sema "github.com/onflow/cadence/runtime/sema"
testing "testing"
time "time"
)
// Environment is an autogenerated mock type for the Environment type
type Environment struct {
mock.Mock
}
// AddAccountKey provides a mock function with given fields: address, publicKey, hashAlgo, weight
func (_m *Environment) AddAccountKey(address common.Address, publicKey *runtime.PublicKey, hashAlgo sema.HashAlgorithm, weight int) (*runtime.AccountKey, error) {
ret := _m.Called(address, publicKey, hashAlgo, weight)
var r0 *runtime.AccountKey
if rf, ok := ret.Get(0).(func(common.Address, *runtime.PublicKey, sema.HashAlgorithm, int) *runtime.AccountKey); ok {
r0 = rf(address, publicKey, hashAlgo, weight)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*runtime.AccountKey)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Address, *runtime.PublicKey, sema.HashAlgorithm, int) error); ok {
r1 = rf(address, publicKey, hashAlgo, weight)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// AddEncodedAccountKey provides a mock function with given fields: address, publicKey
func (_m *Environment) AddEncodedAccountKey(address common.Address, publicKey []byte) error {
ret := _m.Called(address, publicKey)
var r0 error
if rf, ok := ret.Get(0).(func(common.Address, []byte) error); ok {
r0 = rf(address, publicKey)
} else {
r0 = ret.Error(0)
}
return r0
}
// AllocateStorageIndex provides a mock function with given fields: owner
func (_m *Environment) AllocateStorageIndex(owner []byte) (atree.StorageIndex, error) {
ret := _m.Called(owner)
var r0 atree.StorageIndex
if rf, ok := ret.Get(0).(func([]byte) atree.StorageIndex); ok {
r0 = rf(owner)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(atree.StorageIndex)
}
}
var r1 error
if rf, ok := ret.Get(1).(func([]byte) error); ok {
r1 = rf(owner)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// BLSAggregatePublicKeys provides a mock function with given fields: keys
func (_m *Environment) BLSAggregatePublicKeys(keys []*runtime.PublicKey) (*runtime.PublicKey, error) {
ret := _m.Called(keys)
var r0 *runtime.PublicKey
if rf, ok := ret.Get(0).(func([]*runtime.PublicKey) *runtime.PublicKey); ok {
r0 = rf(keys)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*runtime.PublicKey)
}
}
var r1 error
if rf, ok := ret.Get(1).(func([]*runtime.PublicKey) error); ok {
r1 = rf(keys)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// BLSAggregateSignatures provides a mock function with given fields: sigs
func (_m *Environment) BLSAggregateSignatures(sigs [][]byte) ([]byte, error) {
ret := _m.Called(sigs)
var r0 []byte
if rf, ok := ret.Get(0).(func([][]byte) []byte); ok {
r0 = rf(sigs)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
var r1 error
if rf, ok := ret.Get(1).(func([][]byte) error); ok {
r1 = rf(sigs)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// BLSVerifyPOP provides a mock function with given fields: pk, s
func (_m *Environment) BLSVerifyPOP(pk *runtime.PublicKey, s []byte) (bool, error) {
ret := _m.Called(pk, s)
var r0 bool
if rf, ok := ret.Get(0).(func(*runtime.PublicKey, []byte) bool); ok {
r0 = rf(pk, s)
} else {
r0 = ret.Get(0).(bool)
}
var r1 error
if rf, ok := ret.Get(1).(func(*runtime.PublicKey, []byte) error); ok {
r1 = rf(pk, s)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Context provides a mock function with given fields:
func (_m *Environment) Context() *fvm.Context {
ret := _m.Called()
var r0 *fvm.Context
if rf, ok := ret.Get(0).(func() *fvm.Context); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*fvm.Context)
}
}
return r0
}
// CreateAccount provides a mock function with given fields: payer
func (_m *Environment) CreateAccount(payer common.Address) (common.Address, error) {
ret := _m.Called(payer)
var r0 common.Address
if rf, ok := ret.Get(0).(func(common.Address) common.Address); ok {
r0 = rf(payer)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(common.Address)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Address) error); ok {
r1 = rf(payer)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DecodeArgument provides a mock function with given fields: argument, argumentType
func (_m *Environment) DecodeArgument(argument []byte, argumentType cadence.Type) (cadence.Value, error) {
ret := _m.Called(argument, argumentType)
var r0 cadence.Value
if rf, ok := ret.Get(0).(func([]byte, cadence.Type) cadence.Value); ok {
r0 = rf(argument, argumentType)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(cadence.Value)
}
}
var r1 error
if rf, ok := ret.Get(1).(func([]byte, cadence.Type) error); ok {
r1 = rf(argument, argumentType)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// EmitEvent provides a mock function with given fields: _a0
func (_m *Environment) EmitEvent(_a0 cadence.Event) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(cadence.Event) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// GenerateUUID provides a mock function with given fields:
func (_m *Environment) GenerateUUID() (uint64, error) {
ret := _m.Called()
var r0 uint64
if rf, ok := ret.Get(0).(func() uint64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(uint64)
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAccountAvailableBalance provides a mock function with given fields: address
func (_m *Environment) GetAccountAvailableBalance(address common.Address) (uint64, error) {
ret := _m.Called(address)
var r0 uint64
if rf, ok := ret.Get(0).(func(common.Address) uint64); ok {
r0 = rf(address)
} else {
r0 = ret.Get(0).(uint64)
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Address) error); ok {
r1 = rf(address)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAccountBalance provides a mock function with given fields: address
func (_m *Environment) GetAccountBalance(address common.Address) (uint64, error) {
ret := _m.Called(address)
var r0 uint64
if rf, ok := ret.Get(0).(func(common.Address) uint64); ok {
r0 = rf(address)
} else {
r0 = ret.Get(0).(uint64)
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Address) error); ok {
r1 = rf(address)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAccountContractCode provides a mock function with given fields: address, name
func (_m *Environment) GetAccountContractCode(address common.Address, name string) ([]byte, error) {
ret := _m.Called(address, name)
var r0 []byte
if rf, ok := ret.Get(0).(func(common.Address, string) []byte); ok {
r0 = rf(address, name)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Address, string) error); ok {
r1 = rf(address, name)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAccountContractNames provides a mock function with given fields: address
func (_m *Environment) GetAccountContractNames(address common.Address) ([]string, error) {
ret := _m.Called(address)
var r0 []string
if rf, ok := ret.Get(0).(func(common.Address) []string); ok {
r0 = rf(address)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]string)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Address) error); ok {
r1 = rf(address)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetAccountKey provides a mock function with given fields: address, index
func (_m *Environment) GetAccountKey(address common.Address, index int) (*runtime.AccountKey, error) {
ret := _m.Called(address, index)
var r0 *runtime.AccountKey
if rf, ok := ret.Get(0).(func(common.Address, int) *runtime.AccountKey); ok {
r0 = rf(address, index)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*runtime.AccountKey)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Address, int) error); ok {
r1 = rf(address, index)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetBlockAtHeight provides a mock function with given fields: height
func (_m *Environment) GetBlockAtHeight(height uint64) (runtime.Block, bool, error) {
ret := _m.Called(height)
var r0 runtime.Block
if rf, ok := ret.Get(0).(func(uint64) runtime.Block); ok {
r0 = rf(height)
} else {
r0 = ret.Get(0).(runtime.Block)
}
var r1 bool
if rf, ok := ret.Get(1).(func(uint64) bool); ok {
r1 = rf(height)
} else {
r1 = ret.Get(1).(bool)
}
var r2 error
if rf, ok := ret.Get(2).(func(uint64) error); ok {
r2 = rf(height)
} else {
r2 = ret.Error(2)
}
return r0, r1, r2
}
// GetCode provides a mock function with given fields: location
func (_m *Environment) GetCode(location common.Location) ([]byte, error) {
ret := _m.Called(location)
var r0 []byte
if rf, ok := ret.Get(0).(func(common.Location) []byte); ok {
r0 = rf(location)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Location) error); ok {
r1 = rf(location)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetCurrentBlockHeight provides a mock function with given fields:
func (_m *Environment) GetCurrentBlockHeight() (uint64, error) {
ret := _m.Called()
var r0 uint64
if rf, ok := ret.Get(0).(func() uint64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(uint64)
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetProgram provides a mock function with given fields: _a0
func (_m *Environment) GetProgram(_a0 common.Location) (*interpreter.Program, error) {
ret := _m.Called(_a0)
var r0 *interpreter.Program
if rf, ok := ret.Get(0).(func(common.Location) *interpreter.Program); ok {
r0 = rf(_a0)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*interpreter.Program)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Location) error); ok {
r1 = rf(_a0)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetSigningAccounts provides a mock function with given fields:
func (_m *Environment) GetSigningAccounts() ([]common.Address, error) {
ret := _m.Called()
var r0 []common.Address
if rf, ok := ret.Get(0).(func() []common.Address); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]common.Address)
}
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetStorageCapacity provides a mock function with given fields: address
func (_m *Environment) GetStorageCapacity(address common.Address) (uint64, error) {
ret := _m.Called(address)
var r0 uint64
if rf, ok := ret.Get(0).(func(common.Address) uint64); ok {
r0 = rf(address)
} else {
r0 = ret.Get(0).(uint64)
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Address) error); ok {
r1 = rf(address)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetStorageUsed provides a mock function with given fields: address
func (_m *Environment) GetStorageUsed(address common.Address) (uint64, error) {
ret := _m.Called(address)
var r0 uint64
if rf, ok := ret.Get(0).(func(common.Address) uint64); ok {
r0 = rf(address)
} else {
r0 = ret.Get(0).(uint64)
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Address) error); ok {
r1 = rf(address)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetValue provides a mock function with given fields: owner, key
func (_m *Environment) GetValue(owner []byte, key []byte) ([]byte, error) {
ret := _m.Called(owner, key)
var r0 []byte
if rf, ok := ret.Get(0).(func([]byte, []byte) []byte); ok {
r0 = rf(owner, key)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
var r1 error
if rf, ok := ret.Get(1).(func([]byte, []byte) error); ok {
r1 = rf(owner, key)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// Hash provides a mock function with given fields: data, tag, hashAlgorithm
func (_m *Environment) Hash(data []byte, tag string, hashAlgorithm sema.HashAlgorithm) ([]byte, error) {
ret := _m.Called(data, tag, hashAlgorithm)
var r0 []byte
if rf, ok := ret.Get(0).(func([]byte, string, sema.HashAlgorithm) []byte); ok {
r0 = rf(data, tag, hashAlgorithm)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
var r1 error
if rf, ok := ret.Get(1).(func([]byte, string, sema.HashAlgorithm) error); ok {
r1 = rf(data, tag, hashAlgorithm)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ImplementationDebugLog provides a mock function with given fields: message
func (_m *Environment) ImplementationDebugLog(message string) error {
ret := _m.Called(message)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(message)
} else {
r0 = ret.Error(0)
}
return r0
}
// MeterComputation provides a mock function with given fields: operationType, intensity
func (_m *Environment) MeterComputation(operationType common.ComputationKind, intensity uint) error {
ret := _m.Called(operationType, intensity)
var r0 error
if rf, ok := ret.Get(0).(func(common.ComputationKind, uint) error); ok {
r0 = rf(operationType, intensity)
} else {
r0 = ret.Error(0)
}
return r0
}
// MeterMemory provides a mock function with given fields: usage
func (_m *Environment) MeterMemory(usage common.MemoryUsage) error {
ret := _m.Called(usage)
var r0 error
if rf, ok := ret.Get(0).(func(common.MemoryUsage) error); ok {
r0 = rf(usage)
} else {
r0 = ret.Error(0)
}
return r0
}
// ProgramLog provides a mock function with given fields: _a0
func (_m *Environment) ProgramLog(_a0 string) error {
ret := _m.Called(_a0)
var r0 error
if rf, ok := ret.Get(0).(func(string) error); ok {
r0 = rf(_a0)
} else {
r0 = ret.Error(0)
}
return r0
}
// RecordTrace provides a mock function with given fields: operation, location, duration, logs
func (_m *Environment) RecordTrace(operation string, location common.Location, duration time.Duration, logs []opentracing.LogRecord) {
_m.Called(operation, location, duration, logs)
}
// RemoveAccountContractCode provides a mock function with given fields: address, name
func (_m *Environment) RemoveAccountContractCode(address common.Address, name string) error {
ret := _m.Called(address, name)
var r0 error
if rf, ok := ret.Get(0).(func(common.Address, string) error); ok {
r0 = rf(address, name)
} else {
r0 = ret.Error(0)
}
return r0
}
// ResolveLocation provides a mock function with given fields: identifiers, location
func (_m *Environment) ResolveLocation(identifiers []ast.Identifier, location common.Location) ([]sema.ResolvedLocation, error) {
ret := _m.Called(identifiers, location)
var r0 []sema.ResolvedLocation
if rf, ok := ret.Get(0).(func([]ast.Identifier, common.Location) []sema.ResolvedLocation); ok {
r0 = rf(identifiers, location)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]sema.ResolvedLocation)
}
}
var r1 error
if rf, ok := ret.Get(1).(func([]ast.Identifier, common.Location) error); ok {
r1 = rf(identifiers, location)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// ResourceOwnerChanged provides a mock function with given fields: _a0, resource, oldOwner, newOwner
func (_m *Environment) ResourceOwnerChanged(_a0 *interpreter.Interpreter, resource *interpreter.CompositeValue, oldOwner common.Address, newOwner common.Address) {
_m.Called(_a0, resource, oldOwner, newOwner)
}
// RevokeAccountKey provides a mock function with given fields: address, index
func (_m *Environment) RevokeAccountKey(address common.Address, index int) (*runtime.AccountKey, error) {
ret := _m.Called(address, index)
var r0 *runtime.AccountKey
if rf, ok := ret.Get(0).(func(common.Address, int) *runtime.AccountKey); ok {
r0 = rf(address, index)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*runtime.AccountKey)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Address, int) error); ok {
r1 = rf(address, index)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RevokeEncodedAccountKey provides a mock function with given fields: address, index
func (_m *Environment) RevokeEncodedAccountKey(address common.Address, index int) ([]byte, error) {
ret := _m.Called(address, index)
var r0 []byte
if rf, ok := ret.Get(0).(func(common.Address, int) []byte); ok {
r0 = rf(address, index)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]byte)
}
}
var r1 error
if rf, ok := ret.Get(1).(func(common.Address, int) error); ok {
r1 = rf(address, index)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// SetProgram provides a mock function with given fields: _a0, _a1
func (_m *Environment) SetProgram(_a0 common.Location, _a1 *interpreter.Program) error {
ret := _m.Called(_a0, _a1)
var r0 error
if rf, ok := ret.Get(0).(func(common.Location, *interpreter.Program) error); ok {
r0 = rf(_a0, _a1)
} else {
r0 = ret.Error(0)
}
return r0
}
// SetValue provides a mock function with given fields: owner, key, value
func (_m *Environment) SetValue(owner []byte, key []byte, value []byte) error {
ret := _m.Called(owner, key, value)
var r0 error
if rf, ok := ret.Get(0).(func([]byte, []byte, []byte) error); ok {
r0 = rf(owner, key, value)
} else {
r0 = ret.Error(0)
}
return r0
}
// UnsafeRandom provides a mock function with given fields:
func (_m *Environment) UnsafeRandom() (uint64, error) {
ret := _m.Called()
var r0 uint64
if rf, ok := ret.Get(0).(func() uint64); ok {
r0 = rf()
} else {
r0 = ret.Get(0).(uint64)
}
var r1 error
if rf, ok := ret.Get(1).(func() error); ok {
r1 = rf()
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// UpdateAccountContractCode provides a mock function with given fields: address, name, code
func (_m *Environment) UpdateAccountContractCode(address common.Address, name string, code []byte) error {
ret := _m.Called(address, name, code)
var r0 error
if rf, ok := ret.Get(0).(func(common.Address, string, []byte) error); ok {
r0 = rf(address, name, code)
} else {
r0 = ret.Error(0)
}
return r0
}
// VM provides a mock function with given fields:
func (_m *Environment) VM() *fvm.VirtualMachine {
ret := _m.Called()
var r0 *fvm.VirtualMachine
if rf, ok := ret.Get(0).(func() *fvm.VirtualMachine); ok {
r0 = rf()
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*fvm.VirtualMachine)
}
}
return r0
}
// ValidatePublicKey provides a mock function with given fields: key
func (_m *Environment) ValidatePublicKey(key *runtime.PublicKey) error {
ret := _m.Called(key)
var r0 error
if rf, ok := ret.Get(0).(func(*runtime.PublicKey) error); ok {
r0 = rf(key)
} else {
r0 = ret.Error(0)
}
return r0
}
// ValueExists provides a mock function with given fields: owner, key
func (_m *Environment) ValueExists(owner []byte, key []byte) (bool, error) {
ret := _m.Called(owner, key)
var r0 bool
if rf, ok := ret.Get(0).(func([]byte, []byte) bool); ok {
r0 = rf(owner, key)
} else {
r0 = ret.Get(0).(bool)
}
var r1 error
if rf, ok := ret.Get(1).(func([]byte, []byte) error); ok {
r1 = rf(owner, key)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// VerifySignature provides a mock function with given fields: signature, tag, signedData, publicKey, signatureAlgorithm, hashAlgorithm
func (_m *Environment) VerifySignature(signature []byte, tag string, signedData []byte, publicKey []byte, signatureAlgorithm sema.SignatureAlgorithm, hashAlgorithm sema.HashAlgorithm) (bool, error) {
ret := _m.Called(signature, tag, signedData, publicKey, signatureAlgorithm, hashAlgorithm)
var r0 bool
if rf, ok := ret.Get(0).(func([]byte, string, []byte, []byte, sema.SignatureAlgorithm, sema.HashAlgorithm) bool); ok {
r0 = rf(signature, tag, signedData, publicKey, signatureAlgorithm, hashAlgorithm)
} else {
r0 = ret.Get(0).(bool)
}
var r1 error
if rf, ok := ret.Get(1).(func([]byte, string, []byte, []byte, sema.SignatureAlgorithm, sema.HashAlgorithm) error); ok {
r1 = rf(signature, tag, signedData, publicKey, signatureAlgorithm, hashAlgorithm)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewEnvironment creates a new instance of Environment. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.
func NewEnvironment(t testing.TB) *Environment {
mock := &Environment{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}