forked from okx/xlayer-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mock_state.go
323 lines (264 loc) · 8.48 KB
/
mock_state.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
// Code generated by mockery v2.39.0. DO NOT EDIT.
package sequencesender
import (
context "context"
pgx "github.com/jackc/pgx/v4"
mock "github.com/stretchr/testify/mock"
state "github.com/0xPolygonHermez/zkevm-node/state"
time "time"
)
// StateMock is an autogenerated mock type for the stateInterface type
type StateMock struct {
mock.Mock
}
// GetBatchByNumber provides a mock function with given fields: ctx, batchNumber, dbTx
func (_m *StateMock) GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) {
ret := _m.Called(ctx, batchNumber, dbTx)
if len(ret) == 0 {
panic("no return value specified for GetBatchByNumber")
}
var r0 *state.Batch
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (*state.Batch, error)); ok {
return rf(ctx, batchNumber, dbTx)
}
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) *state.Batch); ok {
r0 = rf(ctx, batchNumber, dbTx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*state.Batch)
}
}
if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok {
r1 = rf(ctx, batchNumber, dbTx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetBlockByNumber provides a mock function with given fields: ctx, blockNumber, dbTx
func (_m *StateMock) GetBlockByNumber(ctx context.Context, blockNumber uint64, dbTx pgx.Tx) (*state.Block, error) {
ret := _m.Called(ctx, blockNumber, dbTx)
if len(ret) == 0 {
panic("no return value specified for GetBlockByNumber")
}
var r0 *state.Block
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (*state.Block, error)); ok {
return rf(ctx, blockNumber, dbTx)
}
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) *state.Block); ok {
r0 = rf(ctx, blockNumber, dbTx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*state.Block)
}
}
if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok {
r1 = rf(ctx, blockNumber, dbTx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetForcedBatch provides a mock function with given fields: ctx, forcedBatchNumber, dbTx
func (_m *StateMock) GetForcedBatch(ctx context.Context, forcedBatchNumber uint64, dbTx pgx.Tx) (*state.ForcedBatch, error) {
ret := _m.Called(ctx, forcedBatchNumber, dbTx)
if len(ret) == 0 {
panic("no return value specified for GetForcedBatch")
}
var r0 *state.ForcedBatch
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (*state.ForcedBatch, error)); ok {
return rf(ctx, forcedBatchNumber, dbTx)
}
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) *state.ForcedBatch); ok {
r0 = rf(ctx, forcedBatchNumber, dbTx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*state.ForcedBatch)
}
}
if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok {
r1 = rf(ctx, forcedBatchNumber, dbTx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetLastBatchNumber provides a mock function with given fields: ctx, dbTx
func (_m *StateMock) GetLastBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) {
ret := _m.Called(ctx, dbTx)
if len(ret) == 0 {
panic("no return value specified for GetLastBatchNumber")
}
var r0 uint64
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) (uint64, error)); ok {
return rf(ctx, dbTx)
}
if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) uint64); ok {
r0 = rf(ctx, dbTx)
} else {
r0 = ret.Get(0).(uint64)
}
if rf, ok := ret.Get(1).(func(context.Context, pgx.Tx) error); ok {
r1 = rf(ctx, dbTx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetLastClosedBatch provides a mock function with given fields: ctx, dbTx
func (_m *StateMock) GetLastClosedBatch(ctx context.Context, dbTx pgx.Tx) (*state.Batch, error) {
ret := _m.Called(ctx, dbTx)
if len(ret) == 0 {
panic("no return value specified for GetLastClosedBatch")
}
var r0 *state.Batch
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) (*state.Batch, error)); ok {
return rf(ctx, dbTx)
}
if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) *state.Batch); ok {
r0 = rf(ctx, dbTx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*state.Batch)
}
}
if rf, ok := ret.Get(1).(func(context.Context, pgx.Tx) error); ok {
r1 = rf(ctx, dbTx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetLastL2BlockByBatchNumber provides a mock function with given fields: ctx, batchNumber, dbTx
func (_m *StateMock) GetLastL2BlockByBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.L2Block, error) {
ret := _m.Called(ctx, batchNumber, dbTx)
if len(ret) == 0 {
panic("no return value specified for GetLastL2BlockByBatchNumber")
}
var r0 *state.L2Block
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (*state.L2Block, error)); ok {
return rf(ctx, batchNumber, dbTx)
}
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) *state.L2Block); ok {
r0 = rf(ctx, batchNumber, dbTx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*state.L2Block)
}
}
if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok {
r1 = rf(ctx, batchNumber, dbTx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetLastVirtualBatchNum provides a mock function with given fields: ctx, dbTx
func (_m *StateMock) GetLastVirtualBatchNum(ctx context.Context, dbTx pgx.Tx) (uint64, error) {
ret := _m.Called(ctx, dbTx)
if len(ret) == 0 {
panic("no return value specified for GetLastVirtualBatchNum")
}
var r0 uint64
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) (uint64, error)); ok {
return rf(ctx, dbTx)
}
if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) uint64); ok {
r0 = rf(ctx, dbTx)
} else {
r0 = ret.Get(0).(uint64)
}
if rf, ok := ret.Get(1).(func(context.Context, pgx.Tx) error); ok {
r1 = rf(ctx, dbTx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// GetTimeForLatestBatchVirtualization provides a mock function with given fields: ctx, dbTx
func (_m *StateMock) GetTimeForLatestBatchVirtualization(ctx context.Context, dbTx pgx.Tx) (time.Time, error) {
ret := _m.Called(ctx, dbTx)
if len(ret) == 0 {
panic("no return value specified for GetTimeForLatestBatchVirtualization")
}
var r0 time.Time
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) (time.Time, error)); ok {
return rf(ctx, dbTx)
}
if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) time.Time); ok {
r0 = rf(ctx, dbTx)
} else {
r0 = ret.Get(0).(time.Time)
}
if rf, ok := ret.Get(1).(func(context.Context, pgx.Tx) error); ok {
r1 = rf(ctx, dbTx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IsBatchChecked provides a mock function with given fields: ctx, batchNum, dbTx
func (_m *StateMock) IsBatchChecked(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (bool, error) {
ret := _m.Called(ctx, batchNum, dbTx)
if len(ret) == 0 {
panic("no return value specified for IsBatchChecked")
}
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (bool, error)); ok {
return rf(ctx, batchNum, dbTx)
}
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) bool); ok {
r0 = rf(ctx, batchNum, dbTx)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok {
r1 = rf(ctx, batchNum, dbTx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// IsBatchClosed provides a mock function with given fields: ctx, batchNum, dbTx
func (_m *StateMock) IsBatchClosed(ctx context.Context, batchNum uint64, dbTx pgx.Tx) (bool, error) {
ret := _m.Called(ctx, batchNum, dbTx)
if len(ret) == 0 {
panic("no return value specified for IsBatchClosed")
}
var r0 bool
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (bool, error)); ok {
return rf(ctx, batchNum, dbTx)
}
if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) bool); ok {
r0 = rf(ctx, batchNum, dbTx)
} else {
r0 = ret.Get(0).(bool)
}
if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok {
r1 = rf(ctx, batchNum, dbTx)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// NewStateMock creates a new instance of StateMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewStateMock(t interface {
mock.TestingT
Cleanup(func())
}) *StateMock {
mock := &StateMock{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}