github.com/0xPolygon/supernets2-node@v0.0.0-20230711153321-2fe574524eaa/sequencer/mock_db_manager.go (about) 1 // Code generated by mockery v2.22.1. DO NOT EDIT. 2 3 package sequencer 4 5 import ( 6 context "context" 7 big "math/big" 8 9 common "github.com/ethereum/go-ethereum/common" 10 11 mock "github.com/stretchr/testify/mock" 12 13 pgx "github.com/jackc/pgx/v4" 14 15 pool "github.com/0xPolygon/supernets2-node/pool" 16 17 state "github.com/0xPolygon/supernets2-node/state" 18 19 time "time" 20 21 types "github.com/ethereum/go-ethereum/core/types" 22 ) 23 24 // DbManagerMock is an autogenerated mock type for the dbManagerInterface type 25 type DbManagerMock struct { 26 mock.Mock 27 } 28 29 // BeginStateTransaction provides a mock function with given fields: ctx 30 func (_m *DbManagerMock) BeginStateTransaction(ctx context.Context) (pgx.Tx, error) { 31 ret := _m.Called(ctx) 32 33 var r0 pgx.Tx 34 var r1 error 35 if rf, ok := ret.Get(0).(func(context.Context) (pgx.Tx, error)); ok { 36 return rf(ctx) 37 } 38 if rf, ok := ret.Get(0).(func(context.Context) pgx.Tx); ok { 39 r0 = rf(ctx) 40 } else { 41 if ret.Get(0) != nil { 42 r0 = ret.Get(0).(pgx.Tx) 43 } 44 } 45 46 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 47 r1 = rf(ctx) 48 } else { 49 r1 = ret.Error(1) 50 } 51 52 return r0, r1 53 } 54 55 // CloseBatch provides a mock function with given fields: ctx, params 56 func (_m *DbManagerMock) CloseBatch(ctx context.Context, params ClosingBatchParameters) error { 57 ret := _m.Called(ctx, params) 58 59 var r0 error 60 if rf, ok := ret.Get(0).(func(context.Context, ClosingBatchParameters) error); ok { 61 r0 = rf(ctx, params) 62 } else { 63 r0 = ret.Error(0) 64 } 65 66 return r0 67 } 68 69 // CountReorgs provides a mock function with given fields: ctx, dbTx 70 func (_m *DbManagerMock) CountReorgs(ctx context.Context, dbTx pgx.Tx) (uint64, error) { 71 ret := _m.Called(ctx, dbTx) 72 73 var r0 uint64 74 var r1 error 75 if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) (uint64, error)); ok { 76 return rf(ctx, dbTx) 77 } 78 if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) uint64); ok { 79 r0 = rf(ctx, dbTx) 80 } else { 81 r0 = ret.Get(0).(uint64) 82 } 83 84 if rf, ok := ret.Get(1).(func(context.Context, pgx.Tx) error); ok { 85 r1 = rf(ctx, dbTx) 86 } else { 87 r1 = ret.Error(1) 88 } 89 90 return r0, r1 91 } 92 93 // CreateFirstBatch provides a mock function with given fields: ctx, sequencerAddress 94 func (_m *DbManagerMock) CreateFirstBatch(ctx context.Context, sequencerAddress common.Address) state.ProcessingContext { 95 ret := _m.Called(ctx, sequencerAddress) 96 97 var r0 state.ProcessingContext 98 if rf, ok := ret.Get(0).(func(context.Context, common.Address) state.ProcessingContext); ok { 99 r0 = rf(ctx, sequencerAddress) 100 } else { 101 r0 = ret.Get(0).(state.ProcessingContext) 102 } 103 104 return r0 105 } 106 107 // DeleteTransactionFromPool provides a mock function with given fields: ctx, txHash 108 func (_m *DbManagerMock) DeleteTransactionFromPool(ctx context.Context, txHash common.Hash) error { 109 ret := _m.Called(ctx, txHash) 110 111 var r0 error 112 if rf, ok := ret.Get(0).(func(context.Context, common.Hash) error); ok { 113 r0 = rf(ctx, txHash) 114 } else { 115 r0 = ret.Error(0) 116 } 117 118 return r0 119 } 120 121 // FlushMerkleTree provides a mock function with given fields: ctx 122 func (_m *DbManagerMock) FlushMerkleTree(ctx context.Context) error { 123 ret := _m.Called(ctx) 124 125 var r0 error 126 if rf, ok := ret.Get(0).(func(context.Context) error); ok { 127 r0 = rf(ctx) 128 } else { 129 r0 = ret.Error(0) 130 } 131 132 return r0 133 } 134 135 // GetBalanceByStateRoot provides a mock function with given fields: ctx, address, root 136 func (_m *DbManagerMock) GetBalanceByStateRoot(ctx context.Context, address common.Address, root common.Hash) (*big.Int, error) { 137 ret := _m.Called(ctx, address, root) 138 139 var r0 *big.Int 140 var r1 error 141 if rf, ok := ret.Get(0).(func(context.Context, common.Address, common.Hash) (*big.Int, error)); ok { 142 return rf(ctx, address, root) 143 } 144 if rf, ok := ret.Get(0).(func(context.Context, common.Address, common.Hash) *big.Int); ok { 145 r0 = rf(ctx, address, root) 146 } else { 147 if ret.Get(0) != nil { 148 r0 = ret.Get(0).(*big.Int) 149 } 150 } 151 152 if rf, ok := ret.Get(1).(func(context.Context, common.Address, common.Hash) error); ok { 153 r1 = rf(ctx, address, root) 154 } else { 155 r1 = ret.Error(1) 156 } 157 158 return r0, r1 159 } 160 161 // GetBatchByNumber provides a mock function with given fields: ctx, batchNumber, dbTx 162 func (_m *DbManagerMock) GetBatchByNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.Batch, error) { 163 ret := _m.Called(ctx, batchNumber, dbTx) 164 165 var r0 *state.Batch 166 var r1 error 167 if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) (*state.Batch, error)); ok { 168 return rf(ctx, batchNumber, dbTx) 169 } 170 if rf, ok := ret.Get(0).(func(context.Context, uint64, pgx.Tx) *state.Batch); ok { 171 r0 = rf(ctx, batchNumber, dbTx) 172 } else { 173 if ret.Get(0) != nil { 174 r0 = ret.Get(0).(*state.Batch) 175 } 176 } 177 178 if rf, ok := ret.Get(1).(func(context.Context, uint64, pgx.Tx) error); ok { 179 r1 = rf(ctx, batchNumber, dbTx) 180 } else { 181 r1 = ret.Error(1) 182 } 183 184 return r0, r1 185 } 186 187 // GetForcedBatchesSince provides a mock function with given fields: ctx, forcedBatchNumber, maxBlockNumber, dbTx 188 func (_m *DbManagerMock) GetForcedBatchesSince(ctx context.Context, forcedBatchNumber uint64, maxBlockNumber uint64, dbTx pgx.Tx) ([]*state.ForcedBatch, error) { 189 ret := _m.Called(ctx, forcedBatchNumber, maxBlockNumber, dbTx) 190 191 var r0 []*state.ForcedBatch 192 var r1 error 193 if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64, pgx.Tx) ([]*state.ForcedBatch, error)); ok { 194 return rf(ctx, forcedBatchNumber, maxBlockNumber, dbTx) 195 } 196 if rf, ok := ret.Get(0).(func(context.Context, uint64, uint64, pgx.Tx) []*state.ForcedBatch); ok { 197 r0 = rf(ctx, forcedBatchNumber, maxBlockNumber, dbTx) 198 } else { 199 if ret.Get(0) != nil { 200 r0 = ret.Get(0).([]*state.ForcedBatch) 201 } 202 } 203 204 if rf, ok := ret.Get(1).(func(context.Context, uint64, uint64, pgx.Tx) error); ok { 205 r1 = rf(ctx, forcedBatchNumber, maxBlockNumber, dbTx) 206 } else { 207 r1 = ret.Error(1) 208 } 209 210 return r0, r1 211 } 212 213 // GetLastBatch provides a mock function with given fields: ctx 214 func (_m *DbManagerMock) GetLastBatch(ctx context.Context) (*state.Batch, error) { 215 ret := _m.Called(ctx) 216 217 var r0 *state.Batch 218 var r1 error 219 if rf, ok := ret.Get(0).(func(context.Context) (*state.Batch, error)); ok { 220 return rf(ctx) 221 } 222 if rf, ok := ret.Get(0).(func(context.Context) *state.Batch); ok { 223 r0 = rf(ctx) 224 } else { 225 if ret.Get(0) != nil { 226 r0 = ret.Get(0).(*state.Batch) 227 } 228 } 229 230 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 231 r1 = rf(ctx) 232 } else { 233 r1 = ret.Error(1) 234 } 235 236 return r0, r1 237 } 238 239 // GetLastBatchNumber provides a mock function with given fields: ctx 240 func (_m *DbManagerMock) GetLastBatchNumber(ctx context.Context) (uint64, error) { 241 ret := _m.Called(ctx) 242 243 var r0 uint64 244 var r1 error 245 if rf, ok := ret.Get(0).(func(context.Context) (uint64, error)); ok { 246 return rf(ctx) 247 } 248 if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { 249 r0 = rf(ctx) 250 } else { 251 r0 = ret.Get(0).(uint64) 252 } 253 254 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 255 r1 = rf(ctx) 256 } else { 257 r1 = ret.Error(1) 258 } 259 260 return r0, r1 261 } 262 263 // GetLastBlock provides a mock function with given fields: ctx, dbTx 264 func (_m *DbManagerMock) GetLastBlock(ctx context.Context, dbTx pgx.Tx) (*state.Block, error) { 265 ret := _m.Called(ctx, dbTx) 266 267 var r0 *state.Block 268 var r1 error 269 if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) (*state.Block, error)); ok { 270 return rf(ctx, dbTx) 271 } 272 if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) *state.Block); ok { 273 r0 = rf(ctx, dbTx) 274 } else { 275 if ret.Get(0) != nil { 276 r0 = ret.Get(0).(*state.Block) 277 } 278 } 279 280 if rf, ok := ret.Get(1).(func(context.Context, pgx.Tx) error); ok { 281 r1 = rf(ctx, dbTx) 282 } else { 283 r1 = ret.Error(1) 284 } 285 286 return r0, r1 287 } 288 289 // GetLastClosedBatch provides a mock function with given fields: ctx 290 func (_m *DbManagerMock) GetLastClosedBatch(ctx context.Context) (*state.Batch, error) { 291 ret := _m.Called(ctx) 292 293 var r0 *state.Batch 294 var r1 error 295 if rf, ok := ret.Get(0).(func(context.Context) (*state.Batch, error)); ok { 296 return rf(ctx) 297 } 298 if rf, ok := ret.Get(0).(func(context.Context) *state.Batch); ok { 299 r0 = rf(ctx) 300 } else { 301 if ret.Get(0) != nil { 302 r0 = ret.Get(0).(*state.Batch) 303 } 304 } 305 306 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 307 r1 = rf(ctx) 308 } else { 309 r1 = ret.Error(1) 310 } 311 312 return r0, r1 313 } 314 315 // GetLastL2BlockHeader provides a mock function with given fields: ctx, dbTx 316 func (_m *DbManagerMock) GetLastL2BlockHeader(ctx context.Context, dbTx pgx.Tx) (*types.Header, error) { 317 ret := _m.Called(ctx, dbTx) 318 319 var r0 *types.Header 320 var r1 error 321 if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) (*types.Header, error)); ok { 322 return rf(ctx, dbTx) 323 } 324 if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) *types.Header); ok { 325 r0 = rf(ctx, dbTx) 326 } else { 327 if ret.Get(0) != nil { 328 r0 = ret.Get(0).(*types.Header) 329 } 330 } 331 332 if rf, ok := ret.Get(1).(func(context.Context, pgx.Tx) error); ok { 333 r1 = rf(ctx, dbTx) 334 } else { 335 r1 = ret.Error(1) 336 } 337 338 return r0, r1 339 } 340 341 // GetLastNBatches provides a mock function with given fields: ctx, numBatches 342 func (_m *DbManagerMock) GetLastNBatches(ctx context.Context, numBatches uint) ([]*state.Batch, error) { 343 ret := _m.Called(ctx, numBatches) 344 345 var r0 []*state.Batch 346 var r1 error 347 if rf, ok := ret.Get(0).(func(context.Context, uint) ([]*state.Batch, error)); ok { 348 return rf(ctx, numBatches) 349 } 350 if rf, ok := ret.Get(0).(func(context.Context, uint) []*state.Batch); ok { 351 r0 = rf(ctx, numBatches) 352 } else { 353 if ret.Get(0) != nil { 354 r0 = ret.Get(0).([]*state.Batch) 355 } 356 } 357 358 if rf, ok := ret.Get(1).(func(context.Context, uint) error); ok { 359 r1 = rf(ctx, numBatches) 360 } else { 361 r1 = ret.Error(1) 362 } 363 364 return r0, r1 365 } 366 367 // GetLastTrustedForcedBatchNumber provides a mock function with given fields: ctx, dbTx 368 func (_m *DbManagerMock) GetLastTrustedForcedBatchNumber(ctx context.Context, dbTx pgx.Tx) (uint64, error) { 369 ret := _m.Called(ctx, dbTx) 370 371 var r0 uint64 372 var r1 error 373 if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) (uint64, error)); ok { 374 return rf(ctx, dbTx) 375 } 376 if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) uint64); ok { 377 r0 = rf(ctx, dbTx) 378 } else { 379 r0 = ret.Get(0).(uint64) 380 } 381 382 if rf, ok := ret.Get(1).(func(context.Context, pgx.Tx) error); ok { 383 r1 = rf(ctx, dbTx) 384 } else { 385 r1 = ret.Error(1) 386 } 387 388 return r0, r1 389 } 390 391 // GetLatestGer provides a mock function with given fields: ctx, maxBlockNumber 392 func (_m *DbManagerMock) GetLatestGer(ctx context.Context, maxBlockNumber uint64) (state.GlobalExitRoot, time.Time, error) { 393 ret := _m.Called(ctx, maxBlockNumber) 394 395 var r0 state.GlobalExitRoot 396 var r1 time.Time 397 var r2 error 398 if rf, ok := ret.Get(0).(func(context.Context, uint64) (state.GlobalExitRoot, time.Time, error)); ok { 399 return rf(ctx, maxBlockNumber) 400 } 401 if rf, ok := ret.Get(0).(func(context.Context, uint64) state.GlobalExitRoot); ok { 402 r0 = rf(ctx, maxBlockNumber) 403 } else { 404 r0 = ret.Get(0).(state.GlobalExitRoot) 405 } 406 407 if rf, ok := ret.Get(1).(func(context.Context, uint64) time.Time); ok { 408 r1 = rf(ctx, maxBlockNumber) 409 } else { 410 r1 = ret.Get(1).(time.Time) 411 } 412 413 if rf, ok := ret.Get(2).(func(context.Context, uint64) error); ok { 414 r2 = rf(ctx, maxBlockNumber) 415 } else { 416 r2 = ret.Error(2) 417 } 418 419 return r0, r1, r2 420 } 421 422 // GetLatestVirtualBatchTimestamp provides a mock function with given fields: ctx, dbTx 423 func (_m *DbManagerMock) GetLatestVirtualBatchTimestamp(ctx context.Context, dbTx pgx.Tx) (time.Time, error) { 424 ret := _m.Called(ctx, dbTx) 425 426 var r0 time.Time 427 var r1 error 428 if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) (time.Time, error)); ok { 429 return rf(ctx, dbTx) 430 } 431 if rf, ok := ret.Get(0).(func(context.Context, pgx.Tx) time.Time); ok { 432 r0 = rf(ctx, dbTx) 433 } else { 434 r0 = ret.Get(0).(time.Time) 435 } 436 437 if rf, ok := ret.Get(1).(func(context.Context, pgx.Tx) error); ok { 438 r1 = rf(ctx, dbTx) 439 } else { 440 r1 = ret.Error(1) 441 } 442 443 return r0, r1 444 } 445 446 // GetTransactionsByBatchNumber provides a mock function with given fields: ctx, batchNumber 447 func (_m *DbManagerMock) GetTransactionsByBatchNumber(ctx context.Context, batchNumber uint64) ([]types.Transaction, error) { 448 ret := _m.Called(ctx, batchNumber) 449 450 var r0 []types.Transaction 451 var r1 error 452 if rf, ok := ret.Get(0).(func(context.Context, uint64) ([]types.Transaction, error)); ok { 453 return rf(ctx, batchNumber) 454 } 455 if rf, ok := ret.Get(0).(func(context.Context, uint64) []types.Transaction); ok { 456 r0 = rf(ctx, batchNumber) 457 } else { 458 if ret.Get(0) != nil { 459 r0 = ret.Get(0).([]types.Transaction) 460 } 461 } 462 463 if rf, ok := ret.Get(1).(func(context.Context, uint64) error); ok { 464 r1 = rf(ctx, batchNumber) 465 } else { 466 r1 = ret.Error(1) 467 } 468 469 return r0, r1 470 } 471 472 // GetWIPBatch provides a mock function with given fields: ctx 473 func (_m *DbManagerMock) GetWIPBatch(ctx context.Context) (*WipBatch, error) { 474 ret := _m.Called(ctx) 475 476 var r0 *WipBatch 477 var r1 error 478 if rf, ok := ret.Get(0).(func(context.Context) (*WipBatch, error)); ok { 479 return rf(ctx) 480 } 481 if rf, ok := ret.Get(0).(func(context.Context) *WipBatch); ok { 482 r0 = rf(ctx) 483 } else { 484 if ret.Get(0) != nil { 485 r0 = ret.Get(0).(*WipBatch) 486 } 487 } 488 489 if rf, ok := ret.Get(1).(func(context.Context) error); ok { 490 r1 = rf(ctx) 491 } else { 492 r1 = ret.Error(1) 493 } 494 495 return r0, r1 496 } 497 498 // IsBatchClosed provides a mock function with given fields: ctx, batchNum 499 func (_m *DbManagerMock) IsBatchClosed(ctx context.Context, batchNum uint64) (bool, error) { 500 ret := _m.Called(ctx, batchNum) 501 502 var r0 bool 503 var r1 error 504 if rf, ok := ret.Get(0).(func(context.Context, uint64) (bool, error)); ok { 505 return rf(ctx, batchNum) 506 } 507 if rf, ok := ret.Get(0).(func(context.Context, uint64) bool); ok { 508 r0 = rf(ctx, batchNum) 509 } else { 510 r0 = ret.Get(0).(bool) 511 } 512 513 if rf, ok := ret.Get(1).(func(context.Context, uint64) error); ok { 514 r1 = rf(ctx, batchNum) 515 } else { 516 r1 = ret.Error(1) 517 } 518 519 return r0, r1 520 } 521 522 // OpenBatch provides a mock function with given fields: ctx, processingContext, dbTx 523 func (_m *DbManagerMock) OpenBatch(ctx context.Context, processingContext state.ProcessingContext, dbTx pgx.Tx) error { 524 ret := _m.Called(ctx, processingContext, dbTx) 525 526 var r0 error 527 if rf, ok := ret.Get(0).(func(context.Context, state.ProcessingContext, pgx.Tx) error); ok { 528 r0 = rf(ctx, processingContext, dbTx) 529 } else { 530 r0 = ret.Error(0) 531 } 532 533 return r0 534 } 535 536 // ProcessForcedBatch provides a mock function with given fields: ForcedBatchNumber, request 537 func (_m *DbManagerMock) ProcessForcedBatch(ForcedBatchNumber uint64, request state.ProcessRequest) (*state.ProcessBatchResponse, error) { 538 ret := _m.Called(ForcedBatchNumber, request) 539 540 var r0 *state.ProcessBatchResponse 541 var r1 error 542 if rf, ok := ret.Get(0).(func(uint64, state.ProcessRequest) (*state.ProcessBatchResponse, error)); ok { 543 return rf(ForcedBatchNumber, request) 544 } 545 if rf, ok := ret.Get(0).(func(uint64, state.ProcessRequest) *state.ProcessBatchResponse); ok { 546 r0 = rf(ForcedBatchNumber, request) 547 } else { 548 if ret.Get(0) != nil { 549 r0 = ret.Get(0).(*state.ProcessBatchResponse) 550 } 551 } 552 553 if rf, ok := ret.Get(1).(func(uint64, state.ProcessRequest) error); ok { 554 r1 = rf(ForcedBatchNumber, request) 555 } else { 556 r1 = ret.Error(1) 557 } 558 559 return r0, r1 560 } 561 562 // StoreProcessedTransaction provides a mock function with given fields: ctx, batchNumber, processedTx, coinbase, timestamp, dbTx 563 func (_m *DbManagerMock) StoreProcessedTransaction(ctx context.Context, batchNumber uint64, processedTx *state.ProcessTransactionResponse, coinbase common.Address, timestamp uint64, dbTx pgx.Tx) error { 564 ret := _m.Called(ctx, batchNumber, processedTx, coinbase, timestamp, dbTx) 565 566 var r0 error 567 if rf, ok := ret.Get(0).(func(context.Context, uint64, *state.ProcessTransactionResponse, common.Address, uint64, pgx.Tx) error); ok { 568 r0 = rf(ctx, batchNumber, processedTx, coinbase, timestamp, dbTx) 569 } else { 570 r0 = ret.Error(0) 571 } 572 573 return r0 574 } 575 576 // UpdateTxStatus provides a mock function with given fields: ctx, hash, newStatus, isWIP, reason 577 func (_m *DbManagerMock) UpdateTxStatus(ctx context.Context, hash common.Hash, newStatus pool.TxStatus, isWIP bool, reason *string) error { 578 ret := _m.Called(ctx, hash, newStatus, isWIP, reason) 579 580 var r0 error 581 if rf, ok := ret.Get(0).(func(context.Context, common.Hash, pool.TxStatus, bool, *string) error); ok { 582 r0 = rf(ctx, hash, newStatus, isWIP, reason) 583 } else { 584 r0 = ret.Error(0) 585 } 586 587 return r0 588 } 589 590 type mockConstructorTestingTNewDbManagerMock interface { 591 mock.TestingT 592 Cleanup(func()) 593 } 594 595 // NewDbManagerMock creates a new instance of DbManagerMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. 596 func NewDbManagerMock(t mockConstructorTestingTNewDbManagerMock) *DbManagerMock { 597 mock := &DbManagerMock{} 598 mock.Mock.Test(t) 599 600 t.Cleanup(func() { mock.AssertExpectations(t) }) 601 602 return mock 603 }