From 0e5fe88a633978df696ccb2d5c49e2a7ba219b7a Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Tue, 6 Aug 2024 06:06:41 -0500 Subject: [PATCH] use gomods; add make generate; add CI check for tidiness+generation --- .github/workflows/relay.yml | 10 ++- Makefile | 22 +++++- pkg/monitoring/metrics/mocks/FeedBalances.go | 15 ++-- pkg/monitoring/metrics/mocks/Fees.go | 11 ++- pkg/monitoring/metrics/mocks/Metrics.go | 35 --------- pkg/monitoring/metrics/mocks/NetworkFees.go | 11 ++- pkg/monitoring/metrics/mocks/NodeBalances.go | 11 ++- pkg/monitoring/metrics/mocks/NodeSuccess.go | 11 ++- .../metrics/mocks/ReportObservations.go | 11 ++- pkg/monitoring/metrics/mocks/SlotHeight.go | 11 ++- pkg/monitoring/mocks/ChainReader.go | 43 +++++++++-- pkg/solana/client/mocks/ReaderWriter.go | 51 +++++++++++-- pkg/solana/config/mocks/config.go | 75 +++++++++++++++++-- pkg/solana/fees/mocks/Estimator.go | 23 ++++-- pkg/solana/txm/mocks/simple_keystore.go | 15 ++-- 15 files changed, 243 insertions(+), 112 deletions(-) delete mode 100644 pkg/monitoring/metrics/mocks/Metrics.go diff --git a/.github/workflows/relay.yml b/.github/workflows/relay.yml index 76c14d55a..e9a1b8a91 100644 --- a/.github/workflows/relay.yml +++ b/.github/workflows/relay.yml @@ -33,8 +33,14 @@ jobs: run: go install github.com/smartcontractkit/chainlink-testing-framework/tools/gotestloghelper@latest - name: Check go mod tidy run: | - go mod tidy - echo "if this fails run 'go mod tidy' to fix" + make gomodtidy + echo "if this fails run 'make gomodtidy' to fix" + git diff --minimal --exit-code + - name: Check go generate + run: | + make rm-mocked + make generate + echo "if this fails run 'make generate' to fix" git diff --stat --exit-code - name: Install Solana CLI run: ./scripts/install-solana-ci.sh diff --git a/Makefile b/Makefile index 6f1fac596..28354ed05 100644 --- a/Makefile +++ b/Makefile @@ -84,9 +84,25 @@ test_smoke: cd ./integration-tests &&\ SELECTED_NETWORKS=SIMULATED go test -timeout 24h -count=1 -json $(args) -run TestSolanaOCRV2Smoke ./smoke 2>&1 | tee /tmp/gotest.log | gotestloghelper -json -tlogprefix -singlepackage -color -gomodtidy: - go mod tidy - cd ./integration-tests && go mod tidy +.PHONY: gomods +gomods: ## Install gomods + go install github.com/jmank88/gomods@v0.1.3 + +.PHONY: gomodtidy +gomodtidy: gomods + gomods tidy + +.PHONY: mockery +mockery: $(mockery) ## Install mockery. + go install github.com/vektra/mockery/v2@v2.43.2 + +.PHONY: rm-mocked +rm-mocked: + grep -rl "^// Code generated by mockery" | grep .go$ | xargs -r rm + +.PHONY: generate +generate: mockery gomods + gomods -w go generate -x ./... .PHONY: lint-go-integration-tests lint-go-integration-tests: diff --git a/pkg/monitoring/metrics/mocks/FeedBalances.go b/pkg/monitoring/metrics/mocks/FeedBalances.go index ad3e69efc..ded286e81 100644 --- a/pkg/monitoring/metrics/mocks/FeedBalances.go +++ b/pkg/monitoring/metrics/mocks/FeedBalances.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -23,6 +23,10 @@ func (_m *FeedBalances) Cleanup(balanceAccountName string, feedInput metrics.Fee func (_m *FeedBalances) Exists(balanceAccountName string) (*prometheus.GaugeVec, bool) { ret := _m.Called(balanceAccountName) + if len(ret) == 0 { + panic("no return value specified for Exists") + } + var r0 *prometheus.GaugeVec var r1 bool if rf, ok := ret.Get(0).(func(string) (*prometheus.GaugeVec, bool)); ok { @@ -50,13 +54,12 @@ func (_m *FeedBalances) SetBalance(balance uint64, balanceAccountName string, fe _m.Called(balance, balanceAccountName, feedInput) } -type mockConstructorTestingTNewFeedBalances interface { +// NewFeedBalances creates a new instance of FeedBalances. 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 NewFeedBalances(t interface { mock.TestingT Cleanup(func()) -} - -// NewFeedBalances creates a new instance of FeedBalances. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewFeedBalances(t mockConstructorTestingTNewFeedBalances) *FeedBalances { +}) *FeedBalances { mock := &FeedBalances{} mock.Mock.Test(t) diff --git a/pkg/monitoring/metrics/mocks/Fees.go b/pkg/monitoring/metrics/mocks/Fees.go index aa1bddd2f..e435cfabd 100644 --- a/pkg/monitoring/metrics/mocks/Fees.go +++ b/pkg/monitoring/metrics/mocks/Fees.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -24,13 +24,12 @@ func (_m *Fees) Set(txFee uint64, computeUnitPrice fees.ComputeUnitPrice, feedIn _m.Called(txFee, computeUnitPrice, feedInput) } -type mockConstructorTestingTNewFees interface { +// NewFees creates a new instance of Fees. 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 NewFees(t interface { mock.TestingT Cleanup(func()) -} - -// NewFees creates a new instance of Fees. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewFees(t mockConstructorTestingTNewFees) *Fees { +}) *Fees { mock := &Fees{} mock.Mock.Test(t) diff --git a/pkg/monitoring/metrics/mocks/Metrics.go b/pkg/monitoring/metrics/mocks/Metrics.go deleted file mode 100644 index 50d571eb4..000000000 --- a/pkg/monitoring/metrics/mocks/Metrics.go +++ /dev/null @@ -1,35 +0,0 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. - -package mocks - -import mock "github.com/stretchr/testify/mock" - -// Metrics is an autogenerated mock type for the Metrics type -type Metrics struct { - mock.Mock -} - -// Cleanup provides a mock function with given fields: balanceAccountName, accountAddress, feedID, chainID, contractStatus, contractType, feedName, feedPath, networkID, networkName -func (_m *Metrics) Cleanup(balanceAccountName string, accountAddress string, feedID string, chainID string, contractStatus string, contractType string, feedName string, feedPath string, networkID string, networkName string) { - _m.Called(balanceAccountName, accountAddress, feedID, chainID, contractStatus, contractType, feedName, feedPath, networkID, networkName) -} - -// SetBalance provides a mock function with given fields: balance, balanceAccountName, accountAddress, feedID, chainID, contractStatus, contractType, feedName, feedPath, networkID, networkName -func (_m *Metrics) SetBalance(balance uint64, balanceAccountName string, accountAddress string, feedID string, chainID string, contractStatus string, contractType string, feedName string, feedPath string, networkID string, networkName string) { - _m.Called(balance, balanceAccountName, accountAddress, feedID, chainID, contractStatus, contractType, feedName, feedPath, networkID, networkName) -} - -type mockConstructorTestingTNewMetrics interface { - mock.TestingT - Cleanup(func()) -} - -// NewMetrics creates a new instance of Metrics. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewMetrics(t mockConstructorTestingTNewMetrics) *Metrics { - mock := &Metrics{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/pkg/monitoring/metrics/mocks/NetworkFees.go b/pkg/monitoring/metrics/mocks/NetworkFees.go index 187ff358e..3b27dbd93 100644 --- a/pkg/monitoring/metrics/mocks/NetworkFees.go +++ b/pkg/monitoring/metrics/mocks/NetworkFees.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -22,13 +22,12 @@ func (_m *NetworkFees) Set(slot metrics.NetworkFeesInput, chain string) { _m.Called(slot, chain) } -type mockConstructorTestingTNewNetworkFees interface { +// NewNetworkFees creates a new instance of NetworkFees. 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 NewNetworkFees(t interface { mock.TestingT Cleanup(func()) -} - -// NewNetworkFees creates a new instance of NetworkFees. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewNetworkFees(t mockConstructorTestingTNewNetworkFees) *NetworkFees { +}) *NetworkFees { mock := &NetworkFees{} mock.Mock.Test(t) diff --git a/pkg/monitoring/metrics/mocks/NodeBalances.go b/pkg/monitoring/metrics/mocks/NodeBalances.go index f955c6684..bbf9aa4b8 100644 --- a/pkg/monitoring/metrics/mocks/NodeBalances.go +++ b/pkg/monitoring/metrics/mocks/NodeBalances.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -19,13 +19,12 @@ func (_m *NodeBalances) SetBalance(balance uint64, address string, operator stri _m.Called(balance, address, operator) } -type mockConstructorTestingTNewNodeBalances interface { +// NewNodeBalances creates a new instance of NodeBalances. 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 NewNodeBalances(t interface { mock.TestingT Cleanup(func()) -} - -// NewNodeBalances creates a new instance of NodeBalances. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewNodeBalances(t mockConstructorTestingTNewNodeBalances) *NodeBalances { +}) *NodeBalances { mock := &NodeBalances{} mock.Mock.Test(t) diff --git a/pkg/monitoring/metrics/mocks/NodeSuccess.go b/pkg/monitoring/metrics/mocks/NodeSuccess.go index 10c336db1..b80b46f59 100644 --- a/pkg/monitoring/metrics/mocks/NodeSuccess.go +++ b/pkg/monitoring/metrics/mocks/NodeSuccess.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -22,13 +22,12 @@ func (_m *NodeSuccess) Cleanup(i metrics.NodeFeedInput) { _m.Called(i) } -type mockConstructorTestingTNewNodeSuccess interface { +// NewNodeSuccess creates a new instance of NodeSuccess. 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 NewNodeSuccess(t interface { mock.TestingT Cleanup(func()) -} - -// NewNodeSuccess creates a new instance of NodeSuccess. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewNodeSuccess(t mockConstructorTestingTNewNodeSuccess) *NodeSuccess { +}) *NodeSuccess { mock := &NodeSuccess{} mock.Mock.Test(t) diff --git a/pkg/monitoring/metrics/mocks/ReportObservations.go b/pkg/monitoring/metrics/mocks/ReportObservations.go index 12976948c..814d997eb 100644 --- a/pkg/monitoring/metrics/mocks/ReportObservations.go +++ b/pkg/monitoring/metrics/mocks/ReportObservations.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -22,13 +22,12 @@ func (_m *ReportObservations) SetCount(count uint8, feedInput metrics.FeedInput) _m.Called(count, feedInput) } -type mockConstructorTestingTNewReportObservations interface { +// NewReportObservations creates a new instance of ReportObservations. 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 NewReportObservations(t interface { mock.TestingT Cleanup(func()) -} - -// NewReportObservations creates a new instance of ReportObservations. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewReportObservations(t mockConstructorTestingTNewReportObservations) *ReportObservations { +}) *ReportObservations { mock := &ReportObservations{} mock.Mock.Test(t) diff --git a/pkg/monitoring/metrics/mocks/SlotHeight.go b/pkg/monitoring/metrics/mocks/SlotHeight.go index 97f008ed1..22de7542b 100644 --- a/pkg/monitoring/metrics/mocks/SlotHeight.go +++ b/pkg/monitoring/metrics/mocks/SlotHeight.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -22,13 +22,12 @@ func (_m *SlotHeight) Set(slot types.SlotHeight, chain string, url string) { _m.Called(slot, chain, url) } -type mockConstructorTestingTNewSlotHeight interface { +// NewSlotHeight creates a new instance of SlotHeight. 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 NewSlotHeight(t interface { mock.TestingT Cleanup(func()) -} - -// NewSlotHeight creates a new instance of SlotHeight. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewSlotHeight(t mockConstructorTestingTNewSlotHeight) *SlotHeight { +}) *SlotHeight { mock := &SlotHeight{} mock.Mock.Test(t) diff --git a/pkg/monitoring/mocks/ChainReader.go b/pkg/monitoring/mocks/ChainReader.go index f2bf34ade..30b714305 100644 --- a/pkg/monitoring/mocks/ChainReader.go +++ b/pkg/monitoring/mocks/ChainReader.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -23,6 +23,10 @@ type ChainReader struct { func (_m *ChainReader) GetBalance(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (*rpc.GetBalanceResult, error) { ret := _m.Called(ctx, account, commitment) + if len(ret) == 0 { + panic("no return value specified for GetBalance") + } + var r0 *rpc.GetBalanceResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) (*rpc.GetBalanceResult, error)); ok { @@ -49,6 +53,10 @@ func (_m *ChainReader) GetBalance(ctx context.Context, account solana.PublicKey, func (_m *ChainReader) GetLatestBlock(ctx context.Context, commitment rpc.CommitmentType) (*rpc.GetBlockResult, error) { ret := _m.Called(ctx, commitment) + if len(ret) == 0 { + panic("no return value specified for GetLatestBlock") + } + var r0 *rpc.GetBlockResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, rpc.CommitmentType) (*rpc.GetBlockResult, error)); ok { @@ -75,6 +83,10 @@ func (_m *ChainReader) GetLatestBlock(ctx context.Context, commitment rpc.Commit func (_m *ChainReader) GetLatestTransmission(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (pkgsolana.Answer, uint64, error) { ret := _m.Called(ctx, account, commitment) + if len(ret) == 0 { + panic("no return value specified for GetLatestTransmission") + } + var r0 pkgsolana.Answer var r1 uint64 var r2 error @@ -106,6 +118,10 @@ func (_m *ChainReader) GetLatestTransmission(ctx context.Context, account solana func (_m *ChainReader) GetSignaturesForAddressWithOpts(ctx context.Context, account solana.PublicKey, opts *rpc.GetSignaturesForAddressOpts) ([]*rpc.TransactionSignature, error) { ret := _m.Called(ctx, account, opts) + if len(ret) == 0 { + panic("no return value specified for GetSignaturesForAddressWithOpts") + } + var r0 []*rpc.TransactionSignature var r1 error if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, *rpc.GetSignaturesForAddressOpts) ([]*rpc.TransactionSignature, error)); ok { @@ -132,6 +148,10 @@ func (_m *ChainReader) GetSignaturesForAddressWithOpts(ctx context.Context, acco func (_m *ChainReader) GetSlot(ctx context.Context) (uint64, error) { ret := _m.Called(ctx) + if len(ret) == 0 { + panic("no return value specified for GetSlot") + } + var r0 uint64 var r1 error if rf, ok := ret.Get(0).(func(context.Context) (uint64, error)); ok { @@ -156,6 +176,10 @@ func (_m *ChainReader) GetSlot(ctx context.Context) (uint64, error) { func (_m *ChainReader) GetState(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (pkgsolana.State, uint64, error) { ret := _m.Called(ctx, account, commitment) + if len(ret) == 0 { + panic("no return value specified for GetState") + } + var r0 pkgsolana.State var r1 uint64 var r2 error @@ -187,6 +211,10 @@ func (_m *ChainReader) GetState(ctx context.Context, account solana.PublicKey, c func (_m *ChainReader) GetTokenAccountBalance(ctx context.Context, account solana.PublicKey, commitment rpc.CommitmentType) (*rpc.GetTokenAccountBalanceResult, error) { ret := _m.Called(ctx, account, commitment) + if len(ret) == 0 { + panic("no return value specified for GetTokenAccountBalance") + } + var r0 *rpc.GetTokenAccountBalanceResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, rpc.CommitmentType) (*rpc.GetTokenAccountBalanceResult, error)); ok { @@ -213,6 +241,10 @@ func (_m *ChainReader) GetTokenAccountBalance(ctx context.Context, account solan func (_m *ChainReader) GetTransaction(ctx context.Context, txSig solana.Signature, opts *rpc.GetTransactionOpts) (*rpc.GetTransactionResult, error) { ret := _m.Called(ctx, txSig, opts) + if len(ret) == 0 { + panic("no return value specified for GetTransaction") + } + var r0 *rpc.GetTransactionResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, solana.Signature, *rpc.GetTransactionOpts) (*rpc.GetTransactionResult, error)); ok { @@ -235,13 +267,12 @@ func (_m *ChainReader) GetTransaction(ctx context.Context, txSig solana.Signatur return r0, r1 } -type mockConstructorTestingTNewChainReader interface { +// NewChainReader creates a new instance of ChainReader. 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 NewChainReader(t interface { mock.TestingT Cleanup(func()) -} - -// NewChainReader creates a new instance of ChainReader. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewChainReader(t mockConstructorTestingTNewChainReader) *ChainReader { +}) *ChainReader { mock := &ChainReader{} mock.Mock.Test(t) diff --git a/pkg/solana/client/mocks/ReaderWriter.go b/pkg/solana/client/mocks/ReaderWriter.go index 03c3896e9..2bbb82fef 100644 --- a/pkg/solana/client/mocks/ReaderWriter.go +++ b/pkg/solana/client/mocks/ReaderWriter.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -20,6 +20,10 @@ type ReaderWriter struct { func (_m *ReaderWriter) Balance(addr solana.PublicKey) (uint64, error) { ret := _m.Called(addr) + if len(ret) == 0 { + panic("no return value specified for Balance") + } + var r0 uint64 var r1 error if rf, ok := ret.Get(0).(func(solana.PublicKey) (uint64, error)); ok { @@ -44,6 +48,10 @@ func (_m *ReaderWriter) Balance(addr solana.PublicKey) (uint64, error) { func (_m *ReaderWriter) ChainID() (string, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ChainID") + } + var r0 string var r1 error if rf, ok := ret.Get(0).(func() (string, error)); ok { @@ -68,6 +76,10 @@ func (_m *ReaderWriter) ChainID() (string, error) { func (_m *ReaderWriter) GetAccountInfoWithOpts(ctx context.Context, addr solana.PublicKey, opts *rpc.GetAccountInfoOpts) (*rpc.GetAccountInfoResult, error) { ret := _m.Called(ctx, addr, opts) + if len(ret) == 0 { + panic("no return value specified for GetAccountInfoWithOpts") + } + var r0 *rpc.GetAccountInfoResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, solana.PublicKey, *rpc.GetAccountInfoOpts) (*rpc.GetAccountInfoResult, error)); ok { @@ -94,6 +106,10 @@ func (_m *ReaderWriter) GetAccountInfoWithOpts(ctx context.Context, addr solana. func (_m *ReaderWriter) GetFeeForMessage(msg string) (uint64, error) { ret := _m.Called(msg) + if len(ret) == 0 { + panic("no return value specified for GetFeeForMessage") + } + var r0 uint64 var r1 error if rf, ok := ret.Get(0).(func(string) (uint64, error)); ok { @@ -118,6 +134,10 @@ func (_m *ReaderWriter) GetFeeForMessage(msg string) (uint64, error) { func (_m *ReaderWriter) GetLatestBlock() (*rpc.GetBlockResult, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for GetLatestBlock") + } + var r0 *rpc.GetBlockResult var r1 error if rf, ok := ret.Get(0).(func() (*rpc.GetBlockResult, error)); ok { @@ -144,6 +164,10 @@ func (_m *ReaderWriter) GetLatestBlock() (*rpc.GetBlockResult, error) { func (_m *ReaderWriter) LatestBlockhash() (*rpc.GetLatestBlockhashResult, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for LatestBlockhash") + } + var r0 *rpc.GetLatestBlockhashResult var r1 error if rf, ok := ret.Get(0).(func() (*rpc.GetLatestBlockhashResult, error)); ok { @@ -170,6 +194,10 @@ func (_m *ReaderWriter) LatestBlockhash() (*rpc.GetLatestBlockhashResult, error) func (_m *ReaderWriter) SendTx(ctx context.Context, tx *solana.Transaction) (solana.Signature, error) { ret := _m.Called(ctx, tx) + if len(ret) == 0 { + panic("no return value specified for SendTx") + } + var r0 solana.Signature var r1 error if rf, ok := ret.Get(0).(func(context.Context, *solana.Transaction) (solana.Signature, error)); ok { @@ -196,6 +224,10 @@ func (_m *ReaderWriter) SendTx(ctx context.Context, tx *solana.Transaction) (sol func (_m *ReaderWriter) SignatureStatuses(ctx context.Context, sigs []solana.Signature) ([]*rpc.SignatureStatusesResult, error) { ret := _m.Called(ctx, sigs) + if len(ret) == 0 { + panic("no return value specified for SignatureStatuses") + } + var r0 []*rpc.SignatureStatusesResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, []solana.Signature) ([]*rpc.SignatureStatusesResult, error)); ok { @@ -222,6 +254,10 @@ func (_m *ReaderWriter) SignatureStatuses(ctx context.Context, sigs []solana.Sig func (_m *ReaderWriter) SimulateTx(ctx context.Context, tx *solana.Transaction, opts *rpc.SimulateTransactionOpts) (*rpc.SimulateTransactionResult, error) { ret := _m.Called(ctx, tx, opts) + if len(ret) == 0 { + panic("no return value specified for SimulateTx") + } + var r0 *rpc.SimulateTransactionResult var r1 error if rf, ok := ret.Get(0).(func(context.Context, *solana.Transaction, *rpc.SimulateTransactionOpts) (*rpc.SimulateTransactionResult, error)); ok { @@ -248,6 +284,10 @@ func (_m *ReaderWriter) SimulateTx(ctx context.Context, tx *solana.Transaction, func (_m *ReaderWriter) SlotHeight() (uint64, error) { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for SlotHeight") + } + var r0 uint64 var r1 error if rf, ok := ret.Get(0).(func() (uint64, error)); ok { @@ -268,13 +308,12 @@ func (_m *ReaderWriter) SlotHeight() (uint64, error) { return r0, r1 } -type mockConstructorTestingTNewReaderWriter interface { +// NewReaderWriter creates a new instance of ReaderWriter. 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 NewReaderWriter(t interface { mock.TestingT Cleanup(func()) -} - -// NewReaderWriter creates a new instance of ReaderWriter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewReaderWriter(t mockConstructorTestingTNewReaderWriter) *ReaderWriter { +}) *ReaderWriter { mock := &ReaderWriter{} mock.Mock.Test(t) diff --git a/pkg/solana/config/mocks/config.go b/pkg/solana/config/mocks/config.go index cf1c985a6..712850f70 100644 --- a/pkg/solana/config/mocks/config.go +++ b/pkg/solana/config/mocks/config.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type Config struct { func (_m *Config) BalancePollPeriod() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for BalancePollPeriod") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -32,6 +36,10 @@ func (_m *Config) BalancePollPeriod() time.Duration { func (_m *Config) BlockHistoryPollPeriod() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for BlockHistoryPollPeriod") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -46,6 +54,10 @@ func (_m *Config) BlockHistoryPollPeriod() time.Duration { func (_m *Config) Commitment() rpc.CommitmentType { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Commitment") + } + var r0 rpc.CommitmentType if rf, ok := ret.Get(0).(func() rpc.CommitmentType); ok { r0 = rf() @@ -60,6 +72,10 @@ func (_m *Config) Commitment() rpc.CommitmentType { func (_m *Config) ComputeUnitPriceDefault() uint64 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ComputeUnitPriceDefault") + } + var r0 uint64 if rf, ok := ret.Get(0).(func() uint64); ok { r0 = rf() @@ -74,6 +90,10 @@ func (_m *Config) ComputeUnitPriceDefault() uint64 { func (_m *Config) ComputeUnitPriceMax() uint64 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ComputeUnitPriceMax") + } + var r0 uint64 if rf, ok := ret.Get(0).(func() uint64); ok { r0 = rf() @@ -88,6 +108,10 @@ func (_m *Config) ComputeUnitPriceMax() uint64 { func (_m *Config) ComputeUnitPriceMin() uint64 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ComputeUnitPriceMin") + } + var r0 uint64 if rf, ok := ret.Get(0).(func() uint64); ok { r0 = rf() @@ -102,6 +126,10 @@ func (_m *Config) ComputeUnitPriceMin() uint64 { func (_m *Config) ConfirmPollPeriod() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for ConfirmPollPeriod") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -116,6 +144,10 @@ func (_m *Config) ConfirmPollPeriod() time.Duration { func (_m *Config) FeeBumpPeriod() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for FeeBumpPeriod") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -130,6 +162,10 @@ func (_m *Config) FeeBumpPeriod() time.Duration { func (_m *Config) FeeEstimatorMode() string { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for FeeEstimatorMode") + } + var r0 string if rf, ok := ret.Get(0).(func() string); ok { r0 = rf() @@ -144,6 +180,10 @@ func (_m *Config) FeeEstimatorMode() string { func (_m *Config) MaxRetries() *uint { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for MaxRetries") + } + var r0 *uint if rf, ok := ret.Get(0).(func() *uint); ok { r0 = rf() @@ -160,6 +200,10 @@ func (_m *Config) MaxRetries() *uint { func (_m *Config) OCR2CachePollPeriod() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OCR2CachePollPeriod") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -174,6 +218,10 @@ func (_m *Config) OCR2CachePollPeriod() time.Duration { func (_m *Config) OCR2CacheTTL() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for OCR2CacheTTL") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -188,6 +236,10 @@ func (_m *Config) OCR2CacheTTL() time.Duration { func (_m *Config) SkipPreflight() bool { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for SkipPreflight") + } + var r0 bool if rf, ok := ret.Get(0).(func() bool); ok { r0 = rf() @@ -202,6 +254,10 @@ func (_m *Config) SkipPreflight() bool { func (_m *Config) TxConfirmTimeout() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TxConfirmTimeout") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -216,6 +272,10 @@ func (_m *Config) TxConfirmTimeout() time.Duration { func (_m *Config) TxRetryTimeout() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TxRetryTimeout") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -230,6 +290,10 @@ func (_m *Config) TxRetryTimeout() time.Duration { func (_m *Config) TxTimeout() time.Duration { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for TxTimeout") + } + var r0 time.Duration if rf, ok := ret.Get(0).(func() time.Duration); ok { r0 = rf() @@ -240,13 +304,12 @@ func (_m *Config) TxTimeout() time.Duration { return r0 } -type mockConstructorTestingTNewConfig interface { +// NewConfig creates a new instance of Config. 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 NewConfig(t interface { mock.TestingT Cleanup(func()) -} - -// NewConfig creates a new instance of Config. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewConfig(t mockConstructorTestingTNewConfig) *Config { +}) *Config { mock := &Config{} mock.Mock.Test(t) diff --git a/pkg/solana/fees/mocks/Estimator.go b/pkg/solana/fees/mocks/Estimator.go index 8c8b04213..a61b811a7 100644 --- a/pkg/solana/fees/mocks/Estimator.go +++ b/pkg/solana/fees/mocks/Estimator.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -17,6 +17,10 @@ type Estimator struct { func (_m *Estimator) BaseComputeUnitPrice() uint64 { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for BaseComputeUnitPrice") + } + var r0 uint64 if rf, ok := ret.Get(0).(func() uint64); ok { r0 = rf() @@ -31,6 +35,10 @@ func (_m *Estimator) BaseComputeUnitPrice() uint64 { func (_m *Estimator) Close() error { ret := _m.Called() + if len(ret) == 0 { + panic("no return value specified for Close") + } + var r0 error if rf, ok := ret.Get(0).(func() error); ok { r0 = rf() @@ -45,6 +53,10 @@ func (_m *Estimator) Close() error { func (_m *Estimator) Start(_a0 context.Context) error { ret := _m.Called(_a0) + if len(ret) == 0 { + panic("no return value specified for Start") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context) error); ok { r0 = rf(_a0) @@ -55,13 +67,12 @@ func (_m *Estimator) Start(_a0 context.Context) error { return r0 } -type mockConstructorTestingTNewEstimator interface { +// NewEstimator creates a new instance of Estimator. 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 NewEstimator(t interface { mock.TestingT Cleanup(func()) -} - -// NewEstimator creates a new instance of Estimator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewEstimator(t mockConstructorTestingTNewEstimator) *Estimator { +}) *Estimator { mock := &Estimator{} mock.Mock.Test(t) diff --git a/pkg/solana/txm/mocks/simple_keystore.go b/pkg/solana/txm/mocks/simple_keystore.go index b62403dad..86c9d3f17 100644 --- a/pkg/solana/txm/mocks/simple_keystore.go +++ b/pkg/solana/txm/mocks/simple_keystore.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.20.0. DO NOT EDIT. +// Code generated by mockery v2.43.2. DO NOT EDIT. package mocks @@ -17,6 +17,10 @@ type SimpleKeystore struct { func (_m *SimpleKeystore) Sign(ctx context.Context, account string, data []byte) ([]byte, error) { ret := _m.Called(ctx, account, data) + if len(ret) == 0 { + panic("no return value specified for Sign") + } + var r0 []byte var r1 error if rf, ok := ret.Get(0).(func(context.Context, string, []byte) ([]byte, error)); ok { @@ -39,13 +43,12 @@ func (_m *SimpleKeystore) Sign(ctx context.Context, account string, data []byte) return r0, r1 } -type mockConstructorTestingTNewSimpleKeystore interface { +// NewSimpleKeystore creates a new instance of SimpleKeystore. 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 NewSimpleKeystore(t interface { mock.TestingT Cleanup(func()) -} - -// NewSimpleKeystore creates a new instance of SimpleKeystore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -func NewSimpleKeystore(t mockConstructorTestingTNewSimpleKeystore) *SimpleKeystore { +}) *SimpleKeystore { mock := &SimpleKeystore{} mock.Mock.Test(t)