diff --git a/.mockery.yml b/.mockery.yml index 5e4bc613..5cdb56ac 100644 --- a/.mockery.yml +++ b/.mockery.yml @@ -7,6 +7,9 @@ packages: dir: ./aggregator/mocks outpkg: mocks interfaces: - proverInterface: - etherman: - stateInterface: + ProverInterface: + Etherman: + StateInterface: + SynchronizerInterface: + StreamClient: + EthTxManagerClient: diff --git a/aggregator/aggregator.go b/aggregator/aggregator.go index b21d7bec..a22b44c1 100644 --- a/aggregator/aggregator.go +++ b/aggregator/aggregator.go @@ -66,8 +66,8 @@ type Aggregator struct { state StateInterface Etherman Etherman - ethTxManager *ethtxmanager.Client - streamClient *datastreamer.StreamClient + ethTxManager EthTxManagerClient + streamClient StreamClient l1Syncr synchronizer.Synchronizer halted atomic.Bool diff --git a/aggregator/aggregator_test.go b/aggregator/aggregator_test.go new file mode 100644 index 00000000..015ad1e0 --- /dev/null +++ b/aggregator/aggregator_test.go @@ -0,0 +1,340 @@ +package aggregator + +import ( + "bytes" + "context" + "math/big" + "sync" + "sync/atomic" + "testing" + "time" + + mocks "github.com/0xPolygon/cdk/aggregator/mocks" + "github.com/0xPolygon/cdk/log" + "github.com/0xPolygon/cdk/state" + "github.com/0xPolygon/cdk/state/datastream" + "github.com/0xPolygonHermez/zkevm-data-streamer/datastreamer" + "github.com/0xPolygonHermez/zkevm-synchronizer-l1/synchronizer" + "github.com/ethereum/go-ethereum/common" + ethTypes "github.com/ethereum/go-ethereum/core/types" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/mock" + "google.golang.org/protobuf/proto" +) + +func Test_resetCurrentBatchData(t *testing.T) { + agg := Aggregator{ + currentBatchStreamData: []byte("test"), + currentStreamBatchRaw: state.BatchRawV2{ + Blocks: []state.L2BlockRaw{ + { + BlockNumber: 1, + ChangeL2BlockHeader: state.ChangeL2BlockHeader{}, + Transactions: []state.L2TxRaw{}, + }, + }, + }, + currentStreamL2Block: state.L2BlockRaw{}, + } + + agg.resetCurrentBatchData() + + assert.Equal(t, []byte{}, agg.currentBatchStreamData) + assert.Equal(t, state.BatchRawV2{Blocks: make([]state.L2BlockRaw, 0)}, agg.currentStreamBatchRaw) + assert.Equal(t, state.L2BlockRaw{}, agg.currentStreamL2Block) +} + +// func Test_retrieveWitnesst(t *testing.T) { +// mockState := new(mocks.StateInterfaceMock) + +// witnessChan := make(chan state.DBBatch) +// agg := Aggregator{ +// witnessRetrievalChan: witnessChan, +// state: mockState, +// cfg: Config{ +// RetryTime: types.Duration{Duration: 1 * time.Second}, +// }, +// } + +// mockState.On("AddBatch", mock.Anything, mock.Anything, mock.Anything).Return(nil).Once() +// // .On("getWitness", mock.Anything, mock.Anything, mock.Anything).Return([]byte("witness data"), nil) + +// // Send a mock DBatch to the witness retrieval channel +// witnessChan <- state.DBBatch{ +// Batch: state.Batch{BatchNumber: 1}, +// } + +// go agg.retrieveWitness() +// time.Sleep(100 * time.Millisecond) + +// mockState.AssertExpectations(t) +// } + +func Test_handleReorg(t *testing.T) { + t.Parallel() + + mockL1Syncr := new(mocks.SynchronizerInterfaceMock) + mockState := new(mocks.StateInterfaceMock) + reorgData := synchronizer.ReorgExecutionResult{} + + agg := &Aggregator{ + l1Syncr: mockL1Syncr, + state: mockState, + logger: log.GetDefaultLogger(), + halted: atomic.Bool{}, + ctx: context.Background(), + } + + mockL1Syncr.On("GetLastestVirtualBatchNumber", mock.Anything).Return(uint64(100), nil) + mockState.On("DeleteBatchesNewerThanBatchNumber", mock.Anything, uint64(100), mock.Anything).Return(nil) + + go agg.handleReorg(reorgData) + time.Sleep(11 * time.Second) + + mockState.AssertExpectations(t) + mockL1Syncr.AssertExpectations(t) +} + +func Test_handleRollbackBatches(t *testing.T) { + t.Parallel() + + mockStreamClient := new(mocks.StreamClientMock) + mockEtherman := new(mocks.EthermanMock) + mockState := new(mocks.StateInterfaceMock) + + // Test data + rollbackData := synchronizer.RollbackBatchesData{ + LastBatchNumber: 100, + } + + mockStreamClient.On("IsStarted").Return(true) + mockStreamClient.On("ResetProcessEntryFunc").Return() + mockStreamClient.On("SetProcessEntryFunc", mock.Anything).Return() + mockStreamClient.On("ExecCommandStop").Return(nil) + mockStreamClient.On("Start").Return(nil) + mockStreamClient.On("ExecCommandStartBookmark", mock.Anything).Return(nil) + mockEtherman.On("GetLatestVerifiedBatchNum").Return(uint64(90), nil) + mockState.On("DeleteBatchesNewerThanBatchNumber", mock.Anything, rollbackData.LastBatchNumber, nil).Return(nil) + mockState.On("DeleteBatchesOlderThanBatchNumber", mock.Anything, rollbackData.LastBatchNumber, nil).Return(nil) + mockState.On("DeleteUngeneratedProofs", mock.Anything, nil).Return(nil) + mockState.On("DeleteGeneratedProofs", mock.Anything, rollbackData.LastBatchNumber+1, maxDBBigIntValue, nil).Return(nil) + + agg := Aggregator{ + ctx: context.Background(), + streamClient: mockStreamClient, + Etherman: mockEtherman, + state: mockState, + logger: log.GetDefaultLogger(), + halted: atomic.Bool{}, + streamClientMutex: &sync.Mutex{}, + currentBatchStreamData: []byte{}, + currentStreamBatchRaw: state.BatchRawV2{}, + currentStreamL2Block: state.L2BlockRaw{}, + } + + agg.handleRollbackBatches(rollbackData) + + mockStreamClient.AssertExpectations(t) + mockEtherman.AssertExpectations(t) + mockState.AssertExpectations(t) +} + +func Test_handleReceivedDataStream_BATCH_START(t *testing.T) { + mockState := new(mocks.StateInterfaceMock) + mockL1Syncr := new(mocks.SynchronizerInterfaceMock) + agg := Aggregator{ + state: mockState, + l1Syncr: mockL1Syncr, + logger: log.GetDefaultLogger(), + halted: atomic.Bool{}, + currentStreamBatch: state.Batch{}, + } + + // Prepare a FileEntry for Batch Start + batchStartData, err := proto.Marshal(&datastream.BatchStart{ + Number: 1, + ChainId: 2, + ForkId: 3, + Type: datastream.BatchType_BATCH_TYPE_REGULAR, + }) + assert.NoError(t, err) + + batchStartEntry := &datastreamer.FileEntry{ + Type: datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_BATCH_START), + Data: batchStartData, + } + + // Test the handleReceivedDataStream for Batch Start + err = agg.handleReceivedDataStream(batchStartEntry, nil, nil) + assert.NoError(t, err) + + assert.Equal(t, agg.currentStreamBatch.BatchNumber, uint64(1)) + assert.Equal(t, agg.currentStreamBatch.ChainID, uint64(2)) + assert.Equal(t, agg.currentStreamBatch.ForkID, uint64(3)) + assert.Equal(t, agg.currentStreamBatch.Type, datastream.BatchType_BATCH_TYPE_REGULAR) +} + +func Test_handleReceivedDataStream_BATCH_END(t *testing.T) { + mockState := new(mocks.StateInterfaceMock) + mockL1Syncr := new(mocks.SynchronizerInterfaceMock) + agg := Aggregator{ + state: mockState, + l1Syncr: mockL1Syncr, + logger: log.GetDefaultLogger(), + halted: atomic.Bool{}, + currentStreamBatch: state.Batch{ + BatchNumber: uint64(2), + Type: datastream.BatchType_BATCH_TYPE_REGULAR, + Coinbase: common.Address{}, + }, + currentStreamL2Block: state.L2BlockRaw{ + BlockNumber: uint64(10), + }, + currentStreamBatchRaw: state.BatchRawV2{ + Blocks: []state.L2BlockRaw{ + { + BlockNumber: uint64(9), + ChangeL2BlockHeader: state.ChangeL2BlockHeader{}, + Transactions: []state.L2TxRaw{}, + }, + }, + }, + cfg: Config{ + UseL1BatchData: false, + }, + } + + batchEndData, err := proto.Marshal(&datastream.BatchEnd{ + Number: 1, + LocalExitRoot: []byte{1, 2, 3}, + StateRoot: []byte{4, 5, 6}, + Debug: nil, + }) + assert.NoError(t, err) + + batchEndEntry := &datastreamer.FileEntry{ + Type: datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_BATCH_END), + Data: batchEndData, + } + + mockState.On("GetBatch", mock.Anything, agg.currentStreamBatch.BatchNumber-1, nil). + Return(&state.DBBatch{ + Batch: state.Batch{ + AccInputHash: common.Hash{}, + }, + }, nil).Once() + mockState.On("GetBatch", mock.Anything, agg.currentStreamBatch.BatchNumber, nil). + Return(&state.DBBatch{ + Witness: []byte("test_witness"), + }, nil).Once() + mockState.On("AddBatch", mock.Anything, mock.Anything, nil).Return(nil).Once() + mockL1Syncr.On("GetVirtualBatchByBatchNumber", mock.Anything, agg.currentStreamBatch.BatchNumber).Return(&synchronizer.VirtualBatch{BatchL2Data: []byte{1, 2, 3}}, nil).Once() + mockL1Syncr.On("GetSequenceByBatchNumber", mock.Anything, agg.currentStreamBatch.BatchNumber). + Return(&synchronizer.SequencedBatches{ + L1InfoRoot: common.Hash{}, + Timestamp: time.Now(), + }, nil).Once() + + err = agg.handleReceivedDataStream(batchEndEntry, nil, nil) + assert.NoError(t, err) + + assert.Equal(t, agg.currentBatchStreamData, []byte{}) + assert.Equal(t, agg.currentStreamBatchRaw, state.BatchRawV2{Blocks: make([]state.L2BlockRaw, 0)}) + assert.Equal(t, agg.currentStreamL2Block, state.L2BlockRaw{}) + + // Verify the mock expectations + mockState.AssertExpectations(t) + mockL1Syncr.AssertExpectations(t) +} + +func Test_handleReceivedDataStream_L2_BLOCK(t *testing.T) { + t.Parallel() + + agg := Aggregator{ + currentStreamL2Block: state.L2BlockRaw{ + BlockNumber: uint64(9), + }, + currentStreamBatchRaw: state.BatchRawV2{ + Blocks: []state.L2BlockRaw{}, + }, + currentStreamBatch: state.Batch{}, + } + + // Mock data for L2Block + l2Block := &datastream.L2Block{ + Number: uint64(10), + DeltaTimestamp: uint32(5), + L1InfotreeIndex: uint32(1), + Coinbase: []byte{0x01}, + GlobalExitRoot: []byte{0x02}, + } + + l2BlockData, err := proto.Marshal(l2Block) + assert.NoError(t, err) + + l2BlockEntry := &datastreamer.FileEntry{ + Type: datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_L2_BLOCK), + Data: l2BlockData, + } + + err = agg.handleReceivedDataStream(l2BlockEntry, nil, nil) + assert.NoError(t, err) + + assert.Equal(t, uint64(10), agg.currentStreamL2Block.BlockNumber) + assert.Equal(t, uint32(5), agg.currentStreamL2Block.ChangeL2BlockHeader.DeltaTimestamp) + assert.Equal(t, uint32(1), agg.currentStreamL2Block.ChangeL2BlockHeader.IndexL1InfoTree) + assert.Equal(t, 0, len(agg.currentStreamL2Block.Transactions)) + assert.Equal(t, uint32(1), agg.currentStreamBatch.L1InfoTreeIndex) + assert.Equal(t, common.BytesToAddress([]byte{0x01}), agg.currentStreamBatch.Coinbase) + assert.Equal(t, common.BytesToHash([]byte{0x02}), agg.currentStreamBatch.GlobalExitRoot) +} + +func Test_handleReceivedDataStream_TRANSACTION(t *testing.T) { + t.Parallel() + + agg := Aggregator{ + currentStreamL2Block: state.L2BlockRaw{ + Transactions: []state.L2TxRaw{}, + }, + logger: log.GetDefaultLogger(), + } + + tx := ethTypes.NewTransaction( + 0, + common.HexToAddress("0x01"), + big.NewInt(1000000000000000000), + uint64(21000), + big.NewInt(20000000000), + nil, + ) + + // Encode transaction into RLP format + var buf bytes.Buffer + if err := tx.EncodeRLP(&buf); err != nil { + t.Fatalf("Failed to encode transaction: %v", err) + } + + transaction := &datastream.Transaction{ + L2BlockNumber: uint64(10), + Index: uint64(0), + IsValid: true, + Encoded: buf.Bytes(), + EffectiveGasPricePercentage: uint32(90), + } + + transactionData, err := proto.Marshal(transaction) + assert.NoError(t, err) + + transactionEntry := &datastreamer.FileEntry{ + Type: datastreamer.EntryType(datastream.EntryType_ENTRY_TYPE_TRANSACTION), + Data: transactionData, + } + + err = agg.handleReceivedDataStream(transactionEntry, nil, nil) + assert.NoError(t, err) + + assert.Len(t, agg.currentStreamL2Block.Transactions, 1) + assert.Equal(t, uint8(90), agg.currentStreamL2Block.Transactions[0].EfficiencyPercentage) + assert.False(t, agg.currentStreamL2Block.Transactions[0].TxAlreadyEncoded) + assert.NotNil(t, agg.currentStreamL2Block.Transactions[0].Tx) +} diff --git a/aggregator/config.go b/aggregator/config.go index 4550c637..bad52adb 100644 --- a/aggregator/config.go +++ b/aggregator/config.go @@ -152,8 +152,8 @@ type Config struct { // MaxWitnessRetrievalWorkers is the maximum number of workers that will be used to retrieve the witness MaxWitnessRetrievalWorkers int `mapstructure:"MaxWitnessRetrievalWorkers"` - // SyncModeOnlyEnabled is a flag to enable the sync mode only - // In this mode the aggregator will only sync from L1 and will not generate or read the data stream + // SyncModeOnlyEnabled is a flag that activates sync mode exclusively. + // When enabled, the aggregator will sync data only from L1 and will not generate or read the data stream. SyncModeOnlyEnabled bool `mapstructure:"SyncModeOnlyEnabled"` } diff --git a/aggregator/interfaces.go b/aggregator/interfaces.go index b419ccf4..e4a4f0a9 100644 --- a/aggregator/interfaces.go +++ b/aggregator/interfaces.go @@ -7,8 +7,12 @@ import ( ethmanTypes "github.com/0xPolygon/cdk/aggregator/ethmantypes" "github.com/0xPolygon/cdk/aggregator/prover" "github.com/0xPolygon/cdk/state" + "github.com/0xPolygonHermez/zkevm-data-streamer/datastreamer" + "github.com/0xPolygonHermez/zkevm-ethtx-manager/ethtxmanager" + "github.com/0xPolygonHermez/zkevm-synchronizer-l1/synchronizer" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto/kzg4844" "github.com/jackc/pgx/v4" ) @@ -62,3 +66,66 @@ type StateInterface interface { DeleteBatchesOlderThanBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error DeleteBatchesNewerThanBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error } + +// SynchronizerInterface defines all the methods that are part of the Synchronizer interface +type SynchronizerInterface interface { + // Methods from SynchronizerBlockQuerier + GetL1BlockByNumber(ctx context.Context, blockNumber uint64) (*synchronizer.L1Block, error) + GetLastL1Block(ctx context.Context) (*synchronizer.L1Block, error) + + // Methods from SynchronizerL1InfoTreeQuerier + GetL1InfoRootPerIndex(ctx context.Context, L1InfoTreeIndex uint32) (common.Hash, error) + GetL1InfoTreeLeaves(ctx context.Context, indexLeaves []uint32) (map[uint32]synchronizer.L1InfoTreeLeaf, error) + GetLeafsByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash) ([]synchronizer.L1InfoTreeLeaf, error) + + // Methods from SynchronizerVirtualBatchesQuerier + GetLastestVirtualBatchNumber(ctx context.Context) (uint64, error) + GetVirtualBatchByBatchNumber(ctx context.Context, batchNumber uint64) (*synchronizer.VirtualBatch, error) + + // Methods from SynchronizerSequencedBatchesQuerier + GetSequenceByBatchNumber(ctx context.Context, batchNumber uint64) (*synchronizer.SequencedBatches, error) + + // Methods from SynchornizerStatusQuerier + IsSynced() bool + + // Methods from SynchronizerReorgSupporter + SetCallbackOnReorgDone(callback func(reorgData synchronizer.ReorgExecutionResult)) + + // Methods from SynchronizerRollbackBatchesSupporter + SetCallbackOnRollbackBatches(callback func(data synchronizer.RollbackBatchesData)) + + // Methods from SynchronizerRunner + Stop() + Sync(returnOnSync bool) error +} + +// StreamClient represents the stream client behaviour +type StreamClient interface { + Start() error + ExecCommandStart(fromEntry uint64) error + ExecCommandStartBookmark(fromBookmark []byte) error + ExecCommandStop() error + ExecCommandGetHeader() (datastreamer.HeaderEntry, error) + ExecCommandGetEntry(fromEntry uint64) (datastreamer.FileEntry, error) + ExecCommandGetBookmark(fromBookmark []byte) (datastreamer.FileEntry, error) + GetFromStream() uint64 + GetTotalEntries() uint64 + SetProcessEntryFunc(f datastreamer.ProcessEntryFunc) + ResetProcessEntryFunc() + IsStarted() bool +} + +// EthTxManagerClient represents the eth tx manager interface +type EthTxManagerClient interface { + Add(ctx context.Context, to *common.Address, forcedNonce *uint64, value *big.Int, data []byte, gasOffset uint64, sidecar *types.BlobTxSidecar) (common.Hash, error) + AddWithGas(ctx context.Context, to *common.Address, forcedNonce *uint64, value *big.Int, data []byte, gasOffset uint64, sidecar *types.BlobTxSidecar, gas uint64) (common.Hash, error) + EncodeBlobData(data []byte) (kzg4844.Blob, error) + MakeBlobSidecar(blobs []kzg4844.Blob) *types.BlobTxSidecar + ProcessPendingMonitoredTxs(ctx context.Context, resultHandler ethtxmanager.ResultHandler) + Remove(ctx context.Context, id common.Hash) error + RemoveAll(ctx context.Context) error + Result(ctx context.Context, id common.Hash) (ethtxmanager.MonitoredTxResult, error) + ResultsByStatus(ctx context.Context, statuses []ethtxmanager.MonitoredTxStatus) ([]ethtxmanager.MonitoredTxResult, error) + Start() + Stop() +} diff --git a/aggregator/mocks/etherman.generated.go b/aggregator/mocks/etherman.generated.go new file mode 100644 index 00000000..a8ad8923 --- /dev/null +++ b/aggregator/mocks/etherman.generated.go @@ -0,0 +1,329 @@ +// Code generated by mockery v2.45.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + common "github.com/ethereum/go-ethereum/common" + + ethmantypes "github.com/0xPolygon/cdk/aggregator/ethmantypes" + + mock "github.com/stretchr/testify/mock" + + types "github.com/ethereum/go-ethereum/core/types" +) + +// EthermanMock is an autogenerated mock type for the Etherman type +type EthermanMock struct { + mock.Mock +} + +type EthermanMock_Expecter struct { + mock *mock.Mock +} + +func (_m *EthermanMock) EXPECT() *EthermanMock_Expecter { + return &EthermanMock_Expecter{mock: &_m.Mock} +} + +// BuildTrustedVerifyBatchesTxData provides a mock function with given fields: lastVerifiedBatch, newVerifiedBatch, inputs, beneficiary +func (_m *EthermanMock) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch uint64, newVerifiedBatch uint64, inputs *ethmantypes.FinalProofInputs, beneficiary common.Address) (*common.Address, []byte, error) { + ret := _m.Called(lastVerifiedBatch, newVerifiedBatch, inputs, beneficiary) + + if len(ret) == 0 { + panic("no return value specified for BuildTrustedVerifyBatchesTxData") + } + + var r0 *common.Address + var r1 []byte + var r2 error + if rf, ok := ret.Get(0).(func(uint64, uint64, *ethmantypes.FinalProofInputs, common.Address) (*common.Address, []byte, error)); ok { + return rf(lastVerifiedBatch, newVerifiedBatch, inputs, beneficiary) + } + if rf, ok := ret.Get(0).(func(uint64, uint64, *ethmantypes.FinalProofInputs, common.Address) *common.Address); ok { + r0 = rf(lastVerifiedBatch, newVerifiedBatch, inputs, beneficiary) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*common.Address) + } + } + + if rf, ok := ret.Get(1).(func(uint64, uint64, *ethmantypes.FinalProofInputs, common.Address) []byte); ok { + r1 = rf(lastVerifiedBatch, newVerifiedBatch, inputs, beneficiary) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).([]byte) + } + } + + if rf, ok := ret.Get(2).(func(uint64, uint64, *ethmantypes.FinalProofInputs, common.Address) error); ok { + r2 = rf(lastVerifiedBatch, newVerifiedBatch, inputs, beneficiary) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// EthermanMock_BuildTrustedVerifyBatchesTxData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BuildTrustedVerifyBatchesTxData' +type EthermanMock_BuildTrustedVerifyBatchesTxData_Call struct { + *mock.Call +} + +// BuildTrustedVerifyBatchesTxData is a helper method to define mock.On call +// - lastVerifiedBatch uint64 +// - newVerifiedBatch uint64 +// - inputs *ethmantypes.FinalProofInputs +// - beneficiary common.Address +func (_e *EthermanMock_Expecter) BuildTrustedVerifyBatchesTxData(lastVerifiedBatch interface{}, newVerifiedBatch interface{}, inputs interface{}, beneficiary interface{}) *EthermanMock_BuildTrustedVerifyBatchesTxData_Call { + return &EthermanMock_BuildTrustedVerifyBatchesTxData_Call{Call: _e.mock.On("BuildTrustedVerifyBatchesTxData", lastVerifiedBatch, newVerifiedBatch, inputs, beneficiary)} +} + +func (_c *EthermanMock_BuildTrustedVerifyBatchesTxData_Call) Run(run func(lastVerifiedBatch uint64, newVerifiedBatch uint64, inputs *ethmantypes.FinalProofInputs, beneficiary common.Address)) *EthermanMock_BuildTrustedVerifyBatchesTxData_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64), args[1].(uint64), args[2].(*ethmantypes.FinalProofInputs), args[3].(common.Address)) + }) + return _c +} + +func (_c *EthermanMock_BuildTrustedVerifyBatchesTxData_Call) Return(to *common.Address, data []byte, err error) *EthermanMock_BuildTrustedVerifyBatchesTxData_Call { + _c.Call.Return(to, data, err) + return _c +} + +func (_c *EthermanMock_BuildTrustedVerifyBatchesTxData_Call) RunAndReturn(run func(uint64, uint64, *ethmantypes.FinalProofInputs, common.Address) (*common.Address, []byte, error)) *EthermanMock_BuildTrustedVerifyBatchesTxData_Call { + _c.Call.Return(run) + return _c +} + +// GetBatchAccInputHash provides a mock function with given fields: ctx, batchNumber +func (_m *EthermanMock) GetBatchAccInputHash(ctx context.Context, batchNumber uint64) (common.Hash, error) { + ret := _m.Called(ctx, batchNumber) + + if len(ret) == 0 { + panic("no return value specified for GetBatchAccInputHash") + } + + var r0 common.Hash + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64) (common.Hash, error)); ok { + return rf(ctx, batchNumber) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64) common.Hash); ok { + r0 = rf(ctx, batchNumber) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Hash) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64) error); ok { + r1 = rf(ctx, batchNumber) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EthermanMock_GetBatchAccInputHash_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBatchAccInputHash' +type EthermanMock_GetBatchAccInputHash_Call struct { + *mock.Call +} + +// GetBatchAccInputHash is a helper method to define mock.On call +// - ctx context.Context +// - batchNumber uint64 +func (_e *EthermanMock_Expecter) GetBatchAccInputHash(ctx interface{}, batchNumber interface{}) *EthermanMock_GetBatchAccInputHash_Call { + return &EthermanMock_GetBatchAccInputHash_Call{Call: _e.mock.On("GetBatchAccInputHash", ctx, batchNumber)} +} + +func (_c *EthermanMock_GetBatchAccInputHash_Call) Run(run func(ctx context.Context, batchNumber uint64)) *EthermanMock_GetBatchAccInputHash_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64)) + }) + return _c +} + +func (_c *EthermanMock_GetBatchAccInputHash_Call) Return(_a0 common.Hash, _a1 error) *EthermanMock_GetBatchAccInputHash_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthermanMock_GetBatchAccInputHash_Call) RunAndReturn(run func(context.Context, uint64) (common.Hash, error)) *EthermanMock_GetBatchAccInputHash_Call { + _c.Call.Return(run) + return _c +} + +// GetLatestBlockHeader provides a mock function with given fields: ctx +func (_m *EthermanMock) GetLatestBlockHeader(ctx context.Context) (*types.Header, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetLatestBlockHeader") + } + + var r0 *types.Header + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*types.Header, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) *types.Header); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.Header) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EthermanMock_GetLatestBlockHeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestBlockHeader' +type EthermanMock_GetLatestBlockHeader_Call struct { + *mock.Call +} + +// GetLatestBlockHeader is a helper method to define mock.On call +// - ctx context.Context +func (_e *EthermanMock_Expecter) GetLatestBlockHeader(ctx interface{}) *EthermanMock_GetLatestBlockHeader_Call { + return &EthermanMock_GetLatestBlockHeader_Call{Call: _e.mock.On("GetLatestBlockHeader", ctx)} +} + +func (_c *EthermanMock_GetLatestBlockHeader_Call) Run(run func(ctx context.Context)) *EthermanMock_GetLatestBlockHeader_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *EthermanMock_GetLatestBlockHeader_Call) Return(_a0 *types.Header, _a1 error) *EthermanMock_GetLatestBlockHeader_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthermanMock_GetLatestBlockHeader_Call) RunAndReturn(run func(context.Context) (*types.Header, error)) *EthermanMock_GetLatestBlockHeader_Call { + _c.Call.Return(run) + return _c +} + +// GetLatestVerifiedBatchNum provides a mock function with given fields: +func (_m *EthermanMock) GetLatestVerifiedBatchNum() (uint64, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetLatestVerifiedBatchNum") + } + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func() (uint64, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() uint64); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EthermanMock_GetLatestVerifiedBatchNum_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLatestVerifiedBatchNum' +type EthermanMock_GetLatestVerifiedBatchNum_Call struct { + *mock.Call +} + +// GetLatestVerifiedBatchNum is a helper method to define mock.On call +func (_e *EthermanMock_Expecter) GetLatestVerifiedBatchNum() *EthermanMock_GetLatestVerifiedBatchNum_Call { + return &EthermanMock_GetLatestVerifiedBatchNum_Call{Call: _e.mock.On("GetLatestVerifiedBatchNum")} +} + +func (_c *EthermanMock_GetLatestVerifiedBatchNum_Call) Run(run func()) *EthermanMock_GetLatestVerifiedBatchNum_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *EthermanMock_GetLatestVerifiedBatchNum_Call) Return(_a0 uint64, _a1 error) *EthermanMock_GetLatestVerifiedBatchNum_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthermanMock_GetLatestVerifiedBatchNum_Call) RunAndReturn(run func() (uint64, error)) *EthermanMock_GetLatestVerifiedBatchNum_Call { + _c.Call.Return(run) + return _c +} + +// GetRollupId provides a mock function with given fields: +func (_m *EthermanMock) GetRollupId() uint32 { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetRollupId") + } + + var r0 uint32 + if rf, ok := ret.Get(0).(func() uint32); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(uint32) + } + + return r0 +} + +// EthermanMock_GetRollupId_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRollupId' +type EthermanMock_GetRollupId_Call struct { + *mock.Call +} + +// GetRollupId is a helper method to define mock.On call +func (_e *EthermanMock_Expecter) GetRollupId() *EthermanMock_GetRollupId_Call { + return &EthermanMock_GetRollupId_Call{Call: _e.mock.On("GetRollupId")} +} + +func (_c *EthermanMock_GetRollupId_Call) Run(run func()) *EthermanMock_GetRollupId_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *EthermanMock_GetRollupId_Call) Return(_a0 uint32) *EthermanMock_GetRollupId_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EthermanMock_GetRollupId_Call) RunAndReturn(run func() uint32) *EthermanMock_GetRollupId_Call { + _c.Call.Return(run) + return _c +} + +// NewEthermanMock creates a new instance of EthermanMock. 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 NewEthermanMock(t interface { + mock.TestingT + Cleanup(func()) +}) *EthermanMock { + mock := &EthermanMock{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/aggregator/mocks/ethtxmanagerclient.generated.go b/aggregator/mocks/ethtxmanagerclient.generated.go new file mode 100644 index 00000000..89f7a8f1 --- /dev/null +++ b/aggregator/mocks/ethtxmanagerclient.generated.go @@ -0,0 +1,587 @@ +// Code generated by mockery v2.45.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + big "math/big" + + common "github.com/ethereum/go-ethereum/common" + + ethtxmanager "github.com/0xPolygonHermez/zkevm-ethtx-manager/ethtxmanager" + + kzg4844 "github.com/ethereum/go-ethereum/crypto/kzg4844" + + mock "github.com/stretchr/testify/mock" + + types "github.com/ethereum/go-ethereum/core/types" +) + +// EthTxManagerClientMock is an autogenerated mock type for the EthTxManagerClient type +type EthTxManagerClientMock struct { + mock.Mock +} + +type EthTxManagerClientMock_Expecter struct { + mock *mock.Mock +} + +func (_m *EthTxManagerClientMock) EXPECT() *EthTxManagerClientMock_Expecter { + return &EthTxManagerClientMock_Expecter{mock: &_m.Mock} +} + +// Add provides a mock function with given fields: ctx, to, forcedNonce, value, data, gasOffset, sidecar +func (_m *EthTxManagerClientMock) Add(ctx context.Context, to *common.Address, forcedNonce *uint64, value *big.Int, data []byte, gasOffset uint64, sidecar *types.BlobTxSidecar) (common.Hash, error) { + ret := _m.Called(ctx, to, forcedNonce, value, data, gasOffset, sidecar) + + if len(ret) == 0 { + panic("no return value specified for Add") + } + + var r0 common.Hash + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *common.Address, *uint64, *big.Int, []byte, uint64, *types.BlobTxSidecar) (common.Hash, error)); ok { + return rf(ctx, to, forcedNonce, value, data, gasOffset, sidecar) + } + if rf, ok := ret.Get(0).(func(context.Context, *common.Address, *uint64, *big.Int, []byte, uint64, *types.BlobTxSidecar) common.Hash); ok { + r0 = rf(ctx, to, forcedNonce, value, data, gasOffset, sidecar) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Hash) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *common.Address, *uint64, *big.Int, []byte, uint64, *types.BlobTxSidecar) error); ok { + r1 = rf(ctx, to, forcedNonce, value, data, gasOffset, sidecar) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EthTxManagerClientMock_Add_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Add' +type EthTxManagerClientMock_Add_Call struct { + *mock.Call +} + +// Add is a helper method to define mock.On call +// - ctx context.Context +// - to *common.Address +// - forcedNonce *uint64 +// - value *big.Int +// - data []byte +// - gasOffset uint64 +// - sidecar *types.BlobTxSidecar +func (_e *EthTxManagerClientMock_Expecter) Add(ctx interface{}, to interface{}, forcedNonce interface{}, value interface{}, data interface{}, gasOffset interface{}, sidecar interface{}) *EthTxManagerClientMock_Add_Call { + return &EthTxManagerClientMock_Add_Call{Call: _e.mock.On("Add", ctx, to, forcedNonce, value, data, gasOffset, sidecar)} +} + +func (_c *EthTxManagerClientMock_Add_Call) Run(run func(ctx context.Context, to *common.Address, forcedNonce *uint64, value *big.Int, data []byte, gasOffset uint64, sidecar *types.BlobTxSidecar)) *EthTxManagerClientMock_Add_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*common.Address), args[2].(*uint64), args[3].(*big.Int), args[4].([]byte), args[5].(uint64), args[6].(*types.BlobTxSidecar)) + }) + return _c +} + +func (_c *EthTxManagerClientMock_Add_Call) Return(_a0 common.Hash, _a1 error) *EthTxManagerClientMock_Add_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthTxManagerClientMock_Add_Call) RunAndReturn(run func(context.Context, *common.Address, *uint64, *big.Int, []byte, uint64, *types.BlobTxSidecar) (common.Hash, error)) *EthTxManagerClientMock_Add_Call { + _c.Call.Return(run) + return _c +} + +// AddWithGas provides a mock function with given fields: ctx, to, forcedNonce, value, data, gasOffset, sidecar, gas +func (_m *EthTxManagerClientMock) AddWithGas(ctx context.Context, to *common.Address, forcedNonce *uint64, value *big.Int, data []byte, gasOffset uint64, sidecar *types.BlobTxSidecar, gas uint64) (common.Hash, error) { + ret := _m.Called(ctx, to, forcedNonce, value, data, gasOffset, sidecar, gas) + + if len(ret) == 0 { + panic("no return value specified for AddWithGas") + } + + var r0 common.Hash + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, *common.Address, *uint64, *big.Int, []byte, uint64, *types.BlobTxSidecar, uint64) (common.Hash, error)); ok { + return rf(ctx, to, forcedNonce, value, data, gasOffset, sidecar, gas) + } + if rf, ok := ret.Get(0).(func(context.Context, *common.Address, *uint64, *big.Int, []byte, uint64, *types.BlobTxSidecar, uint64) common.Hash); ok { + r0 = rf(ctx, to, forcedNonce, value, data, gasOffset, sidecar, gas) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Hash) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, *common.Address, *uint64, *big.Int, []byte, uint64, *types.BlobTxSidecar, uint64) error); ok { + r1 = rf(ctx, to, forcedNonce, value, data, gasOffset, sidecar, gas) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EthTxManagerClientMock_AddWithGas_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddWithGas' +type EthTxManagerClientMock_AddWithGas_Call struct { + *mock.Call +} + +// AddWithGas is a helper method to define mock.On call +// - ctx context.Context +// - to *common.Address +// - forcedNonce *uint64 +// - value *big.Int +// - data []byte +// - gasOffset uint64 +// - sidecar *types.BlobTxSidecar +// - gas uint64 +func (_e *EthTxManagerClientMock_Expecter) AddWithGas(ctx interface{}, to interface{}, forcedNonce interface{}, value interface{}, data interface{}, gasOffset interface{}, sidecar interface{}, gas interface{}) *EthTxManagerClientMock_AddWithGas_Call { + return &EthTxManagerClientMock_AddWithGas_Call{Call: _e.mock.On("AddWithGas", ctx, to, forcedNonce, value, data, gasOffset, sidecar, gas)} +} + +func (_c *EthTxManagerClientMock_AddWithGas_Call) Run(run func(ctx context.Context, to *common.Address, forcedNonce *uint64, value *big.Int, data []byte, gasOffset uint64, sidecar *types.BlobTxSidecar, gas uint64)) *EthTxManagerClientMock_AddWithGas_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(*common.Address), args[2].(*uint64), args[3].(*big.Int), args[4].([]byte), args[5].(uint64), args[6].(*types.BlobTxSidecar), args[7].(uint64)) + }) + return _c +} + +func (_c *EthTxManagerClientMock_AddWithGas_Call) Return(_a0 common.Hash, _a1 error) *EthTxManagerClientMock_AddWithGas_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthTxManagerClientMock_AddWithGas_Call) RunAndReturn(run func(context.Context, *common.Address, *uint64, *big.Int, []byte, uint64, *types.BlobTxSidecar, uint64) (common.Hash, error)) *EthTxManagerClientMock_AddWithGas_Call { + _c.Call.Return(run) + return _c +} + +// EncodeBlobData provides a mock function with given fields: data +func (_m *EthTxManagerClientMock) EncodeBlobData(data []byte) (kzg4844.Blob, error) { + ret := _m.Called(data) + + if len(ret) == 0 { + panic("no return value specified for EncodeBlobData") + } + + var r0 kzg4844.Blob + var r1 error + if rf, ok := ret.Get(0).(func([]byte) (kzg4844.Blob, error)); ok { + return rf(data) + } + if rf, ok := ret.Get(0).(func([]byte) kzg4844.Blob); ok { + r0 = rf(data) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(kzg4844.Blob) + } + } + + if rf, ok := ret.Get(1).(func([]byte) error); ok { + r1 = rf(data) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EthTxManagerClientMock_EncodeBlobData_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'EncodeBlobData' +type EthTxManagerClientMock_EncodeBlobData_Call struct { + *mock.Call +} + +// EncodeBlobData is a helper method to define mock.On call +// - data []byte +func (_e *EthTxManagerClientMock_Expecter) EncodeBlobData(data interface{}) *EthTxManagerClientMock_EncodeBlobData_Call { + return &EthTxManagerClientMock_EncodeBlobData_Call{Call: _e.mock.On("EncodeBlobData", data)} +} + +func (_c *EthTxManagerClientMock_EncodeBlobData_Call) Run(run func(data []byte)) *EthTxManagerClientMock_EncodeBlobData_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]byte)) + }) + return _c +} + +func (_c *EthTxManagerClientMock_EncodeBlobData_Call) Return(_a0 kzg4844.Blob, _a1 error) *EthTxManagerClientMock_EncodeBlobData_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthTxManagerClientMock_EncodeBlobData_Call) RunAndReturn(run func([]byte) (kzg4844.Blob, error)) *EthTxManagerClientMock_EncodeBlobData_Call { + _c.Call.Return(run) + return _c +} + +// MakeBlobSidecar provides a mock function with given fields: blobs +func (_m *EthTxManagerClientMock) MakeBlobSidecar(blobs []kzg4844.Blob) *types.BlobTxSidecar { + ret := _m.Called(blobs) + + if len(ret) == 0 { + panic("no return value specified for MakeBlobSidecar") + } + + var r0 *types.BlobTxSidecar + if rf, ok := ret.Get(0).(func([]kzg4844.Blob) *types.BlobTxSidecar); ok { + r0 = rf(blobs) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.BlobTxSidecar) + } + } + + return r0 +} + +// EthTxManagerClientMock_MakeBlobSidecar_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'MakeBlobSidecar' +type EthTxManagerClientMock_MakeBlobSidecar_Call struct { + *mock.Call +} + +// MakeBlobSidecar is a helper method to define mock.On call +// - blobs []kzg4844.Blob +func (_e *EthTxManagerClientMock_Expecter) MakeBlobSidecar(blobs interface{}) *EthTxManagerClientMock_MakeBlobSidecar_Call { + return &EthTxManagerClientMock_MakeBlobSidecar_Call{Call: _e.mock.On("MakeBlobSidecar", blobs)} +} + +func (_c *EthTxManagerClientMock_MakeBlobSidecar_Call) Run(run func(blobs []kzg4844.Blob)) *EthTxManagerClientMock_MakeBlobSidecar_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]kzg4844.Blob)) + }) + return _c +} + +func (_c *EthTxManagerClientMock_MakeBlobSidecar_Call) Return(_a0 *types.BlobTxSidecar) *EthTxManagerClientMock_MakeBlobSidecar_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EthTxManagerClientMock_MakeBlobSidecar_Call) RunAndReturn(run func([]kzg4844.Blob) *types.BlobTxSidecar) *EthTxManagerClientMock_MakeBlobSidecar_Call { + _c.Call.Return(run) + return _c +} + +// ProcessPendingMonitoredTxs provides a mock function with given fields: ctx, resultHandler +func (_m *EthTxManagerClientMock) ProcessPendingMonitoredTxs(ctx context.Context, resultHandler ethtxmanager.ResultHandler) { + _m.Called(ctx, resultHandler) +} + +// EthTxManagerClientMock_ProcessPendingMonitoredTxs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ProcessPendingMonitoredTxs' +type EthTxManagerClientMock_ProcessPendingMonitoredTxs_Call struct { + *mock.Call +} + +// ProcessPendingMonitoredTxs is a helper method to define mock.On call +// - ctx context.Context +// - resultHandler ethtxmanager.ResultHandler +func (_e *EthTxManagerClientMock_Expecter) ProcessPendingMonitoredTxs(ctx interface{}, resultHandler interface{}) *EthTxManagerClientMock_ProcessPendingMonitoredTxs_Call { + return &EthTxManagerClientMock_ProcessPendingMonitoredTxs_Call{Call: _e.mock.On("ProcessPendingMonitoredTxs", ctx, resultHandler)} +} + +func (_c *EthTxManagerClientMock_ProcessPendingMonitoredTxs_Call) Run(run func(ctx context.Context, resultHandler ethtxmanager.ResultHandler)) *EthTxManagerClientMock_ProcessPendingMonitoredTxs_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(ethtxmanager.ResultHandler)) + }) + return _c +} + +func (_c *EthTxManagerClientMock_ProcessPendingMonitoredTxs_Call) Return() *EthTxManagerClientMock_ProcessPendingMonitoredTxs_Call { + _c.Call.Return() + return _c +} + +func (_c *EthTxManagerClientMock_ProcessPendingMonitoredTxs_Call) RunAndReturn(run func(context.Context, ethtxmanager.ResultHandler)) *EthTxManagerClientMock_ProcessPendingMonitoredTxs_Call { + _c.Call.Return(run) + return _c +} + +// Remove provides a mock function with given fields: ctx, id +func (_m *EthTxManagerClientMock) Remove(ctx context.Context, id common.Hash) error { + ret := _m.Called(ctx, id) + + if len(ret) == 0 { + panic("no return value specified for Remove") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, common.Hash) error); ok { + r0 = rf(ctx, id) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// EthTxManagerClientMock_Remove_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Remove' +type EthTxManagerClientMock_Remove_Call struct { + *mock.Call +} + +// Remove is a helper method to define mock.On call +// - ctx context.Context +// - id common.Hash +func (_e *EthTxManagerClientMock_Expecter) Remove(ctx interface{}, id interface{}) *EthTxManagerClientMock_Remove_Call { + return &EthTxManagerClientMock_Remove_Call{Call: _e.mock.On("Remove", ctx, id)} +} + +func (_c *EthTxManagerClientMock_Remove_Call) Run(run func(ctx context.Context, id common.Hash)) *EthTxManagerClientMock_Remove_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Hash)) + }) + return _c +} + +func (_c *EthTxManagerClientMock_Remove_Call) Return(_a0 error) *EthTxManagerClientMock_Remove_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EthTxManagerClientMock_Remove_Call) RunAndReturn(run func(context.Context, common.Hash) error) *EthTxManagerClientMock_Remove_Call { + _c.Call.Return(run) + return _c +} + +// RemoveAll provides a mock function with given fields: ctx +func (_m *EthTxManagerClientMock) RemoveAll(ctx context.Context) error { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for RemoveAll") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context) error); ok { + r0 = rf(ctx) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// EthTxManagerClientMock_RemoveAll_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'RemoveAll' +type EthTxManagerClientMock_RemoveAll_Call struct { + *mock.Call +} + +// RemoveAll is a helper method to define mock.On call +// - ctx context.Context +func (_e *EthTxManagerClientMock_Expecter) RemoveAll(ctx interface{}) *EthTxManagerClientMock_RemoveAll_Call { + return &EthTxManagerClientMock_RemoveAll_Call{Call: _e.mock.On("RemoveAll", ctx)} +} + +func (_c *EthTxManagerClientMock_RemoveAll_Call) Run(run func(ctx context.Context)) *EthTxManagerClientMock_RemoveAll_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *EthTxManagerClientMock_RemoveAll_Call) Return(_a0 error) *EthTxManagerClientMock_RemoveAll_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *EthTxManagerClientMock_RemoveAll_Call) RunAndReturn(run func(context.Context) error) *EthTxManagerClientMock_RemoveAll_Call { + _c.Call.Return(run) + return _c +} + +// Result provides a mock function with given fields: ctx, id +func (_m *EthTxManagerClientMock) Result(ctx context.Context, id common.Hash) (ethtxmanager.MonitoredTxResult, error) { + ret := _m.Called(ctx, id) + + if len(ret) == 0 { + panic("no return value specified for Result") + } + + var r0 ethtxmanager.MonitoredTxResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, common.Hash) (ethtxmanager.MonitoredTxResult, error)); ok { + return rf(ctx, id) + } + if rf, ok := ret.Get(0).(func(context.Context, common.Hash) ethtxmanager.MonitoredTxResult); ok { + r0 = rf(ctx, id) + } else { + r0 = ret.Get(0).(ethtxmanager.MonitoredTxResult) + } + + if rf, ok := ret.Get(1).(func(context.Context, common.Hash) error); ok { + r1 = rf(ctx, id) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EthTxManagerClientMock_Result_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Result' +type EthTxManagerClientMock_Result_Call struct { + *mock.Call +} + +// Result is a helper method to define mock.On call +// - ctx context.Context +// - id common.Hash +func (_e *EthTxManagerClientMock_Expecter) Result(ctx interface{}, id interface{}) *EthTxManagerClientMock_Result_Call { + return &EthTxManagerClientMock_Result_Call{Call: _e.mock.On("Result", ctx, id)} +} + +func (_c *EthTxManagerClientMock_Result_Call) Run(run func(ctx context.Context, id common.Hash)) *EthTxManagerClientMock_Result_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Hash)) + }) + return _c +} + +func (_c *EthTxManagerClientMock_Result_Call) Return(_a0 ethtxmanager.MonitoredTxResult, _a1 error) *EthTxManagerClientMock_Result_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthTxManagerClientMock_Result_Call) RunAndReturn(run func(context.Context, common.Hash) (ethtxmanager.MonitoredTxResult, error)) *EthTxManagerClientMock_Result_Call { + _c.Call.Return(run) + return _c +} + +// ResultsByStatus provides a mock function with given fields: ctx, statuses +func (_m *EthTxManagerClientMock) ResultsByStatus(ctx context.Context, statuses []ethtxmanager.MonitoredTxStatus) ([]ethtxmanager.MonitoredTxResult, error) { + ret := _m.Called(ctx, statuses) + + if len(ret) == 0 { + panic("no return value specified for ResultsByStatus") + } + + var r0 []ethtxmanager.MonitoredTxResult + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, []ethtxmanager.MonitoredTxStatus) ([]ethtxmanager.MonitoredTxResult, error)); ok { + return rf(ctx, statuses) + } + if rf, ok := ret.Get(0).(func(context.Context, []ethtxmanager.MonitoredTxStatus) []ethtxmanager.MonitoredTxResult); ok { + r0 = rf(ctx, statuses) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]ethtxmanager.MonitoredTxResult) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, []ethtxmanager.MonitoredTxStatus) error); ok { + r1 = rf(ctx, statuses) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// EthTxManagerClientMock_ResultsByStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResultsByStatus' +type EthTxManagerClientMock_ResultsByStatus_Call struct { + *mock.Call +} + +// ResultsByStatus is a helper method to define mock.On call +// - ctx context.Context +// - statuses []ethtxmanager.MonitoredTxStatus +func (_e *EthTxManagerClientMock_Expecter) ResultsByStatus(ctx interface{}, statuses interface{}) *EthTxManagerClientMock_ResultsByStatus_Call { + return &EthTxManagerClientMock_ResultsByStatus_Call{Call: _e.mock.On("ResultsByStatus", ctx, statuses)} +} + +func (_c *EthTxManagerClientMock_ResultsByStatus_Call) Run(run func(ctx context.Context, statuses []ethtxmanager.MonitoredTxStatus)) *EthTxManagerClientMock_ResultsByStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]ethtxmanager.MonitoredTxStatus)) + }) + return _c +} + +func (_c *EthTxManagerClientMock_ResultsByStatus_Call) Return(_a0 []ethtxmanager.MonitoredTxResult, _a1 error) *EthTxManagerClientMock_ResultsByStatus_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *EthTxManagerClientMock_ResultsByStatus_Call) RunAndReturn(run func(context.Context, []ethtxmanager.MonitoredTxStatus) ([]ethtxmanager.MonitoredTxResult, error)) *EthTxManagerClientMock_ResultsByStatus_Call { + _c.Call.Return(run) + return _c +} + +// Start provides a mock function with given fields: +func (_m *EthTxManagerClientMock) Start() { + _m.Called() +} + +// EthTxManagerClientMock_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type EthTxManagerClientMock_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +func (_e *EthTxManagerClientMock_Expecter) Start() *EthTxManagerClientMock_Start_Call { + return &EthTxManagerClientMock_Start_Call{Call: _e.mock.On("Start")} +} + +func (_c *EthTxManagerClientMock_Start_Call) Run(run func()) *EthTxManagerClientMock_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *EthTxManagerClientMock_Start_Call) Return() *EthTxManagerClientMock_Start_Call { + _c.Call.Return() + return _c +} + +func (_c *EthTxManagerClientMock_Start_Call) RunAndReturn(run func()) *EthTxManagerClientMock_Start_Call { + _c.Call.Return(run) + return _c +} + +// Stop provides a mock function with given fields: +func (_m *EthTxManagerClientMock) Stop() { + _m.Called() +} + +// EthTxManagerClientMock_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop' +type EthTxManagerClientMock_Stop_Call struct { + *mock.Call +} + +// Stop is a helper method to define mock.On call +func (_e *EthTxManagerClientMock_Expecter) Stop() *EthTxManagerClientMock_Stop_Call { + return &EthTxManagerClientMock_Stop_Call{Call: _e.mock.On("Stop")} +} + +func (_c *EthTxManagerClientMock_Stop_Call) Run(run func()) *EthTxManagerClientMock_Stop_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *EthTxManagerClientMock_Stop_Call) Return() *EthTxManagerClientMock_Stop_Call { + _c.Call.Return() + return _c +} + +func (_c *EthTxManagerClientMock_Stop_Call) RunAndReturn(run func()) *EthTxManagerClientMock_Stop_Call { + _c.Call.Return(run) + return _c +} + +// NewEthTxManagerClientMock creates a new instance of EthTxManagerClientMock. 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 NewEthTxManagerClientMock(t interface { + mock.TestingT + Cleanup(func()) +}) *EthTxManagerClientMock { + mock := &EthTxManagerClientMock{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/aggregator/mocks/proverinterface.generated.go b/aggregator/mocks/proverinterface.generated.go new file mode 100644 index 00000000..e17245cb --- /dev/null +++ b/aggregator/mocks/proverinterface.generated.go @@ -0,0 +1,531 @@ +// Code generated by mockery v2.45.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + common "github.com/ethereum/go-ethereum/common" + + mock "github.com/stretchr/testify/mock" + + prover "github.com/0xPolygon/cdk/aggregator/prover" +) + +// ProverInterfaceMock is an autogenerated mock type for the ProverInterface type +type ProverInterfaceMock struct { + mock.Mock +} + +type ProverInterfaceMock_Expecter struct { + mock *mock.Mock +} + +func (_m *ProverInterfaceMock) EXPECT() *ProverInterfaceMock_Expecter { + return &ProverInterfaceMock_Expecter{mock: &_m.Mock} +} + +// Addr provides a mock function with given fields: +func (_m *ProverInterfaceMock) Addr() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Addr") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// ProverInterfaceMock_Addr_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Addr' +type ProverInterfaceMock_Addr_Call struct { + *mock.Call +} + +// Addr is a helper method to define mock.On call +func (_e *ProverInterfaceMock_Expecter) Addr() *ProverInterfaceMock_Addr_Call { + return &ProverInterfaceMock_Addr_Call{Call: _e.mock.On("Addr")} +} + +func (_c *ProverInterfaceMock_Addr_Call) Run(run func()) *ProverInterfaceMock_Addr_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ProverInterfaceMock_Addr_Call) Return(_a0 string) *ProverInterfaceMock_Addr_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ProverInterfaceMock_Addr_Call) RunAndReturn(run func() string) *ProverInterfaceMock_Addr_Call { + _c.Call.Return(run) + return _c +} + +// AggregatedProof provides a mock function with given fields: inputProof1, inputProof2 +func (_m *ProverInterfaceMock) AggregatedProof(inputProof1 string, inputProof2 string) (*string, error) { + ret := _m.Called(inputProof1, inputProof2) + + if len(ret) == 0 { + panic("no return value specified for AggregatedProof") + } + + var r0 *string + var r1 error + if rf, ok := ret.Get(0).(func(string, string) (*string, error)); ok { + return rf(inputProof1, inputProof2) + } + if rf, ok := ret.Get(0).(func(string, string) *string); ok { + r0 = rf(inputProof1, inputProof2) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*string) + } + } + + if rf, ok := ret.Get(1).(func(string, string) error); ok { + r1 = rf(inputProof1, inputProof2) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProverInterfaceMock_AggregatedProof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AggregatedProof' +type ProverInterfaceMock_AggregatedProof_Call struct { + *mock.Call +} + +// AggregatedProof is a helper method to define mock.On call +// - inputProof1 string +// - inputProof2 string +func (_e *ProverInterfaceMock_Expecter) AggregatedProof(inputProof1 interface{}, inputProof2 interface{}) *ProverInterfaceMock_AggregatedProof_Call { + return &ProverInterfaceMock_AggregatedProof_Call{Call: _e.mock.On("AggregatedProof", inputProof1, inputProof2)} +} + +func (_c *ProverInterfaceMock_AggregatedProof_Call) Run(run func(inputProof1 string, inputProof2 string)) *ProverInterfaceMock_AggregatedProof_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *ProverInterfaceMock_AggregatedProof_Call) Return(_a0 *string, _a1 error) *ProverInterfaceMock_AggregatedProof_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ProverInterfaceMock_AggregatedProof_Call) RunAndReturn(run func(string, string) (*string, error)) *ProverInterfaceMock_AggregatedProof_Call { + _c.Call.Return(run) + return _c +} + +// BatchProof provides a mock function with given fields: input +func (_m *ProverInterfaceMock) BatchProof(input *prover.StatelessInputProver) (*string, error) { + ret := _m.Called(input) + + if len(ret) == 0 { + panic("no return value specified for BatchProof") + } + + var r0 *string + var r1 error + if rf, ok := ret.Get(0).(func(*prover.StatelessInputProver) (*string, error)); ok { + return rf(input) + } + if rf, ok := ret.Get(0).(func(*prover.StatelessInputProver) *string); ok { + r0 = rf(input) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*string) + } + } + + if rf, ok := ret.Get(1).(func(*prover.StatelessInputProver) error); ok { + r1 = rf(input) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProverInterfaceMock_BatchProof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BatchProof' +type ProverInterfaceMock_BatchProof_Call struct { + *mock.Call +} + +// BatchProof is a helper method to define mock.On call +// - input *prover.StatelessInputProver +func (_e *ProverInterfaceMock_Expecter) BatchProof(input interface{}) *ProverInterfaceMock_BatchProof_Call { + return &ProverInterfaceMock_BatchProof_Call{Call: _e.mock.On("BatchProof", input)} +} + +func (_c *ProverInterfaceMock_BatchProof_Call) Run(run func(input *prover.StatelessInputProver)) *ProverInterfaceMock_BatchProof_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(*prover.StatelessInputProver)) + }) + return _c +} + +func (_c *ProverInterfaceMock_BatchProof_Call) Return(_a0 *string, _a1 error) *ProverInterfaceMock_BatchProof_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ProverInterfaceMock_BatchProof_Call) RunAndReturn(run func(*prover.StatelessInputProver) (*string, error)) *ProverInterfaceMock_BatchProof_Call { + _c.Call.Return(run) + return _c +} + +// FinalProof provides a mock function with given fields: inputProof, aggregatorAddr +func (_m *ProverInterfaceMock) FinalProof(inputProof string, aggregatorAddr string) (*string, error) { + ret := _m.Called(inputProof, aggregatorAddr) + + if len(ret) == 0 { + panic("no return value specified for FinalProof") + } + + var r0 *string + var r1 error + if rf, ok := ret.Get(0).(func(string, string) (*string, error)); ok { + return rf(inputProof, aggregatorAddr) + } + if rf, ok := ret.Get(0).(func(string, string) *string); ok { + r0 = rf(inputProof, aggregatorAddr) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*string) + } + } + + if rf, ok := ret.Get(1).(func(string, string) error); ok { + r1 = rf(inputProof, aggregatorAddr) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProverInterfaceMock_FinalProof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'FinalProof' +type ProverInterfaceMock_FinalProof_Call struct { + *mock.Call +} + +// FinalProof is a helper method to define mock.On call +// - inputProof string +// - aggregatorAddr string +func (_e *ProverInterfaceMock_Expecter) FinalProof(inputProof interface{}, aggregatorAddr interface{}) *ProverInterfaceMock_FinalProof_Call { + return &ProverInterfaceMock_FinalProof_Call{Call: _e.mock.On("FinalProof", inputProof, aggregatorAddr)} +} + +func (_c *ProverInterfaceMock_FinalProof_Call) Run(run func(inputProof string, aggregatorAddr string)) *ProverInterfaceMock_FinalProof_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(string), args[1].(string)) + }) + return _c +} + +func (_c *ProverInterfaceMock_FinalProof_Call) Return(_a0 *string, _a1 error) *ProverInterfaceMock_FinalProof_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ProverInterfaceMock_FinalProof_Call) RunAndReturn(run func(string, string) (*string, error)) *ProverInterfaceMock_FinalProof_Call { + _c.Call.Return(run) + return _c +} + +// ID provides a mock function with given fields: +func (_m *ProverInterfaceMock) ID() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for ID") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// ProverInterfaceMock_ID_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ID' +type ProverInterfaceMock_ID_Call struct { + *mock.Call +} + +// ID is a helper method to define mock.On call +func (_e *ProverInterfaceMock_Expecter) ID() *ProverInterfaceMock_ID_Call { + return &ProverInterfaceMock_ID_Call{Call: _e.mock.On("ID")} +} + +func (_c *ProverInterfaceMock_ID_Call) Run(run func()) *ProverInterfaceMock_ID_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ProverInterfaceMock_ID_Call) Return(_a0 string) *ProverInterfaceMock_ID_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ProverInterfaceMock_ID_Call) RunAndReturn(run func() string) *ProverInterfaceMock_ID_Call { + _c.Call.Return(run) + return _c +} + +// IsIdle provides a mock function with given fields: +func (_m *ProverInterfaceMock) IsIdle() (bool, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for IsIdle") + } + + var r0 bool + var r1 error + if rf, ok := ret.Get(0).(func() (bool, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProverInterfaceMock_IsIdle_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsIdle' +type ProverInterfaceMock_IsIdle_Call struct { + *mock.Call +} + +// IsIdle is a helper method to define mock.On call +func (_e *ProverInterfaceMock_Expecter) IsIdle() *ProverInterfaceMock_IsIdle_Call { + return &ProverInterfaceMock_IsIdle_Call{Call: _e.mock.On("IsIdle")} +} + +func (_c *ProverInterfaceMock_IsIdle_Call) Run(run func()) *ProverInterfaceMock_IsIdle_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ProverInterfaceMock_IsIdle_Call) Return(_a0 bool, _a1 error) *ProverInterfaceMock_IsIdle_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ProverInterfaceMock_IsIdle_Call) RunAndReturn(run func() (bool, error)) *ProverInterfaceMock_IsIdle_Call { + _c.Call.Return(run) + return _c +} + +// Name provides a mock function with given fields: +func (_m *ProverInterfaceMock) Name() string { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Name") + } + + var r0 string + if rf, ok := ret.Get(0).(func() string); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(string) + } + + return r0 +} + +// ProverInterfaceMock_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type ProverInterfaceMock_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *ProverInterfaceMock_Expecter) Name() *ProverInterfaceMock_Name_Call { + return &ProverInterfaceMock_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *ProverInterfaceMock_Name_Call) Run(run func()) *ProverInterfaceMock_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *ProverInterfaceMock_Name_Call) Return(_a0 string) *ProverInterfaceMock_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *ProverInterfaceMock_Name_Call) RunAndReturn(run func() string) *ProverInterfaceMock_Name_Call { + _c.Call.Return(run) + return _c +} + +// WaitFinalProof provides a mock function with given fields: ctx, proofID +func (_m *ProverInterfaceMock) WaitFinalProof(ctx context.Context, proofID string) (*prover.FinalProof, error) { + ret := _m.Called(ctx, proofID) + + if len(ret) == 0 { + panic("no return value specified for WaitFinalProof") + } + + var r0 *prover.FinalProof + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (*prover.FinalProof, error)); ok { + return rf(ctx, proofID) + } + if rf, ok := ret.Get(0).(func(context.Context, string) *prover.FinalProof); ok { + r0 = rf(ctx, proofID) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*prover.FinalProof) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, proofID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// ProverInterfaceMock_WaitFinalProof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WaitFinalProof' +type ProverInterfaceMock_WaitFinalProof_Call struct { + *mock.Call +} + +// WaitFinalProof is a helper method to define mock.On call +// - ctx context.Context +// - proofID string +func (_e *ProverInterfaceMock_Expecter) WaitFinalProof(ctx interface{}, proofID interface{}) *ProverInterfaceMock_WaitFinalProof_Call { + return &ProverInterfaceMock_WaitFinalProof_Call{Call: _e.mock.On("WaitFinalProof", ctx, proofID)} +} + +func (_c *ProverInterfaceMock_WaitFinalProof_Call) Run(run func(ctx context.Context, proofID string)) *ProverInterfaceMock_WaitFinalProof_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *ProverInterfaceMock_WaitFinalProof_Call) Return(_a0 *prover.FinalProof, _a1 error) *ProverInterfaceMock_WaitFinalProof_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *ProverInterfaceMock_WaitFinalProof_Call) RunAndReturn(run func(context.Context, string) (*prover.FinalProof, error)) *ProverInterfaceMock_WaitFinalProof_Call { + _c.Call.Return(run) + return _c +} + +// WaitRecursiveProof provides a mock function with given fields: ctx, proofID +func (_m *ProverInterfaceMock) WaitRecursiveProof(ctx context.Context, proofID string) (string, common.Hash, error) { + ret := _m.Called(ctx, proofID) + + if len(ret) == 0 { + panic("no return value specified for WaitRecursiveProof") + } + + var r0 string + var r1 common.Hash + var r2 error + if rf, ok := ret.Get(0).(func(context.Context, string) (string, common.Hash, error)); ok { + return rf(ctx, proofID) + } + if rf, ok := ret.Get(0).(func(context.Context, string) string); ok { + r0 = rf(ctx, proofID) + } else { + r0 = ret.Get(0).(string) + } + + if rf, ok := ret.Get(1).(func(context.Context, string) common.Hash); ok { + r1 = rf(ctx, proofID) + } else { + if ret.Get(1) != nil { + r1 = ret.Get(1).(common.Hash) + } + } + + if rf, ok := ret.Get(2).(func(context.Context, string) error); ok { + r2 = rf(ctx, proofID) + } else { + r2 = ret.Error(2) + } + + return r0, r1, r2 +} + +// ProverInterfaceMock_WaitRecursiveProof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'WaitRecursiveProof' +type ProverInterfaceMock_WaitRecursiveProof_Call struct { + *mock.Call +} + +// WaitRecursiveProof is a helper method to define mock.On call +// - ctx context.Context +// - proofID string +func (_e *ProverInterfaceMock_Expecter) WaitRecursiveProof(ctx interface{}, proofID interface{}) *ProverInterfaceMock_WaitRecursiveProof_Call { + return &ProverInterfaceMock_WaitRecursiveProof_Call{Call: _e.mock.On("WaitRecursiveProof", ctx, proofID)} +} + +func (_c *ProverInterfaceMock_WaitRecursiveProof_Call) Run(run func(ctx context.Context, proofID string)) *ProverInterfaceMock_WaitRecursiveProof_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *ProverInterfaceMock_WaitRecursiveProof_Call) Return(_a0 string, _a1 common.Hash, _a2 error) *ProverInterfaceMock_WaitRecursiveProof_Call { + _c.Call.Return(_a0, _a1, _a2) + return _c +} + +func (_c *ProverInterfaceMock_WaitRecursiveProof_Call) RunAndReturn(run func(context.Context, string) (string, common.Hash, error)) *ProverInterfaceMock_WaitRecursiveProof_Call { + _c.Call.Return(run) + return _c +} + +// NewProverInterfaceMock creates a new instance of ProverInterfaceMock. 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 NewProverInterfaceMock(t interface { + mock.TestingT + Cleanup(func()) +}) *ProverInterfaceMock { + mock := &ProverInterfaceMock{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/aggregator/mocks/stateinterface.generated.go b/aggregator/mocks/stateinterface.generated.go index 46fd28f3..ec63ac0f 100644 --- a/aggregator/mocks/stateinterface.generated.go +++ b/aggregator/mocks/stateinterface.generated.go @@ -11,21 +11,21 @@ import ( state "github.com/0xPolygon/cdk/state" ) -// stateInterfaceMock is an autogenerated mock type for the StateInterface type -type stateInterfaceMock struct { +// StateInterfaceMock is an autogenerated mock type for the StateInterface type +type StateInterfaceMock struct { mock.Mock } -type stateInterfaceMock_Expecter struct { +type StateInterfaceMock_Expecter struct { mock *mock.Mock } -func (_m *stateInterfaceMock) EXPECT() *stateInterfaceMock_Expecter { - return &stateInterfaceMock_Expecter{mock: &_m.Mock} +func (_m *StateInterfaceMock) EXPECT() *StateInterfaceMock_Expecter { + return &StateInterfaceMock_Expecter{mock: &_m.Mock} } // AddBatch provides a mock function with given fields: ctx, dbBatch, dbTx -func (_m *stateInterfaceMock) AddBatch(ctx context.Context, dbBatch *state.DBBatch, dbTx pgx.Tx) error { +func (_m *StateInterfaceMock) AddBatch(ctx context.Context, dbBatch *state.DBBatch, dbTx pgx.Tx) error { ret := _m.Called(ctx, dbBatch, dbTx) if len(ret) == 0 { @@ -42,8 +42,8 @@ func (_m *stateInterfaceMock) AddBatch(ctx context.Context, dbBatch *state.DBBat return r0 } -// stateInterfaceMock_AddBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddBatch' -type stateInterfaceMock_AddBatch_Call struct { +// StateInterfaceMock_AddBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddBatch' +type StateInterfaceMock_AddBatch_Call struct { *mock.Call } @@ -51,29 +51,29 @@ type stateInterfaceMock_AddBatch_Call struct { // - ctx context.Context // - dbBatch *state.DBBatch // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) AddBatch(ctx interface{}, dbBatch interface{}, dbTx interface{}) *stateInterfaceMock_AddBatch_Call { - return &stateInterfaceMock_AddBatch_Call{Call: _e.mock.On("AddBatch", ctx, dbBatch, dbTx)} +func (_e *StateInterfaceMock_Expecter) AddBatch(ctx interface{}, dbBatch interface{}, dbTx interface{}) *StateInterfaceMock_AddBatch_Call { + return &StateInterfaceMock_AddBatch_Call{Call: _e.mock.On("AddBatch", ctx, dbBatch, dbTx)} } -func (_c *stateInterfaceMock_AddBatch_Call) Run(run func(ctx context.Context, dbBatch *state.DBBatch, dbTx pgx.Tx)) *stateInterfaceMock_AddBatch_Call { +func (_c *StateInterfaceMock_AddBatch_Call) Run(run func(ctx context.Context, dbBatch *state.DBBatch, dbTx pgx.Tx)) *StateInterfaceMock_AddBatch_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(*state.DBBatch), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_AddBatch_Call) Return(_a0 error) *stateInterfaceMock_AddBatch_Call { +func (_c *StateInterfaceMock_AddBatch_Call) Return(_a0 error) *StateInterfaceMock_AddBatch_Call { _c.Call.Return(_a0) return _c } -func (_c *stateInterfaceMock_AddBatch_Call) RunAndReturn(run func(context.Context, *state.DBBatch, pgx.Tx) error) *stateInterfaceMock_AddBatch_Call { +func (_c *StateInterfaceMock_AddBatch_Call) RunAndReturn(run func(context.Context, *state.DBBatch, pgx.Tx) error) *StateInterfaceMock_AddBatch_Call { _c.Call.Return(run) return _c } // AddGeneratedProof provides a mock function with given fields: ctx, proof, dbTx -func (_m *stateInterfaceMock) AddGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error { +func (_m *StateInterfaceMock) AddGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error { ret := _m.Called(ctx, proof, dbTx) if len(ret) == 0 { @@ -90,8 +90,8 @@ func (_m *stateInterfaceMock) AddGeneratedProof(ctx context.Context, proof *stat return r0 } -// stateInterfaceMock_AddGeneratedProof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddGeneratedProof' -type stateInterfaceMock_AddGeneratedProof_Call struct { +// StateInterfaceMock_AddGeneratedProof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddGeneratedProof' +type StateInterfaceMock_AddGeneratedProof_Call struct { *mock.Call } @@ -99,29 +99,29 @@ type stateInterfaceMock_AddGeneratedProof_Call struct { // - ctx context.Context // - proof *state.Proof // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) AddGeneratedProof(ctx interface{}, proof interface{}, dbTx interface{}) *stateInterfaceMock_AddGeneratedProof_Call { - return &stateInterfaceMock_AddGeneratedProof_Call{Call: _e.mock.On("AddGeneratedProof", ctx, proof, dbTx)} +func (_e *StateInterfaceMock_Expecter) AddGeneratedProof(ctx interface{}, proof interface{}, dbTx interface{}) *StateInterfaceMock_AddGeneratedProof_Call { + return &StateInterfaceMock_AddGeneratedProof_Call{Call: _e.mock.On("AddGeneratedProof", ctx, proof, dbTx)} } -func (_c *stateInterfaceMock_AddGeneratedProof_Call) Run(run func(ctx context.Context, proof *state.Proof, dbTx pgx.Tx)) *stateInterfaceMock_AddGeneratedProof_Call { +func (_c *StateInterfaceMock_AddGeneratedProof_Call) Run(run func(ctx context.Context, proof *state.Proof, dbTx pgx.Tx)) *StateInterfaceMock_AddGeneratedProof_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(*state.Proof), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_AddGeneratedProof_Call) Return(_a0 error) *stateInterfaceMock_AddGeneratedProof_Call { +func (_c *StateInterfaceMock_AddGeneratedProof_Call) Return(_a0 error) *StateInterfaceMock_AddGeneratedProof_Call { _c.Call.Return(_a0) return _c } -func (_c *stateInterfaceMock_AddGeneratedProof_Call) RunAndReturn(run func(context.Context, *state.Proof, pgx.Tx) error) *stateInterfaceMock_AddGeneratedProof_Call { +func (_c *StateInterfaceMock_AddGeneratedProof_Call) RunAndReturn(run func(context.Context, *state.Proof, pgx.Tx) error) *StateInterfaceMock_AddGeneratedProof_Call { _c.Call.Return(run) return _c } // AddSequence provides a mock function with given fields: ctx, sequence, dbTx -func (_m *stateInterfaceMock) AddSequence(ctx context.Context, sequence state.Sequence, dbTx pgx.Tx) error { +func (_m *StateInterfaceMock) AddSequence(ctx context.Context, sequence state.Sequence, dbTx pgx.Tx) error { ret := _m.Called(ctx, sequence, dbTx) if len(ret) == 0 { @@ -138,8 +138,8 @@ func (_m *stateInterfaceMock) AddSequence(ctx context.Context, sequence state.Se return r0 } -// stateInterfaceMock_AddSequence_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddSequence' -type stateInterfaceMock_AddSequence_Call struct { +// StateInterfaceMock_AddSequence_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'AddSequence' +type StateInterfaceMock_AddSequence_Call struct { *mock.Call } @@ -147,29 +147,29 @@ type stateInterfaceMock_AddSequence_Call struct { // - ctx context.Context // - sequence state.Sequence // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) AddSequence(ctx interface{}, sequence interface{}, dbTx interface{}) *stateInterfaceMock_AddSequence_Call { - return &stateInterfaceMock_AddSequence_Call{Call: _e.mock.On("AddSequence", ctx, sequence, dbTx)} +func (_e *StateInterfaceMock_Expecter) AddSequence(ctx interface{}, sequence interface{}, dbTx interface{}) *StateInterfaceMock_AddSequence_Call { + return &StateInterfaceMock_AddSequence_Call{Call: _e.mock.On("AddSequence", ctx, sequence, dbTx)} } -func (_c *stateInterfaceMock_AddSequence_Call) Run(run func(ctx context.Context, sequence state.Sequence, dbTx pgx.Tx)) *stateInterfaceMock_AddSequence_Call { +func (_c *StateInterfaceMock_AddSequence_Call) Run(run func(ctx context.Context, sequence state.Sequence, dbTx pgx.Tx)) *StateInterfaceMock_AddSequence_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(state.Sequence), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_AddSequence_Call) Return(_a0 error) *stateInterfaceMock_AddSequence_Call { +func (_c *StateInterfaceMock_AddSequence_Call) Return(_a0 error) *StateInterfaceMock_AddSequence_Call { _c.Call.Return(_a0) return _c } -func (_c *stateInterfaceMock_AddSequence_Call) RunAndReturn(run func(context.Context, state.Sequence, pgx.Tx) error) *stateInterfaceMock_AddSequence_Call { +func (_c *StateInterfaceMock_AddSequence_Call) RunAndReturn(run func(context.Context, state.Sequence, pgx.Tx) error) *StateInterfaceMock_AddSequence_Call { _c.Call.Return(run) return _c } // BeginStateTransaction provides a mock function with given fields: ctx -func (_m *stateInterfaceMock) BeginStateTransaction(ctx context.Context) (pgx.Tx, error) { +func (_m *StateInterfaceMock) BeginStateTransaction(ctx context.Context) (pgx.Tx, error) { ret := _m.Called(ctx) if len(ret) == 0 { @@ -198,36 +198,36 @@ func (_m *stateInterfaceMock) BeginStateTransaction(ctx context.Context) (pgx.Tx return r0, r1 } -// stateInterfaceMock_BeginStateTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BeginStateTransaction' -type stateInterfaceMock_BeginStateTransaction_Call struct { +// StateInterfaceMock_BeginStateTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'BeginStateTransaction' +type StateInterfaceMock_BeginStateTransaction_Call struct { *mock.Call } // BeginStateTransaction is a helper method to define mock.On call // - ctx context.Context -func (_e *stateInterfaceMock_Expecter) BeginStateTransaction(ctx interface{}) *stateInterfaceMock_BeginStateTransaction_Call { - return &stateInterfaceMock_BeginStateTransaction_Call{Call: _e.mock.On("BeginStateTransaction", ctx)} +func (_e *StateInterfaceMock_Expecter) BeginStateTransaction(ctx interface{}) *StateInterfaceMock_BeginStateTransaction_Call { + return &StateInterfaceMock_BeginStateTransaction_Call{Call: _e.mock.On("BeginStateTransaction", ctx)} } -func (_c *stateInterfaceMock_BeginStateTransaction_Call) Run(run func(ctx context.Context)) *stateInterfaceMock_BeginStateTransaction_Call { +func (_c *StateInterfaceMock_BeginStateTransaction_Call) Run(run func(ctx context.Context)) *StateInterfaceMock_BeginStateTransaction_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context)) }) return _c } -func (_c *stateInterfaceMock_BeginStateTransaction_Call) Return(_a0 pgx.Tx, _a1 error) *stateInterfaceMock_BeginStateTransaction_Call { +func (_c *StateInterfaceMock_BeginStateTransaction_Call) Return(_a0 pgx.Tx, _a1 error) *StateInterfaceMock_BeginStateTransaction_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *stateInterfaceMock_BeginStateTransaction_Call) RunAndReturn(run func(context.Context) (pgx.Tx, error)) *stateInterfaceMock_BeginStateTransaction_Call { +func (_c *StateInterfaceMock_BeginStateTransaction_Call) RunAndReturn(run func(context.Context) (pgx.Tx, error)) *StateInterfaceMock_BeginStateTransaction_Call { _c.Call.Return(run) return _c } // CheckProofContainsCompleteSequences provides a mock function with given fields: ctx, proof, dbTx -func (_m *stateInterfaceMock) CheckProofContainsCompleteSequences(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) (bool, error) { +func (_m *StateInterfaceMock) CheckProofContainsCompleteSequences(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) (bool, error) { ret := _m.Called(ctx, proof, dbTx) if len(ret) == 0 { @@ -254,8 +254,8 @@ func (_m *stateInterfaceMock) CheckProofContainsCompleteSequences(ctx context.Co return r0, r1 } -// stateInterfaceMock_CheckProofContainsCompleteSequences_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckProofContainsCompleteSequences' -type stateInterfaceMock_CheckProofContainsCompleteSequences_Call struct { +// StateInterfaceMock_CheckProofContainsCompleteSequences_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckProofContainsCompleteSequences' +type StateInterfaceMock_CheckProofContainsCompleteSequences_Call struct { *mock.Call } @@ -263,29 +263,29 @@ type stateInterfaceMock_CheckProofContainsCompleteSequences_Call struct { // - ctx context.Context // - proof *state.Proof // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) CheckProofContainsCompleteSequences(ctx interface{}, proof interface{}, dbTx interface{}) *stateInterfaceMock_CheckProofContainsCompleteSequences_Call { - return &stateInterfaceMock_CheckProofContainsCompleteSequences_Call{Call: _e.mock.On("CheckProofContainsCompleteSequences", ctx, proof, dbTx)} +func (_e *StateInterfaceMock_Expecter) CheckProofContainsCompleteSequences(ctx interface{}, proof interface{}, dbTx interface{}) *StateInterfaceMock_CheckProofContainsCompleteSequences_Call { + return &StateInterfaceMock_CheckProofContainsCompleteSequences_Call{Call: _e.mock.On("CheckProofContainsCompleteSequences", ctx, proof, dbTx)} } -func (_c *stateInterfaceMock_CheckProofContainsCompleteSequences_Call) Run(run func(ctx context.Context, proof *state.Proof, dbTx pgx.Tx)) *stateInterfaceMock_CheckProofContainsCompleteSequences_Call { +func (_c *StateInterfaceMock_CheckProofContainsCompleteSequences_Call) Run(run func(ctx context.Context, proof *state.Proof, dbTx pgx.Tx)) *StateInterfaceMock_CheckProofContainsCompleteSequences_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(*state.Proof), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_CheckProofContainsCompleteSequences_Call) Return(_a0 bool, _a1 error) *stateInterfaceMock_CheckProofContainsCompleteSequences_Call { +func (_c *StateInterfaceMock_CheckProofContainsCompleteSequences_Call) Return(_a0 bool, _a1 error) *StateInterfaceMock_CheckProofContainsCompleteSequences_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *stateInterfaceMock_CheckProofContainsCompleteSequences_Call) RunAndReturn(run func(context.Context, *state.Proof, pgx.Tx) (bool, error)) *stateInterfaceMock_CheckProofContainsCompleteSequences_Call { +func (_c *StateInterfaceMock_CheckProofContainsCompleteSequences_Call) RunAndReturn(run func(context.Context, *state.Proof, pgx.Tx) (bool, error)) *StateInterfaceMock_CheckProofContainsCompleteSequences_Call { _c.Call.Return(run) return _c } // CheckProofExistsForBatch provides a mock function with given fields: ctx, batchNumber, dbTx -func (_m *stateInterfaceMock) CheckProofExistsForBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (bool, error) { +func (_m *StateInterfaceMock) CheckProofExistsForBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (bool, error) { ret := _m.Called(ctx, batchNumber, dbTx) if len(ret) == 0 { @@ -312,8 +312,8 @@ func (_m *stateInterfaceMock) CheckProofExistsForBatch(ctx context.Context, batc return r0, r1 } -// stateInterfaceMock_CheckProofExistsForBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckProofExistsForBatch' -type stateInterfaceMock_CheckProofExistsForBatch_Call struct { +// StateInterfaceMock_CheckProofExistsForBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CheckProofExistsForBatch' +type StateInterfaceMock_CheckProofExistsForBatch_Call struct { *mock.Call } @@ -321,29 +321,29 @@ type stateInterfaceMock_CheckProofExistsForBatch_Call struct { // - ctx context.Context // - batchNumber uint64 // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) CheckProofExistsForBatch(ctx interface{}, batchNumber interface{}, dbTx interface{}) *stateInterfaceMock_CheckProofExistsForBatch_Call { - return &stateInterfaceMock_CheckProofExistsForBatch_Call{Call: _e.mock.On("CheckProofExistsForBatch", ctx, batchNumber, dbTx)} +func (_e *StateInterfaceMock_Expecter) CheckProofExistsForBatch(ctx interface{}, batchNumber interface{}, dbTx interface{}) *StateInterfaceMock_CheckProofExistsForBatch_Call { + return &StateInterfaceMock_CheckProofExistsForBatch_Call{Call: _e.mock.On("CheckProofExistsForBatch", ctx, batchNumber, dbTx)} } -func (_c *stateInterfaceMock_CheckProofExistsForBatch_Call) Run(run func(ctx context.Context, batchNumber uint64, dbTx pgx.Tx)) *stateInterfaceMock_CheckProofExistsForBatch_Call { +func (_c *StateInterfaceMock_CheckProofExistsForBatch_Call) Run(run func(ctx context.Context, batchNumber uint64, dbTx pgx.Tx)) *StateInterfaceMock_CheckProofExistsForBatch_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(uint64), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_CheckProofExistsForBatch_Call) Return(_a0 bool, _a1 error) *stateInterfaceMock_CheckProofExistsForBatch_Call { +func (_c *StateInterfaceMock_CheckProofExistsForBatch_Call) Return(_a0 bool, _a1 error) *StateInterfaceMock_CheckProofExistsForBatch_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *stateInterfaceMock_CheckProofExistsForBatch_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) (bool, error)) *stateInterfaceMock_CheckProofExistsForBatch_Call { +func (_c *StateInterfaceMock_CheckProofExistsForBatch_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) (bool, error)) *StateInterfaceMock_CheckProofExistsForBatch_Call { _c.Call.Return(run) return _c } // CleanupGeneratedProofs provides a mock function with given fields: ctx, batchNumber, dbTx -func (_m *stateInterfaceMock) CleanupGeneratedProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error { +func (_m *StateInterfaceMock) CleanupGeneratedProofs(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error { ret := _m.Called(ctx, batchNumber, dbTx) if len(ret) == 0 { @@ -360,8 +360,8 @@ func (_m *stateInterfaceMock) CleanupGeneratedProofs(ctx context.Context, batchN return r0 } -// stateInterfaceMock_CleanupGeneratedProofs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CleanupGeneratedProofs' -type stateInterfaceMock_CleanupGeneratedProofs_Call struct { +// StateInterfaceMock_CleanupGeneratedProofs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CleanupGeneratedProofs' +type StateInterfaceMock_CleanupGeneratedProofs_Call struct { *mock.Call } @@ -369,29 +369,29 @@ type stateInterfaceMock_CleanupGeneratedProofs_Call struct { // - ctx context.Context // - batchNumber uint64 // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) CleanupGeneratedProofs(ctx interface{}, batchNumber interface{}, dbTx interface{}) *stateInterfaceMock_CleanupGeneratedProofs_Call { - return &stateInterfaceMock_CleanupGeneratedProofs_Call{Call: _e.mock.On("CleanupGeneratedProofs", ctx, batchNumber, dbTx)} +func (_e *StateInterfaceMock_Expecter) CleanupGeneratedProofs(ctx interface{}, batchNumber interface{}, dbTx interface{}) *StateInterfaceMock_CleanupGeneratedProofs_Call { + return &StateInterfaceMock_CleanupGeneratedProofs_Call{Call: _e.mock.On("CleanupGeneratedProofs", ctx, batchNumber, dbTx)} } -func (_c *stateInterfaceMock_CleanupGeneratedProofs_Call) Run(run func(ctx context.Context, batchNumber uint64, dbTx pgx.Tx)) *stateInterfaceMock_CleanupGeneratedProofs_Call { +func (_c *StateInterfaceMock_CleanupGeneratedProofs_Call) Run(run func(ctx context.Context, batchNumber uint64, dbTx pgx.Tx)) *StateInterfaceMock_CleanupGeneratedProofs_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(uint64), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_CleanupGeneratedProofs_Call) Return(_a0 error) *stateInterfaceMock_CleanupGeneratedProofs_Call { +func (_c *StateInterfaceMock_CleanupGeneratedProofs_Call) Return(_a0 error) *StateInterfaceMock_CleanupGeneratedProofs_Call { _c.Call.Return(_a0) return _c } -func (_c *stateInterfaceMock_CleanupGeneratedProofs_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) error) *stateInterfaceMock_CleanupGeneratedProofs_Call { +func (_c *StateInterfaceMock_CleanupGeneratedProofs_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) error) *StateInterfaceMock_CleanupGeneratedProofs_Call { _c.Call.Return(run) return _c } // CleanupLockedProofs provides a mock function with given fields: ctx, duration, dbTx -func (_m *stateInterfaceMock) CleanupLockedProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error) { +func (_m *StateInterfaceMock) CleanupLockedProofs(ctx context.Context, duration string, dbTx pgx.Tx) (int64, error) { ret := _m.Called(ctx, duration, dbTx) if len(ret) == 0 { @@ -418,8 +418,8 @@ func (_m *stateInterfaceMock) CleanupLockedProofs(ctx context.Context, duration return r0, r1 } -// stateInterfaceMock_CleanupLockedProofs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CleanupLockedProofs' -type stateInterfaceMock_CleanupLockedProofs_Call struct { +// StateInterfaceMock_CleanupLockedProofs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'CleanupLockedProofs' +type StateInterfaceMock_CleanupLockedProofs_Call struct { *mock.Call } @@ -427,29 +427,29 @@ type stateInterfaceMock_CleanupLockedProofs_Call struct { // - ctx context.Context // - duration string // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) CleanupLockedProofs(ctx interface{}, duration interface{}, dbTx interface{}) *stateInterfaceMock_CleanupLockedProofs_Call { - return &stateInterfaceMock_CleanupLockedProofs_Call{Call: _e.mock.On("CleanupLockedProofs", ctx, duration, dbTx)} +func (_e *StateInterfaceMock_Expecter) CleanupLockedProofs(ctx interface{}, duration interface{}, dbTx interface{}) *StateInterfaceMock_CleanupLockedProofs_Call { + return &StateInterfaceMock_CleanupLockedProofs_Call{Call: _e.mock.On("CleanupLockedProofs", ctx, duration, dbTx)} } -func (_c *stateInterfaceMock_CleanupLockedProofs_Call) Run(run func(ctx context.Context, duration string, dbTx pgx.Tx)) *stateInterfaceMock_CleanupLockedProofs_Call { +func (_c *StateInterfaceMock_CleanupLockedProofs_Call) Run(run func(ctx context.Context, duration string, dbTx pgx.Tx)) *StateInterfaceMock_CleanupLockedProofs_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(string), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_CleanupLockedProofs_Call) Return(_a0 int64, _a1 error) *stateInterfaceMock_CleanupLockedProofs_Call { +func (_c *StateInterfaceMock_CleanupLockedProofs_Call) Return(_a0 int64, _a1 error) *StateInterfaceMock_CleanupLockedProofs_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *stateInterfaceMock_CleanupLockedProofs_Call) RunAndReturn(run func(context.Context, string, pgx.Tx) (int64, error)) *stateInterfaceMock_CleanupLockedProofs_Call { +func (_c *StateInterfaceMock_CleanupLockedProofs_Call) RunAndReturn(run func(context.Context, string, pgx.Tx) (int64, error)) *StateInterfaceMock_CleanupLockedProofs_Call { _c.Call.Return(run) return _c } // DeleteBatchesNewerThanBatchNumber provides a mock function with given fields: ctx, batchNumber, dbTx -func (_m *stateInterfaceMock) DeleteBatchesNewerThanBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error { +func (_m *StateInterfaceMock) DeleteBatchesNewerThanBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error { ret := _m.Called(ctx, batchNumber, dbTx) if len(ret) == 0 { @@ -466,8 +466,8 @@ func (_m *stateInterfaceMock) DeleteBatchesNewerThanBatchNumber(ctx context.Cont return r0 } -// stateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteBatchesNewerThanBatchNumber' -type stateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call struct { +// StateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteBatchesNewerThanBatchNumber' +type StateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call struct { *mock.Call } @@ -475,29 +475,29 @@ type stateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call struct { // - ctx context.Context // - batchNumber uint64 // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) DeleteBatchesNewerThanBatchNumber(ctx interface{}, batchNumber interface{}, dbTx interface{}) *stateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call { - return &stateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call{Call: _e.mock.On("DeleteBatchesNewerThanBatchNumber", ctx, batchNumber, dbTx)} +func (_e *StateInterfaceMock_Expecter) DeleteBatchesNewerThanBatchNumber(ctx interface{}, batchNumber interface{}, dbTx interface{}) *StateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call { + return &StateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call{Call: _e.mock.On("DeleteBatchesNewerThanBatchNumber", ctx, batchNumber, dbTx)} } -func (_c *stateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call) Run(run func(ctx context.Context, batchNumber uint64, dbTx pgx.Tx)) *stateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call { +func (_c *StateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call) Run(run func(ctx context.Context, batchNumber uint64, dbTx pgx.Tx)) *StateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(uint64), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call) Return(_a0 error) *stateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call { +func (_c *StateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call) Return(_a0 error) *StateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call { _c.Call.Return(_a0) return _c } -func (_c *stateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) error) *stateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call { +func (_c *StateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) error) *StateInterfaceMock_DeleteBatchesNewerThanBatchNumber_Call { _c.Call.Return(run) return _c } // DeleteBatchesOlderThanBatchNumber provides a mock function with given fields: ctx, batchNumber, dbTx -func (_m *stateInterfaceMock) DeleteBatchesOlderThanBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error { +func (_m *StateInterfaceMock) DeleteBatchesOlderThanBatchNumber(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) error { ret := _m.Called(ctx, batchNumber, dbTx) if len(ret) == 0 { @@ -514,8 +514,8 @@ func (_m *stateInterfaceMock) DeleteBatchesOlderThanBatchNumber(ctx context.Cont return r0 } -// stateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteBatchesOlderThanBatchNumber' -type stateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call struct { +// StateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteBatchesOlderThanBatchNumber' +type StateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call struct { *mock.Call } @@ -523,29 +523,29 @@ type stateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call struct { // - ctx context.Context // - batchNumber uint64 // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) DeleteBatchesOlderThanBatchNumber(ctx interface{}, batchNumber interface{}, dbTx interface{}) *stateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call { - return &stateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call{Call: _e.mock.On("DeleteBatchesOlderThanBatchNumber", ctx, batchNumber, dbTx)} +func (_e *StateInterfaceMock_Expecter) DeleteBatchesOlderThanBatchNumber(ctx interface{}, batchNumber interface{}, dbTx interface{}) *StateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call { + return &StateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call{Call: _e.mock.On("DeleteBatchesOlderThanBatchNumber", ctx, batchNumber, dbTx)} } -func (_c *stateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call) Run(run func(ctx context.Context, batchNumber uint64, dbTx pgx.Tx)) *stateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call { +func (_c *StateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call) Run(run func(ctx context.Context, batchNumber uint64, dbTx pgx.Tx)) *StateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(uint64), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call) Return(_a0 error) *stateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call { +func (_c *StateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call) Return(_a0 error) *StateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call { _c.Call.Return(_a0) return _c } -func (_c *stateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) error) *stateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call { +func (_c *StateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) error) *StateInterfaceMock_DeleteBatchesOlderThanBatchNumber_Call { _c.Call.Return(run) return _c } // DeleteGeneratedProofs provides a mock function with given fields: ctx, batchNumber, batchNumberFinal, dbTx -func (_m *stateInterfaceMock) DeleteGeneratedProofs(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx) error { +func (_m *StateInterfaceMock) DeleteGeneratedProofs(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx) error { ret := _m.Called(ctx, batchNumber, batchNumberFinal, dbTx) if len(ret) == 0 { @@ -562,8 +562,8 @@ func (_m *stateInterfaceMock) DeleteGeneratedProofs(ctx context.Context, batchNu return r0 } -// stateInterfaceMock_DeleteGeneratedProofs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGeneratedProofs' -type stateInterfaceMock_DeleteGeneratedProofs_Call struct { +// StateInterfaceMock_DeleteGeneratedProofs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteGeneratedProofs' +type StateInterfaceMock_DeleteGeneratedProofs_Call struct { *mock.Call } @@ -572,29 +572,29 @@ type stateInterfaceMock_DeleteGeneratedProofs_Call struct { // - batchNumber uint64 // - batchNumberFinal uint64 // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) DeleteGeneratedProofs(ctx interface{}, batchNumber interface{}, batchNumberFinal interface{}, dbTx interface{}) *stateInterfaceMock_DeleteGeneratedProofs_Call { - return &stateInterfaceMock_DeleteGeneratedProofs_Call{Call: _e.mock.On("DeleteGeneratedProofs", ctx, batchNumber, batchNumberFinal, dbTx)} +func (_e *StateInterfaceMock_Expecter) DeleteGeneratedProofs(ctx interface{}, batchNumber interface{}, batchNumberFinal interface{}, dbTx interface{}) *StateInterfaceMock_DeleteGeneratedProofs_Call { + return &StateInterfaceMock_DeleteGeneratedProofs_Call{Call: _e.mock.On("DeleteGeneratedProofs", ctx, batchNumber, batchNumberFinal, dbTx)} } -func (_c *stateInterfaceMock_DeleteGeneratedProofs_Call) Run(run func(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx)) *stateInterfaceMock_DeleteGeneratedProofs_Call { +func (_c *StateInterfaceMock_DeleteGeneratedProofs_Call) Run(run func(ctx context.Context, batchNumber uint64, batchNumberFinal uint64, dbTx pgx.Tx)) *StateInterfaceMock_DeleteGeneratedProofs_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(uint64), args[2].(uint64), args[3].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_DeleteGeneratedProofs_Call) Return(_a0 error) *stateInterfaceMock_DeleteGeneratedProofs_Call { +func (_c *StateInterfaceMock_DeleteGeneratedProofs_Call) Return(_a0 error) *StateInterfaceMock_DeleteGeneratedProofs_Call { _c.Call.Return(_a0) return _c } -func (_c *stateInterfaceMock_DeleteGeneratedProofs_Call) RunAndReturn(run func(context.Context, uint64, uint64, pgx.Tx) error) *stateInterfaceMock_DeleteGeneratedProofs_Call { +func (_c *StateInterfaceMock_DeleteGeneratedProofs_Call) RunAndReturn(run func(context.Context, uint64, uint64, pgx.Tx) error) *StateInterfaceMock_DeleteGeneratedProofs_Call { _c.Call.Return(run) return _c } // DeleteUngeneratedProofs provides a mock function with given fields: ctx, dbTx -func (_m *stateInterfaceMock) DeleteUngeneratedProofs(ctx context.Context, dbTx pgx.Tx) error { +func (_m *StateInterfaceMock) DeleteUngeneratedProofs(ctx context.Context, dbTx pgx.Tx) error { ret := _m.Called(ctx, dbTx) if len(ret) == 0 { @@ -611,37 +611,37 @@ func (_m *stateInterfaceMock) DeleteUngeneratedProofs(ctx context.Context, dbTx return r0 } -// stateInterfaceMock_DeleteUngeneratedProofs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUngeneratedProofs' -type stateInterfaceMock_DeleteUngeneratedProofs_Call struct { +// StateInterfaceMock_DeleteUngeneratedProofs_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'DeleteUngeneratedProofs' +type StateInterfaceMock_DeleteUngeneratedProofs_Call struct { *mock.Call } // DeleteUngeneratedProofs is a helper method to define mock.On call // - ctx context.Context // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) DeleteUngeneratedProofs(ctx interface{}, dbTx interface{}) *stateInterfaceMock_DeleteUngeneratedProofs_Call { - return &stateInterfaceMock_DeleteUngeneratedProofs_Call{Call: _e.mock.On("DeleteUngeneratedProofs", ctx, dbTx)} +func (_e *StateInterfaceMock_Expecter) DeleteUngeneratedProofs(ctx interface{}, dbTx interface{}) *StateInterfaceMock_DeleteUngeneratedProofs_Call { + return &StateInterfaceMock_DeleteUngeneratedProofs_Call{Call: _e.mock.On("DeleteUngeneratedProofs", ctx, dbTx)} } -func (_c *stateInterfaceMock_DeleteUngeneratedProofs_Call) Run(run func(ctx context.Context, dbTx pgx.Tx)) *stateInterfaceMock_DeleteUngeneratedProofs_Call { +func (_c *StateInterfaceMock_DeleteUngeneratedProofs_Call) Run(run func(ctx context.Context, dbTx pgx.Tx)) *StateInterfaceMock_DeleteUngeneratedProofs_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_DeleteUngeneratedProofs_Call) Return(_a0 error) *stateInterfaceMock_DeleteUngeneratedProofs_Call { +func (_c *StateInterfaceMock_DeleteUngeneratedProofs_Call) Return(_a0 error) *StateInterfaceMock_DeleteUngeneratedProofs_Call { _c.Call.Return(_a0) return _c } -func (_c *stateInterfaceMock_DeleteUngeneratedProofs_Call) RunAndReturn(run func(context.Context, pgx.Tx) error) *stateInterfaceMock_DeleteUngeneratedProofs_Call { +func (_c *StateInterfaceMock_DeleteUngeneratedProofs_Call) RunAndReturn(run func(context.Context, pgx.Tx) error) *StateInterfaceMock_DeleteUngeneratedProofs_Call { _c.Call.Return(run) return _c } // GetBatch provides a mock function with given fields: ctx, batchNumber, dbTx -func (_m *stateInterfaceMock) GetBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.DBBatch, error) { +func (_m *StateInterfaceMock) GetBatch(ctx context.Context, batchNumber uint64, dbTx pgx.Tx) (*state.DBBatch, error) { ret := _m.Called(ctx, batchNumber, dbTx) if len(ret) == 0 { @@ -670,8 +670,8 @@ func (_m *stateInterfaceMock) GetBatch(ctx context.Context, batchNumber uint64, return r0, r1 } -// stateInterfaceMock_GetBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBatch' -type stateInterfaceMock_GetBatch_Call struct { +// StateInterfaceMock_GetBatch_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetBatch' +type StateInterfaceMock_GetBatch_Call struct { *mock.Call } @@ -679,29 +679,29 @@ type stateInterfaceMock_GetBatch_Call struct { // - ctx context.Context // - batchNumber uint64 // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) GetBatch(ctx interface{}, batchNumber interface{}, dbTx interface{}) *stateInterfaceMock_GetBatch_Call { - return &stateInterfaceMock_GetBatch_Call{Call: _e.mock.On("GetBatch", ctx, batchNumber, dbTx)} +func (_e *StateInterfaceMock_Expecter) GetBatch(ctx interface{}, batchNumber interface{}, dbTx interface{}) *StateInterfaceMock_GetBatch_Call { + return &StateInterfaceMock_GetBatch_Call{Call: _e.mock.On("GetBatch", ctx, batchNumber, dbTx)} } -func (_c *stateInterfaceMock_GetBatch_Call) Run(run func(ctx context.Context, batchNumber uint64, dbTx pgx.Tx)) *stateInterfaceMock_GetBatch_Call { +func (_c *StateInterfaceMock_GetBatch_Call) Run(run func(ctx context.Context, batchNumber uint64, dbTx pgx.Tx)) *StateInterfaceMock_GetBatch_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(uint64), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_GetBatch_Call) Return(_a0 *state.DBBatch, _a1 error) *stateInterfaceMock_GetBatch_Call { +func (_c *StateInterfaceMock_GetBatch_Call) Return(_a0 *state.DBBatch, _a1 error) *StateInterfaceMock_GetBatch_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *stateInterfaceMock_GetBatch_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) (*state.DBBatch, error)) *stateInterfaceMock_GetBatch_Call { +func (_c *StateInterfaceMock_GetBatch_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) (*state.DBBatch, error)) *StateInterfaceMock_GetBatch_Call { _c.Call.Return(run) return _c } // GetProofReadyToVerify provides a mock function with given fields: ctx, lastVerfiedBatchNumber, dbTx -func (_m *stateInterfaceMock) GetProofReadyToVerify(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*state.Proof, error) { +func (_m *StateInterfaceMock) GetProofReadyToVerify(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx) (*state.Proof, error) { ret := _m.Called(ctx, lastVerfiedBatchNumber, dbTx) if len(ret) == 0 { @@ -730,8 +730,8 @@ func (_m *stateInterfaceMock) GetProofReadyToVerify(ctx context.Context, lastVer return r0, r1 } -// stateInterfaceMock_GetProofReadyToVerify_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProofReadyToVerify' -type stateInterfaceMock_GetProofReadyToVerify_Call struct { +// StateInterfaceMock_GetProofReadyToVerify_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProofReadyToVerify' +type StateInterfaceMock_GetProofReadyToVerify_Call struct { *mock.Call } @@ -739,29 +739,29 @@ type stateInterfaceMock_GetProofReadyToVerify_Call struct { // - ctx context.Context // - lastVerfiedBatchNumber uint64 // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) GetProofReadyToVerify(ctx interface{}, lastVerfiedBatchNumber interface{}, dbTx interface{}) *stateInterfaceMock_GetProofReadyToVerify_Call { - return &stateInterfaceMock_GetProofReadyToVerify_Call{Call: _e.mock.On("GetProofReadyToVerify", ctx, lastVerfiedBatchNumber, dbTx)} +func (_e *StateInterfaceMock_Expecter) GetProofReadyToVerify(ctx interface{}, lastVerfiedBatchNumber interface{}, dbTx interface{}) *StateInterfaceMock_GetProofReadyToVerify_Call { + return &StateInterfaceMock_GetProofReadyToVerify_Call{Call: _e.mock.On("GetProofReadyToVerify", ctx, lastVerfiedBatchNumber, dbTx)} } -func (_c *stateInterfaceMock_GetProofReadyToVerify_Call) Run(run func(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx)) *stateInterfaceMock_GetProofReadyToVerify_Call { +func (_c *StateInterfaceMock_GetProofReadyToVerify_Call) Run(run func(ctx context.Context, lastVerfiedBatchNumber uint64, dbTx pgx.Tx)) *StateInterfaceMock_GetProofReadyToVerify_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(uint64), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_GetProofReadyToVerify_Call) Return(_a0 *state.Proof, _a1 error) *stateInterfaceMock_GetProofReadyToVerify_Call { +func (_c *StateInterfaceMock_GetProofReadyToVerify_Call) Return(_a0 *state.Proof, _a1 error) *StateInterfaceMock_GetProofReadyToVerify_Call { _c.Call.Return(_a0, _a1) return _c } -func (_c *stateInterfaceMock_GetProofReadyToVerify_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) (*state.Proof, error)) *stateInterfaceMock_GetProofReadyToVerify_Call { +func (_c *StateInterfaceMock_GetProofReadyToVerify_Call) RunAndReturn(run func(context.Context, uint64, pgx.Tx) (*state.Proof, error)) *StateInterfaceMock_GetProofReadyToVerify_Call { _c.Call.Return(run) return _c } // GetProofsToAggregate provides a mock function with given fields: ctx, dbTx -func (_m *stateInterfaceMock) GetProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*state.Proof, *state.Proof, error) { +func (_m *StateInterfaceMock) GetProofsToAggregate(ctx context.Context, dbTx pgx.Tx) (*state.Proof, *state.Proof, error) { ret := _m.Called(ctx, dbTx) if len(ret) == 0 { @@ -799,37 +799,37 @@ func (_m *stateInterfaceMock) GetProofsToAggregate(ctx context.Context, dbTx pgx return r0, r1, r2 } -// stateInterfaceMock_GetProofsToAggregate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProofsToAggregate' -type stateInterfaceMock_GetProofsToAggregate_Call struct { +// StateInterfaceMock_GetProofsToAggregate_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetProofsToAggregate' +type StateInterfaceMock_GetProofsToAggregate_Call struct { *mock.Call } // GetProofsToAggregate is a helper method to define mock.On call // - ctx context.Context // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) GetProofsToAggregate(ctx interface{}, dbTx interface{}) *stateInterfaceMock_GetProofsToAggregate_Call { - return &stateInterfaceMock_GetProofsToAggregate_Call{Call: _e.mock.On("GetProofsToAggregate", ctx, dbTx)} +func (_e *StateInterfaceMock_Expecter) GetProofsToAggregate(ctx interface{}, dbTx interface{}) *StateInterfaceMock_GetProofsToAggregate_Call { + return &StateInterfaceMock_GetProofsToAggregate_Call{Call: _e.mock.On("GetProofsToAggregate", ctx, dbTx)} } -func (_c *stateInterfaceMock_GetProofsToAggregate_Call) Run(run func(ctx context.Context, dbTx pgx.Tx)) *stateInterfaceMock_GetProofsToAggregate_Call { +func (_c *StateInterfaceMock_GetProofsToAggregate_Call) Run(run func(ctx context.Context, dbTx pgx.Tx)) *StateInterfaceMock_GetProofsToAggregate_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_GetProofsToAggregate_Call) Return(_a0 *state.Proof, _a1 *state.Proof, _a2 error) *stateInterfaceMock_GetProofsToAggregate_Call { +func (_c *StateInterfaceMock_GetProofsToAggregate_Call) Return(_a0 *state.Proof, _a1 *state.Proof, _a2 error) *StateInterfaceMock_GetProofsToAggregate_Call { _c.Call.Return(_a0, _a1, _a2) return _c } -func (_c *stateInterfaceMock_GetProofsToAggregate_Call) RunAndReturn(run func(context.Context, pgx.Tx) (*state.Proof, *state.Proof, error)) *stateInterfaceMock_GetProofsToAggregate_Call { +func (_c *StateInterfaceMock_GetProofsToAggregate_Call) RunAndReturn(run func(context.Context, pgx.Tx) (*state.Proof, *state.Proof, error)) *StateInterfaceMock_GetProofsToAggregate_Call { _c.Call.Return(run) return _c } // UpdateGeneratedProof provides a mock function with given fields: ctx, proof, dbTx -func (_m *stateInterfaceMock) UpdateGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error { +func (_m *StateInterfaceMock) UpdateGeneratedProof(ctx context.Context, proof *state.Proof, dbTx pgx.Tx) error { ret := _m.Called(ctx, proof, dbTx) if len(ret) == 0 { @@ -846,8 +846,8 @@ func (_m *stateInterfaceMock) UpdateGeneratedProof(ctx context.Context, proof *s return r0 } -// stateInterfaceMock_UpdateGeneratedProof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGeneratedProof' -type stateInterfaceMock_UpdateGeneratedProof_Call struct { +// StateInterfaceMock_UpdateGeneratedProof_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'UpdateGeneratedProof' +type StateInterfaceMock_UpdateGeneratedProof_Call struct { *mock.Call } @@ -855,34 +855,34 @@ type stateInterfaceMock_UpdateGeneratedProof_Call struct { // - ctx context.Context // - proof *state.Proof // - dbTx pgx.Tx -func (_e *stateInterfaceMock_Expecter) UpdateGeneratedProof(ctx interface{}, proof interface{}, dbTx interface{}) *stateInterfaceMock_UpdateGeneratedProof_Call { - return &stateInterfaceMock_UpdateGeneratedProof_Call{Call: _e.mock.On("UpdateGeneratedProof", ctx, proof, dbTx)} +func (_e *StateInterfaceMock_Expecter) UpdateGeneratedProof(ctx interface{}, proof interface{}, dbTx interface{}) *StateInterfaceMock_UpdateGeneratedProof_Call { + return &StateInterfaceMock_UpdateGeneratedProof_Call{Call: _e.mock.On("UpdateGeneratedProof", ctx, proof, dbTx)} } -func (_c *stateInterfaceMock_UpdateGeneratedProof_Call) Run(run func(ctx context.Context, proof *state.Proof, dbTx pgx.Tx)) *stateInterfaceMock_UpdateGeneratedProof_Call { +func (_c *StateInterfaceMock_UpdateGeneratedProof_Call) Run(run func(ctx context.Context, proof *state.Proof, dbTx pgx.Tx)) *StateInterfaceMock_UpdateGeneratedProof_Call { _c.Call.Run(func(args mock.Arguments) { run(args[0].(context.Context), args[1].(*state.Proof), args[2].(pgx.Tx)) }) return _c } -func (_c *stateInterfaceMock_UpdateGeneratedProof_Call) Return(_a0 error) *stateInterfaceMock_UpdateGeneratedProof_Call { +func (_c *StateInterfaceMock_UpdateGeneratedProof_Call) Return(_a0 error) *StateInterfaceMock_UpdateGeneratedProof_Call { _c.Call.Return(_a0) return _c } -func (_c *stateInterfaceMock_UpdateGeneratedProof_Call) RunAndReturn(run func(context.Context, *state.Proof, pgx.Tx) error) *stateInterfaceMock_UpdateGeneratedProof_Call { +func (_c *StateInterfaceMock_UpdateGeneratedProof_Call) RunAndReturn(run func(context.Context, *state.Proof, pgx.Tx) error) *StateInterfaceMock_UpdateGeneratedProof_Call { _c.Call.Return(run) return _c } -// newStateInterfaceMock creates a new instance of stateInterfaceMock. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. +// NewStateInterfaceMock creates a new instance of StateInterfaceMock. 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 newStateInterfaceMock(t interface { +func NewStateInterfaceMock(t interface { mock.TestingT Cleanup(func()) -}) *stateInterfaceMock { - mock := &stateInterfaceMock{} +}) *StateInterfaceMock { + mock := &StateInterfaceMock{} mock.Mock.Test(t) t.Cleanup(func() { mock.AssertExpectations(t) }) diff --git a/aggregator/mocks/streamclient.generated.go b/aggregator/mocks/streamclient.generated.go new file mode 100644 index 00000000..ea0f8854 --- /dev/null +++ b/aggregator/mocks/streamclient.generated.go @@ -0,0 +1,584 @@ +// Code generated by mockery v2.45.1. DO NOT EDIT. + +package mocks + +import ( + datastreamer "github.com/0xPolygonHermez/zkevm-data-streamer/datastreamer" + mock "github.com/stretchr/testify/mock" +) + +// StreamClientMock is an autogenerated mock type for the StreamClient type +type StreamClientMock struct { + mock.Mock +} + +type StreamClientMock_Expecter struct { + mock *mock.Mock +} + +func (_m *StreamClientMock) EXPECT() *StreamClientMock_Expecter { + return &StreamClientMock_Expecter{mock: &_m.Mock} +} + +// ExecCommandGetBookmark provides a mock function with given fields: fromBookmark +func (_m *StreamClientMock) ExecCommandGetBookmark(fromBookmark []byte) (datastreamer.FileEntry, error) { + ret := _m.Called(fromBookmark) + + if len(ret) == 0 { + panic("no return value specified for ExecCommandGetBookmark") + } + + var r0 datastreamer.FileEntry + var r1 error + if rf, ok := ret.Get(0).(func([]byte) (datastreamer.FileEntry, error)); ok { + return rf(fromBookmark) + } + if rf, ok := ret.Get(0).(func([]byte) datastreamer.FileEntry); ok { + r0 = rf(fromBookmark) + } else { + r0 = ret.Get(0).(datastreamer.FileEntry) + } + + if rf, ok := ret.Get(1).(func([]byte) error); ok { + r1 = rf(fromBookmark) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// StreamClientMock_ExecCommandGetBookmark_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecCommandGetBookmark' +type StreamClientMock_ExecCommandGetBookmark_Call struct { + *mock.Call +} + +// ExecCommandGetBookmark is a helper method to define mock.On call +// - fromBookmark []byte +func (_e *StreamClientMock_Expecter) ExecCommandGetBookmark(fromBookmark interface{}) *StreamClientMock_ExecCommandGetBookmark_Call { + return &StreamClientMock_ExecCommandGetBookmark_Call{Call: _e.mock.On("ExecCommandGetBookmark", fromBookmark)} +} + +func (_c *StreamClientMock_ExecCommandGetBookmark_Call) Run(run func(fromBookmark []byte)) *StreamClientMock_ExecCommandGetBookmark_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]byte)) + }) + return _c +} + +func (_c *StreamClientMock_ExecCommandGetBookmark_Call) Return(_a0 datastreamer.FileEntry, _a1 error) *StreamClientMock_ExecCommandGetBookmark_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *StreamClientMock_ExecCommandGetBookmark_Call) RunAndReturn(run func([]byte) (datastreamer.FileEntry, error)) *StreamClientMock_ExecCommandGetBookmark_Call { + _c.Call.Return(run) + return _c +} + +// ExecCommandGetEntry provides a mock function with given fields: fromEntry +func (_m *StreamClientMock) ExecCommandGetEntry(fromEntry uint64) (datastreamer.FileEntry, error) { + ret := _m.Called(fromEntry) + + if len(ret) == 0 { + panic("no return value specified for ExecCommandGetEntry") + } + + var r0 datastreamer.FileEntry + var r1 error + if rf, ok := ret.Get(0).(func(uint64) (datastreamer.FileEntry, error)); ok { + return rf(fromEntry) + } + if rf, ok := ret.Get(0).(func(uint64) datastreamer.FileEntry); ok { + r0 = rf(fromEntry) + } else { + r0 = ret.Get(0).(datastreamer.FileEntry) + } + + if rf, ok := ret.Get(1).(func(uint64) error); ok { + r1 = rf(fromEntry) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// StreamClientMock_ExecCommandGetEntry_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecCommandGetEntry' +type StreamClientMock_ExecCommandGetEntry_Call struct { + *mock.Call +} + +// ExecCommandGetEntry is a helper method to define mock.On call +// - fromEntry uint64 +func (_e *StreamClientMock_Expecter) ExecCommandGetEntry(fromEntry interface{}) *StreamClientMock_ExecCommandGetEntry_Call { + return &StreamClientMock_ExecCommandGetEntry_Call{Call: _e.mock.On("ExecCommandGetEntry", fromEntry)} +} + +func (_c *StreamClientMock_ExecCommandGetEntry_Call) Run(run func(fromEntry uint64)) *StreamClientMock_ExecCommandGetEntry_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64)) + }) + return _c +} + +func (_c *StreamClientMock_ExecCommandGetEntry_Call) Return(_a0 datastreamer.FileEntry, _a1 error) *StreamClientMock_ExecCommandGetEntry_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *StreamClientMock_ExecCommandGetEntry_Call) RunAndReturn(run func(uint64) (datastreamer.FileEntry, error)) *StreamClientMock_ExecCommandGetEntry_Call { + _c.Call.Return(run) + return _c +} + +// ExecCommandGetHeader provides a mock function with given fields: +func (_m *StreamClientMock) ExecCommandGetHeader() (datastreamer.HeaderEntry, error) { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for ExecCommandGetHeader") + } + + var r0 datastreamer.HeaderEntry + var r1 error + if rf, ok := ret.Get(0).(func() (datastreamer.HeaderEntry, error)); ok { + return rf() + } + if rf, ok := ret.Get(0).(func() datastreamer.HeaderEntry); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(datastreamer.HeaderEntry) + } + + if rf, ok := ret.Get(1).(func() error); ok { + r1 = rf() + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// StreamClientMock_ExecCommandGetHeader_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecCommandGetHeader' +type StreamClientMock_ExecCommandGetHeader_Call struct { + *mock.Call +} + +// ExecCommandGetHeader is a helper method to define mock.On call +func (_e *StreamClientMock_Expecter) ExecCommandGetHeader() *StreamClientMock_ExecCommandGetHeader_Call { + return &StreamClientMock_ExecCommandGetHeader_Call{Call: _e.mock.On("ExecCommandGetHeader")} +} + +func (_c *StreamClientMock_ExecCommandGetHeader_Call) Run(run func()) *StreamClientMock_ExecCommandGetHeader_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *StreamClientMock_ExecCommandGetHeader_Call) Return(_a0 datastreamer.HeaderEntry, _a1 error) *StreamClientMock_ExecCommandGetHeader_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *StreamClientMock_ExecCommandGetHeader_Call) RunAndReturn(run func() (datastreamer.HeaderEntry, error)) *StreamClientMock_ExecCommandGetHeader_Call { + _c.Call.Return(run) + return _c +} + +// ExecCommandStart provides a mock function with given fields: fromEntry +func (_m *StreamClientMock) ExecCommandStart(fromEntry uint64) error { + ret := _m.Called(fromEntry) + + if len(ret) == 0 { + panic("no return value specified for ExecCommandStart") + } + + var r0 error + if rf, ok := ret.Get(0).(func(uint64) error); ok { + r0 = rf(fromEntry) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// StreamClientMock_ExecCommandStart_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecCommandStart' +type StreamClientMock_ExecCommandStart_Call struct { + *mock.Call +} + +// ExecCommandStart is a helper method to define mock.On call +// - fromEntry uint64 +func (_e *StreamClientMock_Expecter) ExecCommandStart(fromEntry interface{}) *StreamClientMock_ExecCommandStart_Call { + return &StreamClientMock_ExecCommandStart_Call{Call: _e.mock.On("ExecCommandStart", fromEntry)} +} + +func (_c *StreamClientMock_ExecCommandStart_Call) Run(run func(fromEntry uint64)) *StreamClientMock_ExecCommandStart_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(uint64)) + }) + return _c +} + +func (_c *StreamClientMock_ExecCommandStart_Call) Return(_a0 error) *StreamClientMock_ExecCommandStart_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *StreamClientMock_ExecCommandStart_Call) RunAndReturn(run func(uint64) error) *StreamClientMock_ExecCommandStart_Call { + _c.Call.Return(run) + return _c +} + +// ExecCommandStartBookmark provides a mock function with given fields: fromBookmark +func (_m *StreamClientMock) ExecCommandStartBookmark(fromBookmark []byte) error { + ret := _m.Called(fromBookmark) + + if len(ret) == 0 { + panic("no return value specified for ExecCommandStartBookmark") + } + + var r0 error + if rf, ok := ret.Get(0).(func([]byte) error); ok { + r0 = rf(fromBookmark) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// StreamClientMock_ExecCommandStartBookmark_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecCommandStartBookmark' +type StreamClientMock_ExecCommandStartBookmark_Call struct { + *mock.Call +} + +// ExecCommandStartBookmark is a helper method to define mock.On call +// - fromBookmark []byte +func (_e *StreamClientMock_Expecter) ExecCommandStartBookmark(fromBookmark interface{}) *StreamClientMock_ExecCommandStartBookmark_Call { + return &StreamClientMock_ExecCommandStartBookmark_Call{Call: _e.mock.On("ExecCommandStartBookmark", fromBookmark)} +} + +func (_c *StreamClientMock_ExecCommandStartBookmark_Call) Run(run func(fromBookmark []byte)) *StreamClientMock_ExecCommandStartBookmark_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].([]byte)) + }) + return _c +} + +func (_c *StreamClientMock_ExecCommandStartBookmark_Call) Return(_a0 error) *StreamClientMock_ExecCommandStartBookmark_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *StreamClientMock_ExecCommandStartBookmark_Call) RunAndReturn(run func([]byte) error) *StreamClientMock_ExecCommandStartBookmark_Call { + _c.Call.Return(run) + return _c +} + +// ExecCommandStop provides a mock function with given fields: +func (_m *StreamClientMock) ExecCommandStop() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for ExecCommandStop") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// StreamClientMock_ExecCommandStop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ExecCommandStop' +type StreamClientMock_ExecCommandStop_Call struct { + *mock.Call +} + +// ExecCommandStop is a helper method to define mock.On call +func (_e *StreamClientMock_Expecter) ExecCommandStop() *StreamClientMock_ExecCommandStop_Call { + return &StreamClientMock_ExecCommandStop_Call{Call: _e.mock.On("ExecCommandStop")} +} + +func (_c *StreamClientMock_ExecCommandStop_Call) Run(run func()) *StreamClientMock_ExecCommandStop_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *StreamClientMock_ExecCommandStop_Call) Return(_a0 error) *StreamClientMock_ExecCommandStop_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *StreamClientMock_ExecCommandStop_Call) RunAndReturn(run func() error) *StreamClientMock_ExecCommandStop_Call { + _c.Call.Return(run) + return _c +} + +// GetFromStream provides a mock function with given fields: +func (_m *StreamClientMock) GetFromStream() uint64 { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetFromStream") + } + + var r0 uint64 + if rf, ok := ret.Get(0).(func() uint64); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(uint64) + } + + return r0 +} + +// StreamClientMock_GetFromStream_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFromStream' +type StreamClientMock_GetFromStream_Call struct { + *mock.Call +} + +// GetFromStream is a helper method to define mock.On call +func (_e *StreamClientMock_Expecter) GetFromStream() *StreamClientMock_GetFromStream_Call { + return &StreamClientMock_GetFromStream_Call{Call: _e.mock.On("GetFromStream")} +} + +func (_c *StreamClientMock_GetFromStream_Call) Run(run func()) *StreamClientMock_GetFromStream_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *StreamClientMock_GetFromStream_Call) Return(_a0 uint64) *StreamClientMock_GetFromStream_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *StreamClientMock_GetFromStream_Call) RunAndReturn(run func() uint64) *StreamClientMock_GetFromStream_Call { + _c.Call.Return(run) + return _c +} + +// GetTotalEntries provides a mock function with given fields: +func (_m *StreamClientMock) GetTotalEntries() uint64 { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for GetTotalEntries") + } + + var r0 uint64 + if rf, ok := ret.Get(0).(func() uint64); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(uint64) + } + + return r0 +} + +// StreamClientMock_GetTotalEntries_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTotalEntries' +type StreamClientMock_GetTotalEntries_Call struct { + *mock.Call +} + +// GetTotalEntries is a helper method to define mock.On call +func (_e *StreamClientMock_Expecter) GetTotalEntries() *StreamClientMock_GetTotalEntries_Call { + return &StreamClientMock_GetTotalEntries_Call{Call: _e.mock.On("GetTotalEntries")} +} + +func (_c *StreamClientMock_GetTotalEntries_Call) Run(run func()) *StreamClientMock_GetTotalEntries_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *StreamClientMock_GetTotalEntries_Call) Return(_a0 uint64) *StreamClientMock_GetTotalEntries_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *StreamClientMock_GetTotalEntries_Call) RunAndReturn(run func() uint64) *StreamClientMock_GetTotalEntries_Call { + _c.Call.Return(run) + return _c +} + +// IsStarted provides a mock function with given fields: +func (_m *StreamClientMock) IsStarted() bool { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for IsStarted") + } + + var r0 bool + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// StreamClientMock_IsStarted_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsStarted' +type StreamClientMock_IsStarted_Call struct { + *mock.Call +} + +// IsStarted is a helper method to define mock.On call +func (_e *StreamClientMock_Expecter) IsStarted() *StreamClientMock_IsStarted_Call { + return &StreamClientMock_IsStarted_Call{Call: _e.mock.On("IsStarted")} +} + +func (_c *StreamClientMock_IsStarted_Call) Run(run func()) *StreamClientMock_IsStarted_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *StreamClientMock_IsStarted_Call) Return(_a0 bool) *StreamClientMock_IsStarted_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *StreamClientMock_IsStarted_Call) RunAndReturn(run func() bool) *StreamClientMock_IsStarted_Call { + _c.Call.Return(run) + return _c +} + +// ResetProcessEntryFunc provides a mock function with given fields: +func (_m *StreamClientMock) ResetProcessEntryFunc() { + _m.Called() +} + +// StreamClientMock_ResetProcessEntryFunc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ResetProcessEntryFunc' +type StreamClientMock_ResetProcessEntryFunc_Call struct { + *mock.Call +} + +// ResetProcessEntryFunc is a helper method to define mock.On call +func (_e *StreamClientMock_Expecter) ResetProcessEntryFunc() *StreamClientMock_ResetProcessEntryFunc_Call { + return &StreamClientMock_ResetProcessEntryFunc_Call{Call: _e.mock.On("ResetProcessEntryFunc")} +} + +func (_c *StreamClientMock_ResetProcessEntryFunc_Call) Run(run func()) *StreamClientMock_ResetProcessEntryFunc_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *StreamClientMock_ResetProcessEntryFunc_Call) Return() *StreamClientMock_ResetProcessEntryFunc_Call { + _c.Call.Return() + return _c +} + +func (_c *StreamClientMock_ResetProcessEntryFunc_Call) RunAndReturn(run func()) *StreamClientMock_ResetProcessEntryFunc_Call { + _c.Call.Return(run) + return _c +} + +// SetProcessEntryFunc provides a mock function with given fields: f +func (_m *StreamClientMock) SetProcessEntryFunc(f datastreamer.ProcessEntryFunc) { + _m.Called(f) +} + +// StreamClientMock_SetProcessEntryFunc_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetProcessEntryFunc' +type StreamClientMock_SetProcessEntryFunc_Call struct { + *mock.Call +} + +// SetProcessEntryFunc is a helper method to define mock.On call +// - f datastreamer.ProcessEntryFunc +func (_e *StreamClientMock_Expecter) SetProcessEntryFunc(f interface{}) *StreamClientMock_SetProcessEntryFunc_Call { + return &StreamClientMock_SetProcessEntryFunc_Call{Call: _e.mock.On("SetProcessEntryFunc", f)} +} + +func (_c *StreamClientMock_SetProcessEntryFunc_Call) Run(run func(f datastreamer.ProcessEntryFunc)) *StreamClientMock_SetProcessEntryFunc_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(datastreamer.ProcessEntryFunc)) + }) + return _c +} + +func (_c *StreamClientMock_SetProcessEntryFunc_Call) Return() *StreamClientMock_SetProcessEntryFunc_Call { + _c.Call.Return() + return _c +} + +func (_c *StreamClientMock_SetProcessEntryFunc_Call) RunAndReturn(run func(datastreamer.ProcessEntryFunc)) *StreamClientMock_SetProcessEntryFunc_Call { + _c.Call.Return(run) + return _c +} + +// Start provides a mock function with given fields: +func (_m *StreamClientMock) Start() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Start") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// StreamClientMock_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type StreamClientMock_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +func (_e *StreamClientMock_Expecter) Start() *StreamClientMock_Start_Call { + return &StreamClientMock_Start_Call{Call: _e.mock.On("Start")} +} + +func (_c *StreamClientMock_Start_Call) Run(run func()) *StreamClientMock_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *StreamClientMock_Start_Call) Return(_a0 error) *StreamClientMock_Start_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *StreamClientMock_Start_Call) RunAndReturn(run func() error) *StreamClientMock_Start_Call { + _c.Call.Return(run) + return _c +} + +// NewStreamClientMock creates a new instance of StreamClientMock. 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 NewStreamClientMock(t interface { + mock.TestingT + Cleanup(func()) +}) *StreamClientMock { + mock := &StreamClientMock{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/aggregator/mocks/synchronizerinterface.generated.go b/aggregator/mocks/synchronizerinterface.generated.go new file mode 100644 index 00000000..a25e0b3f --- /dev/null +++ b/aggregator/mocks/synchronizerinterface.generated.go @@ -0,0 +1,697 @@ +// Code generated by mockery v2.45.1. DO NOT EDIT. + +package mocks + +import ( + context "context" + + common "github.com/ethereum/go-ethereum/common" + + mock "github.com/stretchr/testify/mock" + + synchronizer "github.com/0xPolygonHermez/zkevm-synchronizer-l1/synchronizer" +) + +// SynchronizerInterfaceMock is an autogenerated mock type for the SynchronizerInterface type +type SynchronizerInterfaceMock struct { + mock.Mock +} + +type SynchronizerInterfaceMock_Expecter struct { + mock *mock.Mock +} + +func (_m *SynchronizerInterfaceMock) EXPECT() *SynchronizerInterfaceMock_Expecter { + return &SynchronizerInterfaceMock_Expecter{mock: &_m.Mock} +} + +// GetL1BlockByNumber provides a mock function with given fields: ctx, blockNumber +func (_m *SynchronizerInterfaceMock) GetL1BlockByNumber(ctx context.Context, blockNumber uint64) (*synchronizer.L1Block, error) { + ret := _m.Called(ctx, blockNumber) + + if len(ret) == 0 { + panic("no return value specified for GetL1BlockByNumber") + } + + var r0 *synchronizer.L1Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64) (*synchronizer.L1Block, error)); ok { + return rf(ctx, blockNumber) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64) *synchronizer.L1Block); ok { + r0 = rf(ctx, blockNumber) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*synchronizer.L1Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64) error); ok { + r1 = rf(ctx, blockNumber) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SynchronizerInterfaceMock_GetL1BlockByNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetL1BlockByNumber' +type SynchronizerInterfaceMock_GetL1BlockByNumber_Call struct { + *mock.Call +} + +// GetL1BlockByNumber is a helper method to define mock.On call +// - ctx context.Context +// - blockNumber uint64 +func (_e *SynchronizerInterfaceMock_Expecter) GetL1BlockByNumber(ctx interface{}, blockNumber interface{}) *SynchronizerInterfaceMock_GetL1BlockByNumber_Call { + return &SynchronizerInterfaceMock_GetL1BlockByNumber_Call{Call: _e.mock.On("GetL1BlockByNumber", ctx, blockNumber)} +} + +func (_c *SynchronizerInterfaceMock_GetL1BlockByNumber_Call) Run(run func(ctx context.Context, blockNumber uint64)) *SynchronizerInterfaceMock_GetL1BlockByNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64)) + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetL1BlockByNumber_Call) Return(_a0 *synchronizer.L1Block, _a1 error) *SynchronizerInterfaceMock_GetL1BlockByNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetL1BlockByNumber_Call) RunAndReturn(run func(context.Context, uint64) (*synchronizer.L1Block, error)) *SynchronizerInterfaceMock_GetL1BlockByNumber_Call { + _c.Call.Return(run) + return _c +} + +// GetL1InfoRootPerIndex provides a mock function with given fields: ctx, L1InfoTreeIndex +func (_m *SynchronizerInterfaceMock) GetL1InfoRootPerIndex(ctx context.Context, L1InfoTreeIndex uint32) (common.Hash, error) { + ret := _m.Called(ctx, L1InfoTreeIndex) + + if len(ret) == 0 { + panic("no return value specified for GetL1InfoRootPerIndex") + } + + var r0 common.Hash + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint32) (common.Hash, error)); ok { + return rf(ctx, L1InfoTreeIndex) + } + if rf, ok := ret.Get(0).(func(context.Context, uint32) common.Hash); ok { + r0 = rf(ctx, L1InfoTreeIndex) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(common.Hash) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint32) error); ok { + r1 = rf(ctx, L1InfoTreeIndex) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SynchronizerInterfaceMock_GetL1InfoRootPerIndex_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetL1InfoRootPerIndex' +type SynchronizerInterfaceMock_GetL1InfoRootPerIndex_Call struct { + *mock.Call +} + +// GetL1InfoRootPerIndex is a helper method to define mock.On call +// - ctx context.Context +// - L1InfoTreeIndex uint32 +func (_e *SynchronizerInterfaceMock_Expecter) GetL1InfoRootPerIndex(ctx interface{}, L1InfoTreeIndex interface{}) *SynchronizerInterfaceMock_GetL1InfoRootPerIndex_Call { + return &SynchronizerInterfaceMock_GetL1InfoRootPerIndex_Call{Call: _e.mock.On("GetL1InfoRootPerIndex", ctx, L1InfoTreeIndex)} +} + +func (_c *SynchronizerInterfaceMock_GetL1InfoRootPerIndex_Call) Run(run func(ctx context.Context, L1InfoTreeIndex uint32)) *SynchronizerInterfaceMock_GetL1InfoRootPerIndex_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint32)) + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetL1InfoRootPerIndex_Call) Return(_a0 common.Hash, _a1 error) *SynchronizerInterfaceMock_GetL1InfoRootPerIndex_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetL1InfoRootPerIndex_Call) RunAndReturn(run func(context.Context, uint32) (common.Hash, error)) *SynchronizerInterfaceMock_GetL1InfoRootPerIndex_Call { + _c.Call.Return(run) + return _c +} + +// GetL1InfoTreeLeaves provides a mock function with given fields: ctx, indexLeaves +func (_m *SynchronizerInterfaceMock) GetL1InfoTreeLeaves(ctx context.Context, indexLeaves []uint32) (map[uint32]synchronizer.L1InfoTreeLeaf, error) { + ret := _m.Called(ctx, indexLeaves) + + if len(ret) == 0 { + panic("no return value specified for GetL1InfoTreeLeaves") + } + + var r0 map[uint32]synchronizer.L1InfoTreeLeaf + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, []uint32) (map[uint32]synchronizer.L1InfoTreeLeaf, error)); ok { + return rf(ctx, indexLeaves) + } + if rf, ok := ret.Get(0).(func(context.Context, []uint32) map[uint32]synchronizer.L1InfoTreeLeaf); ok { + r0 = rf(ctx, indexLeaves) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[uint32]synchronizer.L1InfoTreeLeaf) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, []uint32) error); ok { + r1 = rf(ctx, indexLeaves) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SynchronizerInterfaceMock_GetL1InfoTreeLeaves_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetL1InfoTreeLeaves' +type SynchronizerInterfaceMock_GetL1InfoTreeLeaves_Call struct { + *mock.Call +} + +// GetL1InfoTreeLeaves is a helper method to define mock.On call +// - ctx context.Context +// - indexLeaves []uint32 +func (_e *SynchronizerInterfaceMock_Expecter) GetL1InfoTreeLeaves(ctx interface{}, indexLeaves interface{}) *SynchronizerInterfaceMock_GetL1InfoTreeLeaves_Call { + return &SynchronizerInterfaceMock_GetL1InfoTreeLeaves_Call{Call: _e.mock.On("GetL1InfoTreeLeaves", ctx, indexLeaves)} +} + +func (_c *SynchronizerInterfaceMock_GetL1InfoTreeLeaves_Call) Run(run func(ctx context.Context, indexLeaves []uint32)) *SynchronizerInterfaceMock_GetL1InfoTreeLeaves_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].([]uint32)) + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetL1InfoTreeLeaves_Call) Return(_a0 map[uint32]synchronizer.L1InfoTreeLeaf, _a1 error) *SynchronizerInterfaceMock_GetL1InfoTreeLeaves_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetL1InfoTreeLeaves_Call) RunAndReturn(run func(context.Context, []uint32) (map[uint32]synchronizer.L1InfoTreeLeaf, error)) *SynchronizerInterfaceMock_GetL1InfoTreeLeaves_Call { + _c.Call.Return(run) + return _c +} + +// GetLastL1Block provides a mock function with given fields: ctx +func (_m *SynchronizerInterfaceMock) GetLastL1Block(ctx context.Context) (*synchronizer.L1Block, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetLastL1Block") + } + + var r0 *synchronizer.L1Block + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*synchronizer.L1Block, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) *synchronizer.L1Block); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*synchronizer.L1Block) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SynchronizerInterfaceMock_GetLastL1Block_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLastL1Block' +type SynchronizerInterfaceMock_GetLastL1Block_Call struct { + *mock.Call +} + +// GetLastL1Block is a helper method to define mock.On call +// - ctx context.Context +func (_e *SynchronizerInterfaceMock_Expecter) GetLastL1Block(ctx interface{}) *SynchronizerInterfaceMock_GetLastL1Block_Call { + return &SynchronizerInterfaceMock_GetLastL1Block_Call{Call: _e.mock.On("GetLastL1Block", ctx)} +} + +func (_c *SynchronizerInterfaceMock_GetLastL1Block_Call) Run(run func(ctx context.Context)) *SynchronizerInterfaceMock_GetLastL1Block_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetLastL1Block_Call) Return(_a0 *synchronizer.L1Block, _a1 error) *SynchronizerInterfaceMock_GetLastL1Block_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetLastL1Block_Call) RunAndReturn(run func(context.Context) (*synchronizer.L1Block, error)) *SynchronizerInterfaceMock_GetLastL1Block_Call { + _c.Call.Return(run) + return _c +} + +// GetLastestVirtualBatchNumber provides a mock function with given fields: ctx +func (_m *SynchronizerInterfaceMock) GetLastestVirtualBatchNumber(ctx context.Context) (uint64, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetLastestVirtualBatchNumber") + } + + var r0 uint64 + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (uint64, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) uint64); ok { + r0 = rf(ctx) + } else { + r0 = ret.Get(0).(uint64) + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SynchronizerInterfaceMock_GetLastestVirtualBatchNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLastestVirtualBatchNumber' +type SynchronizerInterfaceMock_GetLastestVirtualBatchNumber_Call struct { + *mock.Call +} + +// GetLastestVirtualBatchNumber is a helper method to define mock.On call +// - ctx context.Context +func (_e *SynchronizerInterfaceMock_Expecter) GetLastestVirtualBatchNumber(ctx interface{}) *SynchronizerInterfaceMock_GetLastestVirtualBatchNumber_Call { + return &SynchronizerInterfaceMock_GetLastestVirtualBatchNumber_Call{Call: _e.mock.On("GetLastestVirtualBatchNumber", ctx)} +} + +func (_c *SynchronizerInterfaceMock_GetLastestVirtualBatchNumber_Call) Run(run func(ctx context.Context)) *SynchronizerInterfaceMock_GetLastestVirtualBatchNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetLastestVirtualBatchNumber_Call) Return(_a0 uint64, _a1 error) *SynchronizerInterfaceMock_GetLastestVirtualBatchNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetLastestVirtualBatchNumber_Call) RunAndReturn(run func(context.Context) (uint64, error)) *SynchronizerInterfaceMock_GetLastestVirtualBatchNumber_Call { + _c.Call.Return(run) + return _c +} + +// GetLeafsByL1InfoRoot provides a mock function with given fields: ctx, l1InfoRoot +func (_m *SynchronizerInterfaceMock) GetLeafsByL1InfoRoot(ctx context.Context, l1InfoRoot common.Hash) ([]synchronizer.L1InfoTreeLeaf, error) { + ret := _m.Called(ctx, l1InfoRoot) + + if len(ret) == 0 { + panic("no return value specified for GetLeafsByL1InfoRoot") + } + + var r0 []synchronizer.L1InfoTreeLeaf + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, common.Hash) ([]synchronizer.L1InfoTreeLeaf, error)); ok { + return rf(ctx, l1InfoRoot) + } + if rf, ok := ret.Get(0).(func(context.Context, common.Hash) []synchronizer.L1InfoTreeLeaf); ok { + r0 = rf(ctx, l1InfoRoot) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]synchronizer.L1InfoTreeLeaf) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, common.Hash) error); ok { + r1 = rf(ctx, l1InfoRoot) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SynchronizerInterfaceMock_GetLeafsByL1InfoRoot_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetLeafsByL1InfoRoot' +type SynchronizerInterfaceMock_GetLeafsByL1InfoRoot_Call struct { + *mock.Call +} + +// GetLeafsByL1InfoRoot is a helper method to define mock.On call +// - ctx context.Context +// - l1InfoRoot common.Hash +func (_e *SynchronizerInterfaceMock_Expecter) GetLeafsByL1InfoRoot(ctx interface{}, l1InfoRoot interface{}) *SynchronizerInterfaceMock_GetLeafsByL1InfoRoot_Call { + return &SynchronizerInterfaceMock_GetLeafsByL1InfoRoot_Call{Call: _e.mock.On("GetLeafsByL1InfoRoot", ctx, l1InfoRoot)} +} + +func (_c *SynchronizerInterfaceMock_GetLeafsByL1InfoRoot_Call) Run(run func(ctx context.Context, l1InfoRoot common.Hash)) *SynchronizerInterfaceMock_GetLeafsByL1InfoRoot_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(common.Hash)) + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetLeafsByL1InfoRoot_Call) Return(_a0 []synchronizer.L1InfoTreeLeaf, _a1 error) *SynchronizerInterfaceMock_GetLeafsByL1InfoRoot_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetLeafsByL1InfoRoot_Call) RunAndReturn(run func(context.Context, common.Hash) ([]synchronizer.L1InfoTreeLeaf, error)) *SynchronizerInterfaceMock_GetLeafsByL1InfoRoot_Call { + _c.Call.Return(run) + return _c +} + +// GetSequenceByBatchNumber provides a mock function with given fields: ctx, batchNumber +func (_m *SynchronizerInterfaceMock) GetSequenceByBatchNumber(ctx context.Context, batchNumber uint64) (*synchronizer.SequencedBatches, error) { + ret := _m.Called(ctx, batchNumber) + + if len(ret) == 0 { + panic("no return value specified for GetSequenceByBatchNumber") + } + + var r0 *synchronizer.SequencedBatches + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64) (*synchronizer.SequencedBatches, error)); ok { + return rf(ctx, batchNumber) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64) *synchronizer.SequencedBatches); ok { + r0 = rf(ctx, batchNumber) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*synchronizer.SequencedBatches) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64) error); ok { + r1 = rf(ctx, batchNumber) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SynchronizerInterfaceMock_GetSequenceByBatchNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetSequenceByBatchNumber' +type SynchronizerInterfaceMock_GetSequenceByBatchNumber_Call struct { + *mock.Call +} + +// GetSequenceByBatchNumber is a helper method to define mock.On call +// - ctx context.Context +// - batchNumber uint64 +func (_e *SynchronizerInterfaceMock_Expecter) GetSequenceByBatchNumber(ctx interface{}, batchNumber interface{}) *SynchronizerInterfaceMock_GetSequenceByBatchNumber_Call { + return &SynchronizerInterfaceMock_GetSequenceByBatchNumber_Call{Call: _e.mock.On("GetSequenceByBatchNumber", ctx, batchNumber)} +} + +func (_c *SynchronizerInterfaceMock_GetSequenceByBatchNumber_Call) Run(run func(ctx context.Context, batchNumber uint64)) *SynchronizerInterfaceMock_GetSequenceByBatchNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64)) + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetSequenceByBatchNumber_Call) Return(_a0 *synchronizer.SequencedBatches, _a1 error) *SynchronizerInterfaceMock_GetSequenceByBatchNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetSequenceByBatchNumber_Call) RunAndReturn(run func(context.Context, uint64) (*synchronizer.SequencedBatches, error)) *SynchronizerInterfaceMock_GetSequenceByBatchNumber_Call { + _c.Call.Return(run) + return _c +} + +// GetVirtualBatchByBatchNumber provides a mock function with given fields: ctx, batchNumber +func (_m *SynchronizerInterfaceMock) GetVirtualBatchByBatchNumber(ctx context.Context, batchNumber uint64) (*synchronizer.VirtualBatch, error) { + ret := _m.Called(ctx, batchNumber) + + if len(ret) == 0 { + panic("no return value specified for GetVirtualBatchByBatchNumber") + } + + var r0 *synchronizer.VirtualBatch + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, uint64) (*synchronizer.VirtualBatch, error)); ok { + return rf(ctx, batchNumber) + } + if rf, ok := ret.Get(0).(func(context.Context, uint64) *synchronizer.VirtualBatch); ok { + r0 = rf(ctx, batchNumber) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*synchronizer.VirtualBatch) + } + } + + if rf, ok := ret.Get(1).(func(context.Context, uint64) error); ok { + r1 = rf(ctx, batchNumber) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// SynchronizerInterfaceMock_GetVirtualBatchByBatchNumber_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetVirtualBatchByBatchNumber' +type SynchronizerInterfaceMock_GetVirtualBatchByBatchNumber_Call struct { + *mock.Call +} + +// GetVirtualBatchByBatchNumber is a helper method to define mock.On call +// - ctx context.Context +// - batchNumber uint64 +func (_e *SynchronizerInterfaceMock_Expecter) GetVirtualBatchByBatchNumber(ctx interface{}, batchNumber interface{}) *SynchronizerInterfaceMock_GetVirtualBatchByBatchNumber_Call { + return &SynchronizerInterfaceMock_GetVirtualBatchByBatchNumber_Call{Call: _e.mock.On("GetVirtualBatchByBatchNumber", ctx, batchNumber)} +} + +func (_c *SynchronizerInterfaceMock_GetVirtualBatchByBatchNumber_Call) Run(run func(ctx context.Context, batchNumber uint64)) *SynchronizerInterfaceMock_GetVirtualBatchByBatchNumber_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(uint64)) + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetVirtualBatchByBatchNumber_Call) Return(_a0 *synchronizer.VirtualBatch, _a1 error) *SynchronizerInterfaceMock_GetVirtualBatchByBatchNumber_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *SynchronizerInterfaceMock_GetVirtualBatchByBatchNumber_Call) RunAndReturn(run func(context.Context, uint64) (*synchronizer.VirtualBatch, error)) *SynchronizerInterfaceMock_GetVirtualBatchByBatchNumber_Call { + _c.Call.Return(run) + return _c +} + +// IsSynced provides a mock function with given fields: +func (_m *SynchronizerInterfaceMock) IsSynced() bool { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for IsSynced") + } + + var r0 bool + if rf, ok := ret.Get(0).(func() bool); ok { + r0 = rf() + } else { + r0 = ret.Get(0).(bool) + } + + return r0 +} + +// SynchronizerInterfaceMock_IsSynced_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'IsSynced' +type SynchronizerInterfaceMock_IsSynced_Call struct { + *mock.Call +} + +// IsSynced is a helper method to define mock.On call +func (_e *SynchronizerInterfaceMock_Expecter) IsSynced() *SynchronizerInterfaceMock_IsSynced_Call { + return &SynchronizerInterfaceMock_IsSynced_Call{Call: _e.mock.On("IsSynced")} +} + +func (_c *SynchronizerInterfaceMock_IsSynced_Call) Run(run func()) *SynchronizerInterfaceMock_IsSynced_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_IsSynced_Call) Return(_a0 bool) *SynchronizerInterfaceMock_IsSynced_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SynchronizerInterfaceMock_IsSynced_Call) RunAndReturn(run func() bool) *SynchronizerInterfaceMock_IsSynced_Call { + _c.Call.Return(run) + return _c +} + +// SetCallbackOnReorgDone provides a mock function with given fields: callback +func (_m *SynchronizerInterfaceMock) SetCallbackOnReorgDone(callback func(synchronizer.ReorgExecutionResult)) { + _m.Called(callback) +} + +// SynchronizerInterfaceMock_SetCallbackOnReorgDone_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetCallbackOnReorgDone' +type SynchronizerInterfaceMock_SetCallbackOnReorgDone_Call struct { + *mock.Call +} + +// SetCallbackOnReorgDone is a helper method to define mock.On call +// - callback func(synchronizer.ReorgExecutionResult) +func (_e *SynchronizerInterfaceMock_Expecter) SetCallbackOnReorgDone(callback interface{}) *SynchronizerInterfaceMock_SetCallbackOnReorgDone_Call { + return &SynchronizerInterfaceMock_SetCallbackOnReorgDone_Call{Call: _e.mock.On("SetCallbackOnReorgDone", callback)} +} + +func (_c *SynchronizerInterfaceMock_SetCallbackOnReorgDone_Call) Run(run func(callback func(synchronizer.ReorgExecutionResult))) *SynchronizerInterfaceMock_SetCallbackOnReorgDone_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(func(synchronizer.ReorgExecutionResult))) + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_SetCallbackOnReorgDone_Call) Return() *SynchronizerInterfaceMock_SetCallbackOnReorgDone_Call { + _c.Call.Return() + return _c +} + +func (_c *SynchronizerInterfaceMock_SetCallbackOnReorgDone_Call) RunAndReturn(run func(func(synchronizer.ReorgExecutionResult))) *SynchronizerInterfaceMock_SetCallbackOnReorgDone_Call { + _c.Call.Return(run) + return _c +} + +// SetCallbackOnRollbackBatches provides a mock function with given fields: callback +func (_m *SynchronizerInterfaceMock) SetCallbackOnRollbackBatches(callback func(synchronizer.RollbackBatchesData)) { + _m.Called(callback) +} + +// SynchronizerInterfaceMock_SetCallbackOnRollbackBatches_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SetCallbackOnRollbackBatches' +type SynchronizerInterfaceMock_SetCallbackOnRollbackBatches_Call struct { + *mock.Call +} + +// SetCallbackOnRollbackBatches is a helper method to define mock.On call +// - callback func(synchronizer.RollbackBatchesData) +func (_e *SynchronizerInterfaceMock_Expecter) SetCallbackOnRollbackBatches(callback interface{}) *SynchronizerInterfaceMock_SetCallbackOnRollbackBatches_Call { + return &SynchronizerInterfaceMock_SetCallbackOnRollbackBatches_Call{Call: _e.mock.On("SetCallbackOnRollbackBatches", callback)} +} + +func (_c *SynchronizerInterfaceMock_SetCallbackOnRollbackBatches_Call) Run(run func(callback func(synchronizer.RollbackBatchesData))) *SynchronizerInterfaceMock_SetCallbackOnRollbackBatches_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(func(synchronizer.RollbackBatchesData))) + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_SetCallbackOnRollbackBatches_Call) Return() *SynchronizerInterfaceMock_SetCallbackOnRollbackBatches_Call { + _c.Call.Return() + return _c +} + +func (_c *SynchronizerInterfaceMock_SetCallbackOnRollbackBatches_Call) RunAndReturn(run func(func(synchronizer.RollbackBatchesData))) *SynchronizerInterfaceMock_SetCallbackOnRollbackBatches_Call { + _c.Call.Return(run) + return _c +} + +// Stop provides a mock function with given fields: +func (_m *SynchronizerInterfaceMock) Stop() { + _m.Called() +} + +// SynchronizerInterfaceMock_Stop_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Stop' +type SynchronizerInterfaceMock_Stop_Call struct { + *mock.Call +} + +// Stop is a helper method to define mock.On call +func (_e *SynchronizerInterfaceMock_Expecter) Stop() *SynchronizerInterfaceMock_Stop_Call { + return &SynchronizerInterfaceMock_Stop_Call{Call: _e.mock.On("Stop")} +} + +func (_c *SynchronizerInterfaceMock_Stop_Call) Run(run func()) *SynchronizerInterfaceMock_Stop_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_Stop_Call) Return() *SynchronizerInterfaceMock_Stop_Call { + _c.Call.Return() + return _c +} + +func (_c *SynchronizerInterfaceMock_Stop_Call) RunAndReturn(run func()) *SynchronizerInterfaceMock_Stop_Call { + _c.Call.Return(run) + return _c +} + +// Sync provides a mock function with given fields: returnOnSync +func (_m *SynchronizerInterfaceMock) Sync(returnOnSync bool) error { + ret := _m.Called(returnOnSync) + + if len(ret) == 0 { + panic("no return value specified for Sync") + } + + var r0 error + if rf, ok := ret.Get(0).(func(bool) error); ok { + r0 = rf(returnOnSync) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// SynchronizerInterfaceMock_Sync_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Sync' +type SynchronizerInterfaceMock_Sync_Call struct { + *mock.Call +} + +// Sync is a helper method to define mock.On call +// - returnOnSync bool +func (_e *SynchronizerInterfaceMock_Expecter) Sync(returnOnSync interface{}) *SynchronizerInterfaceMock_Sync_Call { + return &SynchronizerInterfaceMock_Sync_Call{Call: _e.mock.On("Sync", returnOnSync)} +} + +func (_c *SynchronizerInterfaceMock_Sync_Call) Run(run func(returnOnSync bool)) *SynchronizerInterfaceMock_Sync_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(bool)) + }) + return _c +} + +func (_c *SynchronizerInterfaceMock_Sync_Call) Return(_a0 error) *SynchronizerInterfaceMock_Sync_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *SynchronizerInterfaceMock_Sync_Call) RunAndReturn(run func(bool) error) *SynchronizerInterfaceMock_Sync_Call { + _c.Call.Return(run) + return _c +} + +// NewSynchronizerInterfaceMock creates a new instance of SynchronizerInterfaceMock. 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 NewSynchronizerInterfaceMock(t interface { + mock.TestingT + Cleanup(func()) +}) *SynchronizerInterfaceMock { + mock := &SynchronizerInterfaceMock{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +}