From df4b28dee9c4a3c40a242c7533b51564260767b7 Mon Sep 17 00:00:00 2001 From: Mateusz Sekara Date: Thu, 28 Sep 2023 14:08:14 +0200 Subject: [PATCH] Post review fixes --- .../evm/client/simulated_backend_client.go | 48 ++++++------- core/chains/evm/logpoller/log_poller.go | 24 +++---- .../evm/logpoller/log_poller_internal_test.go | 2 +- core/chains/evm/logpoller/mocks/log_poller.go | 72 +++++++++---------- 4 files changed, 71 insertions(+), 75 deletions(-) diff --git a/core/chains/evm/client/simulated_backend_client.go b/core/chains/evm/client/simulated_backend_client.go index ae39dd1a8cd..2727f7c3125 100644 --- a/core/chains/evm/client/simulated_backend_client.go +++ b/core/chains/evm/client/simulated_backend_client.go @@ -15,7 +15,6 @@ import ( "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" - "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rpc" @@ -26,12 +25,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/utils" ) -var blockByTag = map[string]func(*core.BlockChain) *types.Header{ - rpc.SafeBlockNumber.String(): func(chain *core.BlockChain) *types.Header { return chain.CurrentSafeBlock() }, - rpc.LatestBlockNumber.String(): func(chain *core.BlockChain) *types.Header { return chain.CurrentHeader() }, - rpc.FinalizedBlockNumber.String(): func(chain *core.BlockChain) *types.Header { return chain.CurrentFinalBlock() }, -} - // SimulatedBackendClient is an Client implementation using a simulated // blockchain backend. Note that not all RPC methods are implemented here. type SimulatedBackendClient struct { @@ -560,31 +553,17 @@ func (c *SimulatedBackendClient) BatchCallContext(ctx context.Context, b []rpc.B if !is { return fmt.Errorf("SimulatedBackendClient expected second arg to be a boolean for eth_getBlockByNumber, got: %T", elem.Args[1]) } - - var header *types.Header - var err error - if blockFn, contains := blockByTag[blockNumOrTag]; contains { - header, err = blockFn(c.b.Blockchain()), nil - } else { - blockNum, ok := new(big.Int).SetString(blockNumOrTag, 0) - if !ok { - return fmt.Errorf("error while converting block number string: %s to big.Int ", blockNumOrTag) - } - header, err = c.b.HeaderByNumber(ctx, blockNum) - } + header, err := c.fetchHeader(ctx, blockNumOrTag) if err != nil { return err } - - if res, ok := elem.Result.(*evmtypes.Head); ok { + switch res := elem.Result.(type) { + case *evmtypes.Head: + case *evmtypes.Block: res.Number = header.Number.Int64() res.Hash = header.Hash() res.Timestamp = time.Unix(int64(header.Time), 0).UTC() - } else if res, ok := elem.Result.(*evmtypes.Block); ok { - res.Number = header.Number.Int64() - res.Hash = header.Hash() - res.Timestamp = time.Unix(int64(header.Time), 0) - } else { + default: return fmt.Errorf("SimulatedBackendClient Unexpected Type %T", elem.Result) } b[i].Error = err @@ -727,3 +706,20 @@ func toCallMsg(params map[string]interface{}) ethereum.CallMsg { func (c *SimulatedBackendClient) IsL2() bool { return false } + +func (c *SimulatedBackendClient) fetchHeader(ctx context.Context, blockNumOrTag string) (*types.Header, error) { + switch blockNumOrTag { + case rpc.SafeBlockNumber.String(): + return c.b.Blockchain().CurrentSafeBlock(), nil + case rpc.LatestBlockNumber.String(): + return c.b.Blockchain().CurrentBlock(), nil + case rpc.FinalizedBlockNumber.String(): + return c.b.Blockchain().CurrentFinalBlock(), nil + default: + blockNum, ok := new(big.Int).SetString(blockNumOrTag, 0) + if !ok { + return nil, fmt.Errorf("error while converting block number string: %s to big.Int ", blockNumOrTag) + } + return c.b.HeaderByNumber(ctx, blockNum) + } +} diff --git a/core/chains/evm/logpoller/log_poller.go b/core/chains/evm/logpoller/log_poller.go index 698df471f05..2db434453bd 100644 --- a/core/chains/evm/logpoller/log_poller.go +++ b/core/chains/evm/logpoller/log_poller.go @@ -982,12 +982,12 @@ func (lp *logPoller) LogsWithSigs(start, end int64, eventSigs []common.Hash, add } func (lp *logPoller) LogsCreatedAfter(eventSig common.Hash, address common.Address, after time.Time, confs Confirmations, qopts ...pg.QOpt) ([]Log, error) { - return lp.orm.SelectLogsCreatedAfter(address, eventSig, after, lp.confirmations(confs), qopts...) + return lp.orm.SelectLogsCreatedAfter(address, eventSig, after, lp.confirmationsToInt(confs), qopts...) } // IndexedLogs finds all the logs that have a topic value in topicValues at index topicIndex. func (lp *logPoller) IndexedLogs(eventSig common.Hash, address common.Address, topicIndex int, topicValues []common.Hash, confs Confirmations, qopts ...pg.QOpt) ([]Log, error) { - return lp.orm.SelectIndexedLogs(address, eventSig, topicIndex, topicValues, lp.confirmations(confs), qopts...) + return lp.orm.SelectIndexedLogs(address, eventSig, topicIndex, topicValues, lp.confirmationsToInt(confs), qopts...) } // IndexedLogsByBlockRange finds all the logs that have a topic value in topicValues at index topicIndex within the block range @@ -996,7 +996,7 @@ func (lp *logPoller) IndexedLogsByBlockRange(start, end int64, eventSig common.H } func (lp *logPoller) IndexedLogsCreatedAfter(eventSig common.Hash, address common.Address, topicIndex int, topicValues []common.Hash, after time.Time, confs Confirmations, qopts ...pg.QOpt) ([]Log, error) { - return lp.orm.SelectIndexedLogsCreatedAfter(address, eventSig, topicIndex, topicValues, after, lp.confirmations(confs), qopts...) + return lp.orm.SelectIndexedLogsCreatedAfter(address, eventSig, topicIndex, topicValues, after, lp.confirmationsToInt(confs), qopts...) } func (lp *logPoller) IndexedLogsByTxHash(eventSig common.Hash, txHash common.Hash, qopts ...pg.QOpt) ([]Log, error) { @@ -1005,22 +1005,22 @@ func (lp *logPoller) IndexedLogsByTxHash(eventSig common.Hash, txHash common.Has // LogsDataWordGreaterThan note index is 0 based. func (lp *logPoller) LogsDataWordGreaterThan(eventSig common.Hash, address common.Address, wordIndex int, wordValueMin common.Hash, confs Confirmations, qopts ...pg.QOpt) ([]Log, error) { - return lp.orm.SelectDataWordGreaterThan(address, eventSig, wordIndex, wordValueMin, lp.confirmations(confs), qopts...) + return lp.orm.SelectDataWordGreaterThan(address, eventSig, wordIndex, wordValueMin, lp.confirmationsToInt(confs), qopts...) } // LogsDataWordRange note index is 0 based. func (lp *logPoller) LogsDataWordRange(eventSig common.Hash, address common.Address, wordIndex int, wordValueMin, wordValueMax common.Hash, confs Confirmations, qopts ...pg.QOpt) ([]Log, error) { - return lp.orm.SelectDataWordRange(address, eventSig, wordIndex, wordValueMin, wordValueMax, lp.confirmations(confs), qopts...) + return lp.orm.SelectDataWordRange(address, eventSig, wordIndex, wordValueMin, wordValueMax, lp.confirmationsToInt(confs), qopts...) } // IndexedLogsTopicGreaterThan finds all the logs that have a topic value greater than topicValueMin at index topicIndex. // Only works for integer topics. func (lp *logPoller) IndexedLogsTopicGreaterThan(eventSig common.Hash, address common.Address, topicIndex int, topicValueMin common.Hash, confs Confirmations, qopts ...pg.QOpt) ([]Log, error) { - return lp.orm.SelectIndexLogsTopicGreaterThan(address, eventSig, topicIndex, topicValueMin, lp.confirmations(confs), qopts...) + return lp.orm.SelectIndexLogsTopicGreaterThan(address, eventSig, topicIndex, topicValueMin, lp.confirmationsToInt(confs), qopts...) } func (lp *logPoller) IndexedLogsTopicRange(eventSig common.Hash, address common.Address, topicIndex int, topicValueMin common.Hash, topicValueMax common.Hash, confs Confirmations, qopts ...pg.QOpt) ([]Log, error) { - return lp.orm.SelectIndexLogsTopicRange(address, eventSig, topicIndex, topicValueMin, topicValueMax, lp.confirmations(confs), qopts...) + return lp.orm.SelectIndexLogsTopicRange(address, eventSig, topicIndex, topicValueMin, topicValueMax, lp.confirmationsToInt(confs), qopts...) } // LatestBlock returns the latest block the log poller is on. It tracks blocks to be able @@ -1040,15 +1040,15 @@ func (lp *logPoller) BlockByNumber(n int64, qopts ...pg.QOpt) (*LogPollerBlock, // LatestLogByEventSigWithConfs finds the latest log that has confs number of blocks on top of the log. func (lp *logPoller) LatestLogByEventSigWithConfs(eventSig common.Hash, address common.Address, confs Confirmations, qopts ...pg.QOpt) (*Log, error) { - return lp.orm.SelectLatestLogEventSigWithConfs(eventSig, address, lp.confirmations(confs), qopts...) + return lp.orm.SelectLatestLogEventSigWithConfs(eventSig, address, lp.confirmationsToInt(confs), qopts...) } func (lp *logPoller) LatestLogEventSigsAddrsWithConfs(fromBlock int64, eventSigs []common.Hash, addresses []common.Address, confs Confirmations, qopts ...pg.QOpt) ([]Log, error) { - return lp.orm.SelectLatestLogEventSigsAddrsWithConfs(fromBlock, addresses, eventSigs, lp.confirmations(confs), qopts...) + return lp.orm.SelectLatestLogEventSigsAddrsWithConfs(fromBlock, addresses, eventSigs, lp.confirmationsToInt(confs), qopts...) } func (lp *logPoller) LatestBlockByEventSigsAddrsWithConfs(fromBlock int64, eventSigs []common.Hash, addresses []common.Address, confs Confirmations, qopts ...pg.QOpt) (int64, error) { - return lp.orm.SelectLatestBlockNumberEventSigsAddrsWithConfs(fromBlock, eventSigs, addresses, lp.confirmations(confs), qopts...) + return lp.orm.SelectLatestBlockNumberEventSigsAddrsWithConfs(fromBlock, eventSigs, addresses, lp.confirmationsToInt(confs), qopts...) } // GetBlocksRange tries to get the specified block numbers from the log pollers @@ -1204,7 +1204,7 @@ func (lp *logPoller) batchFetchBlocks(ctx context.Context, blocksRequested []str // For example, query to retrieve unfulfilled requests by querying request log events without matching fulfillment log events. // The order of events is not significant. Both logs must be inside the block range and have the minimum number of confirmations func (lp *logPoller) IndexedLogsWithSigsExcluding(address common.Address, eventSigA, eventSigB common.Hash, topicIndex int, fromBlock, toBlock int64, confs Confirmations, qopts ...pg.QOpt) ([]Log, error) { - return lp.orm.SelectIndexedLogsWithSigsExcluding(eventSigA, eventSigB, topicIndex, address, fromBlock, toBlock, lp.confirmations(confs), qopts...) + return lp.orm.SelectIndexedLogsWithSigsExcluding(eventSigA, eventSigB, topicIndex, address, fromBlock, toBlock, lp.confirmationsToInt(confs), qopts...) } func EvmWord(i uint64) common.Hash { @@ -1213,7 +1213,7 @@ func EvmWord(i uint64) common.Hash { return common.BytesToHash(b) } -func (lp *logPoller) confirmations(confs Confirmations) int { +func (lp *logPoller) confirmationsToInt(confs Confirmations) int { if confs == Finalized { return int(lp.getFinalityDepth()) } diff --git a/core/chains/evm/logpoller/log_poller_internal_test.go b/core/chains/evm/logpoller/log_poller_internal_test.go index 3933a40a54a..6b6eec300ca 100644 --- a/core/chains/evm/logpoller/log_poller_internal_test.go +++ b/core/chains/evm/logpoller/log_poller_internal_test.go @@ -558,7 +558,7 @@ func Test_confirmations(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { lp := NewLogPoller(orm, ec, lggr, time.Hour, false, int64(finalityDepth), 3, 3, 20) - require.Equal(t, tt.wantConfs, lp.confirmations(tt.confs)) + require.Equal(t, tt.wantConfs, lp.confirmationsToInt(tt.confs)) }) } } diff --git a/core/chains/evm/logpoller/mocks/log_poller.go b/core/chains/evm/logpoller/mocks/log_poller.go index 1f38b88fb68..287c27bb0a0 100644 --- a/core/chains/evm/logpoller/mocks/log_poller.go +++ b/core/chains/evm/logpoller/mocks/log_poller.go @@ -111,10 +111,10 @@ func (_m *LogPoller) IndexedLogs(eventSig common.Hash, address common.Address, t var r0 []logpoller.Log var r1 error - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, []common.Hash, int, ...pg.QOpt) ([]logpoller.Log, error)); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, []common.Hash, logpoller.Confirmations, ...pg.QOpt) ([]logpoller.Log, error)); ok { return rf(eventSig, address, topicIndex, topicValues, confs, qopts...) } - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, []common.Hash, int, ...pg.QOpt) []logpoller.Log); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, []common.Hash, logpoller.Confirmations, ...pg.QOpt) []logpoller.Log); ok { r0 = rf(eventSig, address, topicIndex, topicValues, confs, qopts...) } else { if ret.Get(0) != nil { @@ -122,7 +122,7 @@ func (_m *LogPoller) IndexedLogs(eventSig common.Hash, address common.Address, t } } - if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, []common.Hash, int, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, []common.Hash, logpoller.Confirmations, ...pg.QOpt) error); ok { r1 = rf(eventSig, address, topicIndex, topicValues, confs, qopts...) } else { r1 = ret.Error(1) @@ -210,10 +210,10 @@ func (_m *LogPoller) IndexedLogsCreatedAfter(eventSig common.Hash, address commo var r0 []logpoller.Log var r1 error - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, []common.Hash, time.Time, int, ...pg.QOpt) ([]logpoller.Log, error)); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, []common.Hash, time.Time, logpoller.Confirmations, ...pg.QOpt) ([]logpoller.Log, error)); ok { return rf(eventSig, address, topicIndex, topicValues, after, confs, qopts...) } - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, []common.Hash, time.Time, int, ...pg.QOpt) []logpoller.Log); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, []common.Hash, time.Time, logpoller.Confirmations, ...pg.QOpt) []logpoller.Log); ok { r0 = rf(eventSig, address, topicIndex, topicValues, after, confs, qopts...) } else { if ret.Get(0) != nil { @@ -221,7 +221,7 @@ func (_m *LogPoller) IndexedLogsCreatedAfter(eventSig common.Hash, address commo } } - if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, []common.Hash, time.Time, int, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, []common.Hash, time.Time, logpoller.Confirmations, ...pg.QOpt) error); ok { r1 = rf(eventSig, address, topicIndex, topicValues, after, confs, qopts...) } else { r1 = ret.Error(1) @@ -243,10 +243,10 @@ func (_m *LogPoller) IndexedLogsTopicGreaterThan(eventSig common.Hash, address c var r0 []logpoller.Log var r1 error - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, int, ...pg.QOpt) ([]logpoller.Log, error)); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, logpoller.Confirmations, ...pg.QOpt) ([]logpoller.Log, error)); ok { return rf(eventSig, address, topicIndex, topicValueMin, confs, qopts...) } - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, int, ...pg.QOpt) []logpoller.Log); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, logpoller.Confirmations, ...pg.QOpt) []logpoller.Log); ok { r0 = rf(eventSig, address, topicIndex, topicValueMin, confs, qopts...) } else { if ret.Get(0) != nil { @@ -254,7 +254,7 @@ func (_m *LogPoller) IndexedLogsTopicGreaterThan(eventSig common.Hash, address c } } - if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, common.Hash, int, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, common.Hash, logpoller.Confirmations, ...pg.QOpt) error); ok { r1 = rf(eventSig, address, topicIndex, topicValueMin, confs, qopts...) } else { r1 = ret.Error(1) @@ -276,10 +276,10 @@ func (_m *LogPoller) IndexedLogsTopicRange(eventSig common.Hash, address common. var r0 []logpoller.Log var r1 error - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, common.Hash, int, ...pg.QOpt) ([]logpoller.Log, error)); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, common.Hash, logpoller.Confirmations, ...pg.QOpt) ([]logpoller.Log, error)); ok { return rf(eventSig, address, topicIndex, topicValueMin, topicValueMax, confs, qopts...) } - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, common.Hash, int, ...pg.QOpt) []logpoller.Log); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, common.Hash, logpoller.Confirmations, ...pg.QOpt) []logpoller.Log); ok { r0 = rf(eventSig, address, topicIndex, topicValueMin, topicValueMax, confs, qopts...) } else { if ret.Get(0) != nil { @@ -287,7 +287,7 @@ func (_m *LogPoller) IndexedLogsTopicRange(eventSig common.Hash, address common. } } - if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, common.Hash, common.Hash, int, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, common.Hash, common.Hash, logpoller.Confirmations, ...pg.QOpt) error); ok { r1 = rf(eventSig, address, topicIndex, topicValueMin, topicValueMax, confs, qopts...) } else { r1 = ret.Error(1) @@ -297,7 +297,7 @@ func (_m *LogPoller) IndexedLogsTopicRange(eventSig common.Hash, address common. } // IndexedLogsWithSigsExcluding provides a mock function with given fields: address, eventSigA, eventSigB, topicIndex, fromBlock, toBlock, confs, qopts -func (_m *LogPoller) IndexedLogsWithSigsExcluding(address common.Address, eventSigA, eventSigB common.Hash, topicIndex int, fromBlock, toBlock int64, confs logpoller.Confirmations, qopts ...pg.QOpt) ([]logpoller.Log, error) { +func (_m *LogPoller) IndexedLogsWithSigsExcluding(address common.Address, eventSigA common.Hash, eventSigB common.Hash, topicIndex int, fromBlock int64, toBlock int64, confs logpoller.Confirmations, qopts ...pg.QOpt) ([]logpoller.Log, error) { _va := make([]interface{}, len(qopts)) for _i := range qopts { _va[_i] = qopts[_i] @@ -309,10 +309,10 @@ func (_m *LogPoller) IndexedLogsWithSigsExcluding(address common.Address, eventS var r0 []logpoller.Log var r1 error - if rf, ok := ret.Get(0).(func(common.Address, common.Hash, common.Hash, int, int64, int64, int, ...pg.QOpt) ([]logpoller.Log, error)); ok { + if rf, ok := ret.Get(0).(func(common.Address, common.Hash, common.Hash, int, int64, int64, logpoller.Confirmations, ...pg.QOpt) ([]logpoller.Log, error)); ok { return rf(address, eventSigA, eventSigB, topicIndex, fromBlock, toBlock, confs, qopts...) } - if rf, ok := ret.Get(0).(func(common.Address, common.Hash, common.Hash, int, int64, int64, int, ...pg.QOpt) []logpoller.Log); ok { + if rf, ok := ret.Get(0).(func(common.Address, common.Hash, common.Hash, int, int64, int64, logpoller.Confirmations, ...pg.QOpt) []logpoller.Log); ok { r0 = rf(address, eventSigA, eventSigB, topicIndex, fromBlock, toBlock, confs, qopts...) } else { if ret.Get(0) != nil { @@ -320,7 +320,7 @@ func (_m *LogPoller) IndexedLogsWithSigsExcluding(address common.Address, eventS } } - if rf, ok := ret.Get(1).(func(common.Address, common.Hash, common.Hash, int, int64, int64, int, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(common.Address, common.Hash, common.Hash, int, int64, int64, logpoller.Confirmations, ...pg.QOpt) error); ok { r1 = rf(address, eventSigA, eventSigB, topicIndex, fromBlock, toBlock, confs, qopts...) } else { r1 = ret.Error(1) @@ -372,16 +372,16 @@ func (_m *LogPoller) LatestBlockByEventSigsAddrsWithConfs(fromBlock int64, event var r0 int64 var r1 error - if rf, ok := ret.Get(0).(func(int64, []common.Hash, []common.Address, int, ...pg.QOpt) (int64, error)); ok { + if rf, ok := ret.Get(0).(func(int64, []common.Hash, []common.Address, logpoller.Confirmations, ...pg.QOpt) (int64, error)); ok { return rf(fromBlock, eventSigs, addresses, confs, qopts...) } - if rf, ok := ret.Get(0).(func(int64, []common.Hash, []common.Address, int, ...pg.QOpt) int64); ok { + if rf, ok := ret.Get(0).(func(int64, []common.Hash, []common.Address, logpoller.Confirmations, ...pg.QOpt) int64); ok { r0 = rf(fromBlock, eventSigs, addresses, confs, qopts...) } else { r0 = ret.Get(0).(int64) } - if rf, ok := ret.Get(1).(func(int64, []common.Hash, []common.Address, int, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(int64, []common.Hash, []common.Address, logpoller.Confirmations, ...pg.QOpt) error); ok { r1 = rf(fromBlock, eventSigs, addresses, confs, qopts...) } else { r1 = ret.Error(1) @@ -403,10 +403,10 @@ func (_m *LogPoller) LatestLogByEventSigWithConfs(eventSig common.Hash, address var r0 *logpoller.Log var r1 error - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, ...pg.QOpt) (*logpoller.Log, error)); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, logpoller.Confirmations, ...pg.QOpt) (*logpoller.Log, error)); ok { return rf(eventSig, address, confs, qopts...) } - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, ...pg.QOpt) *logpoller.Log); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, logpoller.Confirmations, ...pg.QOpt) *logpoller.Log); ok { r0 = rf(eventSig, address, confs, qopts...) } else { if ret.Get(0) != nil { @@ -414,7 +414,7 @@ func (_m *LogPoller) LatestLogByEventSigWithConfs(eventSig common.Hash, address } } - if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(common.Hash, common.Address, logpoller.Confirmations, ...pg.QOpt) error); ok { r1 = rf(eventSig, address, confs, qopts...) } else { r1 = ret.Error(1) @@ -436,10 +436,10 @@ func (_m *LogPoller) LatestLogEventSigsAddrsWithConfs(fromBlock int64, eventSigs var r0 []logpoller.Log var r1 error - if rf, ok := ret.Get(0).(func(int64, []common.Hash, []common.Address, int, ...pg.QOpt) ([]logpoller.Log, error)); ok { + if rf, ok := ret.Get(0).(func(int64, []common.Hash, []common.Address, logpoller.Confirmations, ...pg.QOpt) ([]logpoller.Log, error)); ok { return rf(fromBlock, eventSigs, addresses, confs, qopts...) } - if rf, ok := ret.Get(0).(func(int64, []common.Hash, []common.Address, int, ...pg.QOpt) []logpoller.Log); ok { + if rf, ok := ret.Get(0).(func(int64, []common.Hash, []common.Address, logpoller.Confirmations, ...pg.QOpt) []logpoller.Log); ok { r0 = rf(fromBlock, eventSigs, addresses, confs, qopts...) } else { if ret.Get(0) != nil { @@ -447,7 +447,7 @@ func (_m *LogPoller) LatestLogEventSigsAddrsWithConfs(fromBlock int64, eventSigs } } - if rf, ok := ret.Get(1).(func(int64, []common.Hash, []common.Address, int, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(int64, []common.Hash, []common.Address, logpoller.Confirmations, ...pg.QOpt) error); ok { r1 = rf(fromBlock, eventSigs, addresses, confs, qopts...) } else { r1 = ret.Error(1) @@ -490,7 +490,7 @@ func (_m *LogPoller) Logs(start int64, end int64, eventSig common.Hash, address } // LogsCreatedAfter provides a mock function with given fields: eventSig, address, _a2, confs, qopts -func (_m *LogPoller) LogsCreatedAfter(eventSig common.Hash, address common.Address, time time.Time, confs logpoller.Confirmations, qopts ...pg.QOpt) ([]logpoller.Log, error) { +func (_m *LogPoller) LogsCreatedAfter(eventSig common.Hash, address common.Address, _a2 time.Time, confs logpoller.Confirmations, qopts ...pg.QOpt) ([]logpoller.Log, error) { _va := make([]interface{}, len(qopts)) for _i := range qopts { _va[_i] = qopts[_i] @@ -502,10 +502,10 @@ func (_m *LogPoller) LogsCreatedAfter(eventSig common.Hash, address common.Addre var r0 []logpoller.Log var r1 error - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, time.Time, int, ...pg.QOpt) ([]logpoller.Log, error)); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, time.Time, logpoller.Confirmations, ...pg.QOpt) ([]logpoller.Log, error)); ok { return rf(eventSig, address, _a2, confs, qopts...) } - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, time.Time, int, ...pg.QOpt) []logpoller.Log); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, time.Time, logpoller.Confirmations, ...pg.QOpt) []logpoller.Log); ok { r0 = rf(eventSig, address, _a2, confs, qopts...) } else { if ret.Get(0) != nil { @@ -513,7 +513,7 @@ func (_m *LogPoller) LogsCreatedAfter(eventSig common.Hash, address common.Addre } } - if rf, ok := ret.Get(1).(func(common.Hash, common.Address, time.Time, int, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(common.Hash, common.Address, time.Time, logpoller.Confirmations, ...pg.QOpt) error); ok { r1 = rf(eventSig, address, _a2, confs, qopts...) } else { r1 = ret.Error(1) @@ -535,10 +535,10 @@ func (_m *LogPoller) LogsDataWordGreaterThan(eventSig common.Hash, address commo var r0 []logpoller.Log var r1 error - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, logpoller.BlockConfsOpt, ...pg.QOpt) ([]logpoller.Log, error)); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, logpoller.Confirmations, ...pg.QOpt) ([]logpoller.Log, error)); ok { return rf(eventSig, address, wordIndex, wordValueMin, confs, qopts...) } - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, logpoller.BlockConfsOpt, ...pg.QOpt) []logpoller.Log); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, logpoller.Confirmations, ...pg.QOpt) []logpoller.Log); ok { r0 = rf(eventSig, address, wordIndex, wordValueMin, confs, qopts...) } else { if ret.Get(0) != nil { @@ -546,7 +546,7 @@ func (_m *LogPoller) LogsDataWordGreaterThan(eventSig common.Hash, address commo } } - if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, common.Hash, logpoller.BlockConfsOpt, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, common.Hash, logpoller.Confirmations, ...pg.QOpt) error); ok { r1 = rf(eventSig, address, wordIndex, wordValueMin, confs, qopts...) } else { r1 = ret.Error(1) @@ -556,7 +556,7 @@ func (_m *LogPoller) LogsDataWordGreaterThan(eventSig common.Hash, address commo } // LogsDataWordRange provides a mock function with given fields: eventSig, address, wordIndex, wordValueMin, wordValueMax, confs, qopts -func (_m *LogPoller) LogsDataWordRange(eventSig common.Hash, address common.Address, wordIndex int, wordValueMin, wordValueMax common.Hash, confs logpoller.Confirmations, qopts ...pg.QOpt) ([]logpoller.Log, error) { +func (_m *LogPoller) LogsDataWordRange(eventSig common.Hash, address common.Address, wordIndex int, wordValueMin common.Hash, wordValueMax common.Hash, confs logpoller.Confirmations, qopts ...pg.QOpt) ([]logpoller.Log, error) { _va := make([]interface{}, len(qopts)) for _i := range qopts { _va[_i] = qopts[_i] @@ -568,10 +568,10 @@ func (_m *LogPoller) LogsDataWordRange(eventSig common.Hash, address common.Addr var r0 []logpoller.Log var r1 error - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, common.Hash, int, ...pg.QOpt) ([]logpoller.Log, error)); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, common.Hash, logpoller.Confirmations, ...pg.QOpt) ([]logpoller.Log, error)); ok { return rf(eventSig, address, wordIndex, wordValueMin, wordValueMax, confs, qopts...) } - if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, common.Hash, int, ...pg.QOpt) []logpoller.Log); ok { + if rf, ok := ret.Get(0).(func(common.Hash, common.Address, int, common.Hash, common.Hash, logpoller.Confirmations, ...pg.QOpt) []logpoller.Log); ok { r0 = rf(eventSig, address, wordIndex, wordValueMin, wordValueMax, confs, qopts...) } else { if ret.Get(0) != nil { @@ -579,7 +579,7 @@ func (_m *LogPoller) LogsDataWordRange(eventSig common.Hash, address common.Addr } } - if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, common.Hash, common.Hash, int, ...pg.QOpt) error); ok { + if rf, ok := ret.Get(1).(func(common.Hash, common.Address, int, common.Hash, common.Hash, logpoller.Confirmations, ...pg.QOpt) error); ok { r1 = rf(eventSig, address, wordIndex, wordValueMin, wordValueMax, confs, qopts...) } else { r1 = ret.Error(1)