-
Notifications
You must be signed in to change notification settings - Fork 667
/
chain_vm.go
377 lines (322 loc) · 13 KB
/
chain_vm.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
// Code generated by MockGen. DO NOT EDIT.
// Source: snow/engine/snowman/block/vm.go
// Package mocks is a generated GoMock package.
package mocks
import (
reflect "reflect"
time "time"
manager "github.com/ava-labs/avalanchego/database/manager"
ids "github.com/ava-labs/avalanchego/ids"
snow "github.com/ava-labs/avalanchego/snow"
snowman "github.com/ava-labs/avalanchego/snow/consensus/snowman"
common "github.com/ava-labs/avalanchego/snow/engine/common"
version "github.com/ava-labs/avalanchego/version"
gomock "github.com/golang/mock/gomock"
)
// MockChainVM is a mock of ChainVM interface.
type MockChainVM struct {
ctrl *gomock.Controller
recorder *MockChainVMMockRecorder
}
// MockChainVMMockRecorder is the mock recorder for MockChainVM.
type MockChainVMMockRecorder struct {
mock *MockChainVM
}
// NewMockChainVM creates a new mock instance.
func NewMockChainVM(ctrl *gomock.Controller) *MockChainVM {
mock := &MockChainVM{ctrl: ctrl}
mock.recorder = &MockChainVMMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockChainVM) EXPECT() *MockChainVMMockRecorder {
return m.recorder
}
// AppGossip mocks base method.
func (m *MockChainVM) AppGossip(nodeID ids.NodeID, msg []byte) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AppGossip", nodeID, msg)
ret0, _ := ret[0].(error)
return ret0
}
// AppGossip indicates an expected call of AppGossip.
func (mr *MockChainVMMockRecorder) AppGossip(nodeID, msg interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppGossip", reflect.TypeOf((*MockChainVM)(nil).AppGossip), nodeID, msg)
}
// AppRequest mocks base method.
func (m *MockChainVM) AppRequest(nodeID ids.NodeID, requestID uint32, deadline time.Time, request []byte) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AppRequest", nodeID, requestID, deadline, request)
ret0, _ := ret[0].(error)
return ret0
}
// AppRequest indicates an expected call of AppRequest.
func (mr *MockChainVMMockRecorder) AppRequest(nodeID, requestID, deadline, request interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequest", reflect.TypeOf((*MockChainVM)(nil).AppRequest), nodeID, requestID, deadline, request)
}
// AppRequestFailed mocks base method.
func (m *MockChainVM) AppRequestFailed(nodeID ids.NodeID, requestID uint32) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AppRequestFailed", nodeID, requestID)
ret0, _ := ret[0].(error)
return ret0
}
// AppRequestFailed indicates an expected call of AppRequestFailed.
func (mr *MockChainVMMockRecorder) AppRequestFailed(nodeID, requestID interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppRequestFailed", reflect.TypeOf((*MockChainVM)(nil).AppRequestFailed), nodeID, requestID)
}
// AppResponse mocks base method.
func (m *MockChainVM) AppResponse(nodeID ids.NodeID, requestID uint32, response []byte) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "AppResponse", nodeID, requestID, response)
ret0, _ := ret[0].(error)
return ret0
}
// AppResponse indicates an expected call of AppResponse.
func (mr *MockChainVMMockRecorder) AppResponse(nodeID, requestID, response interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AppResponse", reflect.TypeOf((*MockChainVM)(nil).AppResponse), nodeID, requestID, response)
}
// BuildBlock mocks base method.
func (m *MockChainVM) BuildBlock() (snowman.Block, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "BuildBlock")
ret0, _ := ret[0].(snowman.Block)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// BuildBlock indicates an expected call of BuildBlock.
func (mr *MockChainVMMockRecorder) BuildBlock() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BuildBlock", reflect.TypeOf((*MockChainVM)(nil).BuildBlock))
}
// Connected mocks base method.
func (m *MockChainVM) Connected(id ids.NodeID, nodeVersion version.Application) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Connected", id, nodeVersion)
ret0, _ := ret[0].(error)
return ret0
}
// Connected indicates an expected call of Connected.
func (mr *MockChainVMMockRecorder) Connected(id, nodeVersion interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Connected", reflect.TypeOf((*MockChainVM)(nil).Connected), id, nodeVersion)
}
// CreateHandlers mocks base method.
func (m *MockChainVM) CreateHandlers() (map[string]*common.HTTPHandler, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateHandlers")
ret0, _ := ret[0].(map[string]*common.HTTPHandler)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// CreateHandlers indicates an expected call of CreateHandlers.
func (mr *MockChainVMMockRecorder) CreateHandlers() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateHandlers", reflect.TypeOf((*MockChainVM)(nil).CreateHandlers))
}
// CreateStaticHandlers mocks base method.
func (m *MockChainVM) CreateStaticHandlers() (map[string]*common.HTTPHandler, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "CreateStaticHandlers")
ret0, _ := ret[0].(map[string]*common.HTTPHandler)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// CreateStaticHandlers indicates an expected call of CreateStaticHandlers.
func (mr *MockChainVMMockRecorder) CreateStaticHandlers() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateStaticHandlers", reflect.TypeOf((*MockChainVM)(nil).CreateStaticHandlers))
}
// Disconnected mocks base method.
func (m *MockChainVM) Disconnected(id ids.NodeID) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Disconnected", id)
ret0, _ := ret[0].(error)
return ret0
}
// Disconnected indicates an expected call of Disconnected.
func (mr *MockChainVMMockRecorder) Disconnected(id interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Disconnected", reflect.TypeOf((*MockChainVM)(nil).Disconnected), id)
}
// GetBlock mocks base method.
func (m *MockChainVM) GetBlock(arg0 ids.ID) (snowman.Block, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetBlock", arg0)
ret0, _ := ret[0].(snowman.Block)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetBlock indicates an expected call of GetBlock.
func (mr *MockChainVMMockRecorder) GetBlock(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*MockChainVM)(nil).GetBlock), arg0)
}
// HealthCheck mocks base method.
func (m *MockChainVM) HealthCheck() (interface{}, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "HealthCheck")
ret0, _ := ret[0].(interface{})
ret1, _ := ret[1].(error)
return ret0, ret1
}
// HealthCheck indicates an expected call of HealthCheck.
func (mr *MockChainVMMockRecorder) HealthCheck() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HealthCheck", reflect.TypeOf((*MockChainVM)(nil).HealthCheck))
}
// Initialize mocks base method.
func (m *MockChainVM) Initialize(ctx *snow.Context, dbManager manager.Manager, genesisBytes, upgradeBytes, configBytes []byte, toEngine chan<- common.Message, fxs []*common.Fx, appSender common.AppSender) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Initialize", ctx, dbManager, genesisBytes, upgradeBytes, configBytes, toEngine, fxs, appSender)
ret0, _ := ret[0].(error)
return ret0
}
// Initialize indicates an expected call of Initialize.
func (mr *MockChainVMMockRecorder) Initialize(ctx, dbManager, genesisBytes, upgradeBytes, configBytes, toEngine, fxs, appSender interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Initialize", reflect.TypeOf((*MockChainVM)(nil).Initialize), ctx, dbManager, genesisBytes, upgradeBytes, configBytes, toEngine, fxs, appSender)
}
// LastAccepted mocks base method.
func (m *MockChainVM) LastAccepted() (ids.ID, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "LastAccepted")
ret0, _ := ret[0].(ids.ID)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// LastAccepted indicates an expected call of LastAccepted.
func (mr *MockChainVMMockRecorder) LastAccepted() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "LastAccepted", reflect.TypeOf((*MockChainVM)(nil).LastAccepted))
}
// ParseBlock mocks base method.
func (m *MockChainVM) ParseBlock(arg0 []byte) (snowman.Block, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ParseBlock", arg0)
ret0, _ := ret[0].(snowman.Block)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ParseBlock indicates an expected call of ParseBlock.
func (mr *MockChainVMMockRecorder) ParseBlock(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseBlock", reflect.TypeOf((*MockChainVM)(nil).ParseBlock), arg0)
}
// SetPreference mocks base method.
func (m *MockChainVM) SetPreference(arg0 ids.ID) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetPreference", arg0)
ret0, _ := ret[0].(error)
return ret0
}
// SetPreference indicates an expected call of SetPreference.
func (mr *MockChainVMMockRecorder) SetPreference(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetPreference", reflect.TypeOf((*MockChainVM)(nil).SetPreference), arg0)
}
// SetState mocks base method.
func (m *MockChainVM) SetState(state snow.State) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "SetState", state)
ret0, _ := ret[0].(error)
return ret0
}
// SetState indicates an expected call of SetState.
func (mr *MockChainVMMockRecorder) SetState(state interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetState", reflect.TypeOf((*MockChainVM)(nil).SetState), state)
}
// Shutdown mocks base method.
func (m *MockChainVM) Shutdown() error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Shutdown")
ret0, _ := ret[0].(error)
return ret0
}
// Shutdown indicates an expected call of Shutdown.
func (mr *MockChainVMMockRecorder) Shutdown() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Shutdown", reflect.TypeOf((*MockChainVM)(nil).Shutdown))
}
// Version mocks base method.
func (m *MockChainVM) Version() (string, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "Version")
ret0, _ := ret[0].(string)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// Version indicates an expected call of Version.
func (mr *MockChainVMMockRecorder) Version() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Version", reflect.TypeOf((*MockChainVM)(nil).Version))
}
// MockGetter is a mock of Getter interface.
type MockGetter struct {
ctrl *gomock.Controller
recorder *MockGetterMockRecorder
}
// MockGetterMockRecorder is the mock recorder for MockGetter.
type MockGetterMockRecorder struct {
mock *MockGetter
}
// NewMockGetter creates a new mock instance.
func NewMockGetter(ctrl *gomock.Controller) *MockGetter {
mock := &MockGetter{ctrl: ctrl}
mock.recorder = &MockGetterMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockGetter) EXPECT() *MockGetterMockRecorder {
return m.recorder
}
// GetBlock mocks base method.
func (m *MockGetter) GetBlock(arg0 ids.ID) (snowman.Block, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "GetBlock", arg0)
ret0, _ := ret[0].(snowman.Block)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// GetBlock indicates an expected call of GetBlock.
func (mr *MockGetterMockRecorder) GetBlock(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBlock", reflect.TypeOf((*MockGetter)(nil).GetBlock), arg0)
}
// MockParser is a mock of Parser interface.
type MockParser struct {
ctrl *gomock.Controller
recorder *MockParserMockRecorder
}
// MockParserMockRecorder is the mock recorder for MockParser.
type MockParserMockRecorder struct {
mock *MockParser
}
// NewMockParser creates a new mock instance.
func NewMockParser(ctrl *gomock.Controller) *MockParser {
mock := &MockParser{ctrl: ctrl}
mock.recorder = &MockParserMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockParser) EXPECT() *MockParserMockRecorder {
return m.recorder
}
// ParseBlock mocks base method.
func (m *MockParser) ParseBlock(arg0 []byte) (snowman.Block, error) {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "ParseBlock", arg0)
ret0, _ := ret[0].(snowman.Block)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// ParseBlock indicates an expected call of ParseBlock.
func (mr *MockParserMockRecorder) ParseBlock(arg0 interface{}) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ParseBlock", reflect.TypeOf((*MockParser)(nil).ParseBlock), arg0)
}