forked from 0xPolygonHermez/zkevm-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmock_worker.go
227 lines (183 loc) · 6.83 KB
/
mock_worker.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
// Code generated by mockery v2.39.0. DO NOT EDIT.
package sequencer
import (
context "context"
big "math/big"
common "github.com/ethereum/go-ethereum/common"
mock "github.com/stretchr/testify/mock"
state "github.com/0xPolygonHermez/zkevm-node/state"
types "github.com/ethereum/go-ethereum/core/types"
)
// WorkerMock is an autogenerated mock type for the workerInterface type
type WorkerMock struct {
mock.Mock
}
// AddForcedTx provides a mock function with given fields: txHash, addr
func (_m *WorkerMock) AddForcedTx(txHash common.Hash, addr common.Address) {
_m.Called(txHash, addr)
}
// AddTxTracker provides a mock function with given fields: ctx, txTracker
func (_m *WorkerMock) AddTxTracker(ctx context.Context, txTracker *TxTracker) (*TxTracker, error) {
ret := _m.Called(ctx, txTracker)
if len(ret) == 0 {
panic("no return value specified for AddTxTracker")
}
var r0 *TxTracker
var r1 error
if rf, ok := ret.Get(0).(func(context.Context, *TxTracker) (*TxTracker, error)); ok {
return rf(ctx, txTracker)
}
if rf, ok := ret.Get(0).(func(context.Context, *TxTracker) *TxTracker); ok {
r0 = rf(ctx, txTracker)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*TxTracker)
}
}
if rf, ok := ret.Get(1).(func(context.Context, *TxTracker) error); ok {
r1 = rf(ctx, txTracker)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// DeleteForcedTx provides a mock function with given fields: txHash, addr
func (_m *WorkerMock) DeleteForcedTx(txHash common.Hash, addr common.Address) {
_m.Called(txHash, addr)
}
// DeleteTx provides a mock function with given fields: txHash, from
func (_m *WorkerMock) DeleteTx(txHash common.Hash, from common.Address) {
_m.Called(txHash, from)
}
// DeleteTxPendingToStore provides a mock function with given fields: txHash, addr
func (_m *WorkerMock) DeleteTxPendingToStore(txHash common.Hash, addr common.Address) {
_m.Called(txHash, addr)
}
// GetBestFittingTx provides a mock function with given fields: remainingResources, highReservedCounters
func (_m *WorkerMock) GetBestFittingTx(remainingResources state.BatchResources, highReservedCounters state.ZKCounters) (*TxTracker, error) {
ret := _m.Called(remainingResources, highReservedCounters)
if len(ret) == 0 {
panic("no return value specified for GetBestFittingTx")
}
var r0 *TxTracker
var r1 error
if rf, ok := ret.Get(0).(func(state.BatchResources, state.ZKCounters) (*TxTracker, error)); ok {
return rf(remainingResources, highReservedCounters)
}
if rf, ok := ret.Get(0).(func(state.BatchResources, state.ZKCounters) *TxTracker); ok {
r0 = rf(remainingResources, highReservedCounters)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*TxTracker)
}
}
if rf, ok := ret.Get(1).(func(state.BatchResources, state.ZKCounters) error); ok {
r1 = rf(remainingResources, highReservedCounters)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// MoveTxPendingToStore provides a mock function with given fields: txHash, addr
func (_m *WorkerMock) MoveTxPendingToStore(txHash common.Hash, addr common.Address) {
_m.Called(txHash, addr)
}
// MoveTxToNotReady provides a mock function with given fields: txHash, from, actualNonce, actualBalance
func (_m *WorkerMock) MoveTxToNotReady(txHash common.Hash, from common.Address, actualNonce *uint64, actualBalance *big.Int) []*TxTracker {
ret := _m.Called(txHash, from, actualNonce, actualBalance)
if len(ret) == 0 {
panic("no return value specified for MoveTxToNotReady")
}
var r0 []*TxTracker
if rf, ok := ret.Get(0).(func(common.Hash, common.Address, *uint64, *big.Int) []*TxTracker); ok {
r0 = rf(txHash, from, actualNonce, actualBalance)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*TxTracker)
}
}
return r0
}
// NewTxTracker provides a mock function with given fields: tx, usedZKcounters, reservedZKCouners, ip
func (_m *WorkerMock) NewTxTracker(tx types.Transaction, usedZKcounters state.ZKCounters, reservedZKCouners state.ZKCounters, ip string) (*TxTracker, error) {
ret := _m.Called(tx, usedZKcounters, reservedZKCouners, ip)
if len(ret) == 0 {
panic("no return value specified for NewTxTracker")
}
var r0 *TxTracker
var r1 error
if rf, ok := ret.Get(0).(func(types.Transaction, state.ZKCounters, state.ZKCounters, string) (*TxTracker, error)); ok {
return rf(tx, usedZKcounters, reservedZKCouners, ip)
}
if rf, ok := ret.Get(0).(func(types.Transaction, state.ZKCounters, state.ZKCounters, string) *TxTracker); ok {
r0 = rf(tx, usedZKcounters, reservedZKCouners, ip)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).(*TxTracker)
}
}
if rf, ok := ret.Get(1).(func(types.Transaction, state.ZKCounters, state.ZKCounters, string) error); ok {
r1 = rf(tx, usedZKcounters, reservedZKCouners, ip)
} else {
r1 = ret.Error(1)
}
return r0, r1
}
// RestoreTxsPendingToStore provides a mock function with given fields: ctx
func (_m *WorkerMock) RestoreTxsPendingToStore(ctx context.Context) ([]*TxTracker, []*TxTracker) {
ret := _m.Called(ctx)
if len(ret) == 0 {
panic("no return value specified for RestoreTxsPendingToStore")
}
var r0 []*TxTracker
var r1 []*TxTracker
if rf, ok := ret.Get(0).(func(context.Context) ([]*TxTracker, []*TxTracker)); ok {
return rf(ctx)
}
if rf, ok := ret.Get(0).(func(context.Context) []*TxTracker); ok {
r0 = rf(ctx)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*TxTracker)
}
}
if rf, ok := ret.Get(1).(func(context.Context) []*TxTracker); ok {
r1 = rf(ctx)
} else {
if ret.Get(1) != nil {
r1 = ret.Get(1).([]*TxTracker)
}
}
return r0, r1
}
// UpdateAfterSingleSuccessfulTxExecution provides a mock function with given fields: from, touchedAddresses
func (_m *WorkerMock) UpdateAfterSingleSuccessfulTxExecution(from common.Address, touchedAddresses map[common.Address]*state.InfoReadWrite) []*TxTracker {
ret := _m.Called(from, touchedAddresses)
if len(ret) == 0 {
panic("no return value specified for UpdateAfterSingleSuccessfulTxExecution")
}
var r0 []*TxTracker
if rf, ok := ret.Get(0).(func(common.Address, map[common.Address]*state.InfoReadWrite) []*TxTracker); ok {
r0 = rf(from, touchedAddresses)
} else {
if ret.Get(0) != nil {
r0 = ret.Get(0).([]*TxTracker)
}
}
return r0
}
// UpdateTxZKCounters provides a mock function with given fields: txHash, from, usedZKCounters, reservedZKCounters
func (_m *WorkerMock) UpdateTxZKCounters(txHash common.Hash, from common.Address, usedZKCounters state.ZKCounters, reservedZKCounters state.ZKCounters) {
_m.Called(txHash, from, usedZKCounters, reservedZKCounters)
}
// NewWorkerMock creates a new instance of WorkerMock. 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 NewWorkerMock(t interface {
mock.TestingT
Cleanup(func())
}) *WorkerMock {
mock := &WorkerMock{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}