From 8956bb614e9ee17bea83b42eebab0c9a466eb2d4 Mon Sep 17 00:00:00 2001 From: ilija42 <57732589+ilija42@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:57:13 -0800 Subject: [PATCH] Bump common and fix Chain Writer naming (#328) --- .../workflows/ccip-ocr3-build-lint-test.yml | 2 +- .golangci.yml | 4 + .mockery.yaml | 2 +- Makefile | 10 +- commit/factory.go | 4 +- execute/factory.go | 11 +- go.mod | 14 +- go.sum | 28 +- .../plugincommon/consensus/min_observation.go | 4 +- mocks/chainlink_common/chain_writer.go | 435 ------------------ mocks/chainlink_common/contract_writer.go | 435 ++++++++++++++++++ pkg/reader/ccip.go | 4 +- pkg/reader/ccip_interface.go | 4 +- pkg/reader/ccip_test.go | 8 +- 14 files changed, 487 insertions(+), 478 deletions(-) delete mode 100644 mocks/chainlink_common/chain_writer.go create mode 100644 mocks/chainlink_common/contract_writer.go diff --git a/.github/workflows/ccip-ocr3-build-lint-test.yml b/.github/workflows/ccip-ocr3-build-lint-test.yml index 9c6dd59b4..07a7d3d6e 100644 --- a/.github/workflows/ccip-ocr3-build-lint-test.yml +++ b/.github/workflows/ccip-ocr3-build-lint-test.yml @@ -27,7 +27,7 @@ jobs: run: make - name: Install linter run: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.59.0 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.62.2 - name: Run linter run: make lint - name: Run tests diff --git a/.golangci.yml b/.golangci.yml index abfb974c6..df0bcce7a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -31,6 +31,10 @@ linters: - unparam - unused linters-settings: + gosec: + # TODO - remove this and fix linter complaint + excludes: + - G115 exhaustive: default-signifies-exhaustive: true goimports: diff --git a/.mockery.yaml b/.mockery.yaml index 4d2055bf7..fb4b9c9fa 100644 --- a/.mockery.yaml +++ b/.mockery.yaml @@ -35,7 +35,7 @@ packages: ExecutePluginCodec: github.com/smartcontractkit/chainlink-common/pkg/types: interfaces: - ChainWriter: + ContractWriter: config: dir: mocks/chainlink_common/ github.com/smartcontractkit/libocr/networking: diff --git a/Makefile b/Makefile index 713d37258..0ffd3bce4 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ test: go test -race -fullpath -shuffle on -count $(TEST_COUNT) -coverprofile=$(COVERAGE_FILE) \ `go list ./... | grep -Ev 'chainlink-ccip/internal/mocks|chainlink-ccip/mocks|chainlink-ccip/commit/merkleroot/rmn/rmnpb'` -lint: ensure_go_version ensure_golangcilint_1_59 +lint: ensure_go_version ensure_golangcilint_1_62_2 golangci-lint run -c .golangci.yml checks: test lint @@ -57,13 +57,13 @@ install-protoc: go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.31 install-golangcilint: - go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59 + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.62.2 ensure_go_version: - @go version | grep -q 'go1.22' || (echo "Please use go1.22" && exit 1) + @go version | grep -q 'go1.23' || (echo "Please use go1.23" && exit 1) -ensure_golangcilint_1_59: - @golangci-lint --version | grep -q '1.59' || (echo "Please use golangci-lint 1.59" && exit 1) +ensure_golangcilint_1_62_2: + @golangci-lint --version | grep -q '1.62.2' || (echo "Please use golangci-lint 1.62.2" && exit 1) ensure_protoc_28_0: @$(PROTOC_BIN) --version | grep -q 'libprotoc 28.0' || (echo "Please use protoc 28.0, (make install-protoc)" && exit 1) diff --git a/commit/factory.go b/commit/factory.go index 5a7308926..3a9108faf 100644 --- a/commit/factory.go +++ b/commit/factory.go @@ -97,7 +97,7 @@ type PluginFactory struct { homeChainReader reader.HomeChain homeChainSelector cciptypes.ChainSelector contractReaders map[cciptypes.ChainSelector]types.ContractReader - chainWriters map[cciptypes.ChainSelector]types.ChainWriter + chainWriters map[cciptypes.ChainSelector]types.ContractWriter rmnPeerClient rmn.PeerClient rmnCrypto cciptypes.RMNCrypto } @@ -113,7 +113,7 @@ func NewPluginFactory( homeChainReader reader.HomeChain, homeChainSelector cciptypes.ChainSelector, contractReaders map[cciptypes.ChainSelector]types.ContractReader, - chainWriters map[cciptypes.ChainSelector]types.ChainWriter, + chainWriters map[cciptypes.ChainSelector]types.ContractWriter, rmnPeerClient rmn.PeerClient, rmnCrypto cciptypes.RMNCrypto, ) *PluginFactory { diff --git a/execute/factory.go b/execute/factory.go index 1f48f2688..ed72ff000 100644 --- a/execute/factory.go +++ b/execute/factory.go @@ -7,13 +7,14 @@ import ( "google.golang.org/grpc" - "github.com/smartcontractkit/chainlink-common/pkg/logger" - "github.com/smartcontractkit/chainlink-common/pkg/types" - "github.com/smartcontractkit/chainlink-common/pkg/types/core" "github.com/smartcontractkit/libocr/commontypes" "github.com/smartcontractkit/libocr/offchainreporting2plus/ocr3types" ragep2ptypes "github.com/smartcontractkit/libocr/ragep2p/types" + "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink-common/pkg/types" + "github.com/smartcontractkit/chainlink-common/pkg/types/core" + "github.com/smartcontractkit/chainlink-ccip/execute/costlymessages" "github.com/smartcontractkit/chainlink-ccip/execute/internal/gas" "github.com/smartcontractkit/chainlink-ccip/execute/tokendata" @@ -95,7 +96,7 @@ type PluginFactory struct { estimateProvider gas.EstimateProvider tokenDataEncoder cciptypes.TokenDataEncoder contractReaders map[cciptypes.ChainSelector]types.ContractReader - chainWriters map[cciptypes.ChainSelector]types.ChainWriter + chainWriters map[cciptypes.ChainSelector]types.ContractWriter } func NewPluginFactory( @@ -108,7 +109,7 @@ func NewPluginFactory( tokenDataEncoder cciptypes.TokenDataEncoder, estimateProvider gas.EstimateProvider, contractReaders map[cciptypes.ChainSelector]types.ContractReader, - chainWriters map[cciptypes.ChainSelector]types.ChainWriter, + chainWriters map[cciptypes.ChainSelector]types.ContractWriter, ) *PluginFactory { return &PluginFactory{ lggr: lggr, diff --git a/go.mod b/go.mod index 9c6ef9aa5..6f12ce194 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module github.com/smartcontractkit/chainlink-ccip -go 1.22.8 +go 1.23.3 require ( github.com/deckarep/golang-set/v2 v2.6.0 github.com/smartcontractkit/chain-selectors v1.0.23 - github.com/smartcontractkit/chainlink-common v0.3.1-0.20241017135127-b283b1e14fa6 + github.com/smartcontractkit/chainlink-common v0.3.1-0.20241127162636-07aa781ee1f4 github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 github.com/stretchr/testify v1.9.0 go.uber.org/zap v1.27.0 @@ -13,7 +13,7 @@ require ( golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 golang.org/x/sync v0.8.0 golang.org/x/time v0.3.0 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.1 google.golang.org/protobuf v1.34.2 ) @@ -45,13 +45,13 @@ require ( github.com/shopspring/decimal v1.4.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect - go.opentelemetry.io/otel v1.28.0 // indirect - go.opentelemetry.io/otel/metric v1.28.0 // indirect - go.opentelemetry.io/otel/trace v1.28.0 // indirect + go.opentelemetry.io/otel v1.30.0 // indirect + go.opentelemetry.io/otel/metric v1.30.0 // indirect + go.opentelemetry.io/otel/trace v1.30.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.29.0 // indirect golang.org/x/sys v0.25.0 // indirect golang.org/x/text v0.18.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 55000aa84..ac185fd67 100644 --- a/go.sum +++ b/go.sum @@ -14,6 +14,8 @@ github.com/deckarep/golang-set/v2 v2.6.0 h1:XfcQbWM1LlMB8BsJ8N9vW5ehnnPVIw0je80N github.com/deckarep/golang-set/v2 v2.6.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/ethereum/go-ethereum v1.13.8 h1:1od+thJel3tM52ZUNQwvpYOeRHlbkVFZ5S8fhi0Lgsg= github.com/ethereum/go-ethereum v1.13.8/go.mod h1:sc48XYQxCzH3fG9BcrXCOOgQk2JfZzNAmIKnceogzsA= +github.com/fxamacker/cbor/v2 v2.5.0 h1:oHsG0V/Q6E/wqTS2O1Cozzsy69nqCiguo5Q1a1ADivE= +github.com/fxamacker/cbor/v2 v2.5.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -65,8 +67,8 @@ github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME= github.com/smartcontractkit/chain-selectors v1.0.23 h1:D2Eaex4Cw/O7Lg3tX6WklOqnjjIQAEBnutCtksPzVDY= github.com/smartcontractkit/chain-selectors v1.0.23/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= -github.com/smartcontractkit/chainlink-common v0.3.1-0.20241017135127-b283b1e14fa6 h1:SHwvqXq1gdXOG/f1sQGupOH6ICZRuzMy5QkD3Um/k+8= -github.com/smartcontractkit/chainlink-common v0.3.1-0.20241017135127-b283b1e14fa6/go.mod h1:tsGgeEJc5SUSlfVGSX0wR0EkRU3pM58D6SKF97V68ko= +github.com/smartcontractkit/chainlink-common v0.3.1-0.20241127162636-07aa781ee1f4 h1:atCZ1jol7a+tdtgU/wNqXgliBun5H7BjGBicGL8Tj6o= +github.com/smartcontractkit/chainlink-common v0.3.1-0.20241127162636-07aa781ee1f4/go.mod h1:bQktEJf7sJ0U3SmIcXvbGUox7SmXcnSEZ4kUbT8R5Nk= github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360= github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12/go.mod h1:fb1ZDVXACvu4frX3APHZaEBp0xi1DIm34DcA0CwTsZM= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= @@ -81,12 +83,14 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc= github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw= -go.opentelemetry.io/otel v1.28.0 h1:/SqNcYk+idO0CxKEUOtKQClMK/MimZihKYMruSMViUo= -go.opentelemetry.io/otel v1.28.0/go.mod h1:q68ijF8Fc8CnMHKyzqL6akLO46ePnjkgfIMIjUIX9z4= -go.opentelemetry.io/otel/metric v1.28.0 h1:f0HGvSl1KRAU1DLgLGFjrwVyismPlnuU6JD6bOeuA5Q= -go.opentelemetry.io/otel/metric v1.28.0/go.mod h1:Fb1eVBFZmLVTMb6PPohq3TO9IIhUisDsbJoL/+uQW4s= -go.opentelemetry.io/otel/trace v1.28.0 h1:GhQ9cUuQGmNDd5BTCP2dAvv75RdMxEfTmYejp+lkx9g= -go.opentelemetry.io/otel/trace v1.28.0/go.mod h1:jPyXzNPg6da9+38HEwElrQiHlVMTnVfM3/yv2OlIHaI= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +go.opentelemetry.io/otel v1.30.0 h1:F2t8sK4qf1fAmY9ua4ohFS/K+FUuOPemHUIXHtktrts= +go.opentelemetry.io/otel v1.30.0/go.mod h1:tFw4Br9b7fOS+uEao81PJjVMjW/5fvNCbpsDIXqP0pc= +go.opentelemetry.io/otel/metric v1.30.0 h1:4xNulvn9gjzo4hjg+wzIKG7iNFEaBMX00Qd4QIZs7+w= +go.opentelemetry.io/otel/metric v1.30.0/go.mod h1:aXTfST94tswhWEb+5QjlSqG+cZlmyXy/u8jFpor3WqQ= +go.opentelemetry.io/otel/trace v1.30.0 h1:7UBkkYzeg3C7kQX8VAidWh2biiQbtAKjyIML8dQ9wmc= +go.opentelemetry.io/otel/trace v1.30.0/go.mod h1:5EyKqTzzmyqB9bwtCCq6pDLktPK6fmGf/Dph+8VI02o= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= @@ -109,10 +113,10 @@ golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= gonum.org/v1/gonum v0.15.0 h1:2lYxjRbTYyxkJxlhC+LvJIx3SsANPdRybu1tGj9/OrQ= gonum.org/v1/gonum v0.15.0/go.mod h1:xzZVBJBtS+Mz4q0Yl2LJTk+OxOg4jiXZ7qBoM0uISGo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd h1:6TEm2ZxXoQmFWFlt1vNxvVOa1Q0dXFQD1m/rYjXmS0E= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240822170219-fc7c04adadcd/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 h1:pPJltXNxVzT4pK9yD8vR9X75DaWYYmLGMsEvBfFQZzQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= +google.golang.org/grpc v1.66.1 h1:hO5qAXR19+/Z44hmvIM4dQFMSYX9XcWsByfoxutBpAM= +google.golang.org/grpc v1.66.1/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/internal/plugincommon/consensus/min_observation.go b/internal/plugincommon/consensus/min_observation.go index 7624448b5..ae6aed8f2 100644 --- a/internal/plugincommon/consensus/min_observation.go +++ b/internal/plugincommon/consensus/min_observation.go @@ -32,14 +32,14 @@ type minObservation[T any] struct { // NewMinObservation constructs a concrete MinObservation object. The // supplied idFunc is used to generate a uniqueID for the type being observed. -func NewMinObservation[T any](min Threshold, idFunc func(T) [32]byte) MinObservation[T] { +func NewMinObservation[T any](minThreshold Threshold, idFunc func(T) [32]byte) MinObservation[T] { if idFunc == nil { idFunc = func(data T) [32]byte { return sha3.Sum256([]byte(fmt.Sprintf("%v", data))) } } return &minObservation[T]{ - minObservation: min, + minObservation: minThreshold, cache: make(map[cciptypes.Bytes32]*counter[T]), idFunc: idFunc, } diff --git a/mocks/chainlink_common/chain_writer.go b/mocks/chainlink_common/chain_writer.go deleted file mode 100644 index 89d806dfc..000000000 --- a/mocks/chainlink_common/chain_writer.go +++ /dev/null @@ -1,435 +0,0 @@ -// Code generated by mockery v2.43.2. DO NOT EDIT. - -package types - -import ( - context "context" - big "math/big" - - mock "github.com/stretchr/testify/mock" - - types "github.com/smartcontractkit/chainlink-common/pkg/types" -) - -// MockChainWriter is an autogenerated mock type for the ChainWriter type -type MockChainWriter struct { - mock.Mock -} - -type MockChainWriter_Expecter struct { - mock *mock.Mock -} - -func (_m *MockChainWriter) EXPECT() *MockChainWriter_Expecter { - return &MockChainWriter_Expecter{mock: &_m.Mock} -} - -// Close provides a mock function with given fields: -func (_m *MockChainWriter) 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() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockChainWriter_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' -type MockChainWriter_Close_Call struct { - *mock.Call -} - -// Close is a helper method to define mock.On call -func (_e *MockChainWriter_Expecter) Close() *MockChainWriter_Close_Call { - return &MockChainWriter_Close_Call{Call: _e.mock.On("Close")} -} - -func (_c *MockChainWriter_Close_Call) Run(run func()) *MockChainWriter_Close_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockChainWriter_Close_Call) Return(_a0 error) *MockChainWriter_Close_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockChainWriter_Close_Call) RunAndReturn(run func() error) *MockChainWriter_Close_Call { - _c.Call.Return(run) - return _c -} - -// GetFeeComponents provides a mock function with given fields: ctx -func (_m *MockChainWriter) GetFeeComponents(ctx context.Context) (*types.ChainFeeComponents, error) { - ret := _m.Called(ctx) - - if len(ret) == 0 { - panic("no return value specified for GetFeeComponents") - } - - var r0 *types.ChainFeeComponents - var r1 error - if rf, ok := ret.Get(0).(func(context.Context) (*types.ChainFeeComponents, error)); ok { - return rf(ctx) - } - if rf, ok := ret.Get(0).(func(context.Context) *types.ChainFeeComponents); ok { - r0 = rf(ctx) - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(*types.ChainFeeComponents) - } - } - - if rf, ok := ret.Get(1).(func(context.Context) error); ok { - r1 = rf(ctx) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockChainWriter_GetFeeComponents_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFeeComponents' -type MockChainWriter_GetFeeComponents_Call struct { - *mock.Call -} - -// GetFeeComponents is a helper method to define mock.On call -// - ctx context.Context -func (_e *MockChainWriter_Expecter) GetFeeComponents(ctx interface{}) *MockChainWriter_GetFeeComponents_Call { - return &MockChainWriter_GetFeeComponents_Call{Call: _e.mock.On("GetFeeComponents", ctx)} -} - -func (_c *MockChainWriter_GetFeeComponents_Call) Run(run func(ctx context.Context)) *MockChainWriter_GetFeeComponents_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) - }) - return _c -} - -func (_c *MockChainWriter_GetFeeComponents_Call) Return(_a0 *types.ChainFeeComponents, _a1 error) *MockChainWriter_GetFeeComponents_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockChainWriter_GetFeeComponents_Call) RunAndReturn(run func(context.Context) (*types.ChainFeeComponents, error)) *MockChainWriter_GetFeeComponents_Call { - _c.Call.Return(run) - return _c -} - -// GetTransactionStatus provides a mock function with given fields: ctx, transactionID -func (_m *MockChainWriter) GetTransactionStatus(ctx context.Context, transactionID string) (types.TransactionStatus, error) { - ret := _m.Called(ctx, transactionID) - - if len(ret) == 0 { - panic("no return value specified for GetTransactionStatus") - } - - var r0 types.TransactionStatus - var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (types.TransactionStatus, error)); ok { - return rf(ctx, transactionID) - } - if rf, ok := ret.Get(0).(func(context.Context, string) types.TransactionStatus); ok { - r0 = rf(ctx, transactionID) - } else { - r0 = ret.Get(0).(types.TransactionStatus) - } - - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, transactionID) - } else { - r1 = ret.Error(1) - } - - return r0, r1 -} - -// MockChainWriter_GetTransactionStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransactionStatus' -type MockChainWriter_GetTransactionStatus_Call struct { - *mock.Call -} - -// GetTransactionStatus is a helper method to define mock.On call -// - ctx context.Context -// - transactionID string -func (_e *MockChainWriter_Expecter) GetTransactionStatus(ctx interface{}, transactionID interface{}) *MockChainWriter_GetTransactionStatus_Call { - return &MockChainWriter_GetTransactionStatus_Call{Call: _e.mock.On("GetTransactionStatus", ctx, transactionID)} -} - -func (_c *MockChainWriter_GetTransactionStatus_Call) Run(run func(ctx context.Context, transactionID string)) *MockChainWriter_GetTransactionStatus_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string)) - }) - return _c -} - -func (_c *MockChainWriter_GetTransactionStatus_Call) Return(_a0 types.TransactionStatus, _a1 error) *MockChainWriter_GetTransactionStatus_Call { - _c.Call.Return(_a0, _a1) - return _c -} - -func (_c *MockChainWriter_GetTransactionStatus_Call) RunAndReturn(run func(context.Context, string) (types.TransactionStatus, error)) *MockChainWriter_GetTransactionStatus_Call { - _c.Call.Return(run) - return _c -} - -// HealthReport provides a mock function with given fields: -func (_m *MockChainWriter) HealthReport() map[string]error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for HealthReport") - } - - var r0 map[string]error - if rf, ok := ret.Get(0).(func() map[string]error); ok { - r0 = rf() - } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).(map[string]error) - } - } - - return r0 -} - -// MockChainWriter_HealthReport_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HealthReport' -type MockChainWriter_HealthReport_Call struct { - *mock.Call -} - -// HealthReport is a helper method to define mock.On call -func (_e *MockChainWriter_Expecter) HealthReport() *MockChainWriter_HealthReport_Call { - return &MockChainWriter_HealthReport_Call{Call: _e.mock.On("HealthReport")} -} - -func (_c *MockChainWriter_HealthReport_Call) Run(run func()) *MockChainWriter_HealthReport_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockChainWriter_HealthReport_Call) Return(_a0 map[string]error) *MockChainWriter_HealthReport_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockChainWriter_HealthReport_Call) RunAndReturn(run func() map[string]error) *MockChainWriter_HealthReport_Call { - _c.Call.Return(run) - return _c -} - -// Name provides a mock function with given fields: -func (_m *MockChainWriter) 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 -} - -// MockChainWriter_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' -type MockChainWriter_Name_Call struct { - *mock.Call -} - -// Name is a helper method to define mock.On call -func (_e *MockChainWriter_Expecter) Name() *MockChainWriter_Name_Call { - return &MockChainWriter_Name_Call{Call: _e.mock.On("Name")} -} - -func (_c *MockChainWriter_Name_Call) Run(run func()) *MockChainWriter_Name_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockChainWriter_Name_Call) Return(_a0 string) *MockChainWriter_Name_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockChainWriter_Name_Call) RunAndReturn(run func() string) *MockChainWriter_Name_Call { - _c.Call.Return(run) - return _c -} - -// Ready provides a mock function with given fields: -func (_m *MockChainWriter) Ready() error { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for Ready") - } - - var r0 error - if rf, ok := ret.Get(0).(func() error); ok { - r0 = rf() - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockChainWriter_Ready_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Ready' -type MockChainWriter_Ready_Call struct { - *mock.Call -} - -// Ready is a helper method to define mock.On call -func (_e *MockChainWriter_Expecter) Ready() *MockChainWriter_Ready_Call { - return &MockChainWriter_Ready_Call{Call: _e.mock.On("Ready")} -} - -func (_c *MockChainWriter_Ready_Call) Run(run func()) *MockChainWriter_Ready_Call { - _c.Call.Run(func(args mock.Arguments) { - run() - }) - return _c -} - -func (_c *MockChainWriter_Ready_Call) Return(_a0 error) *MockChainWriter_Ready_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockChainWriter_Ready_Call) RunAndReturn(run func() error) *MockChainWriter_Ready_Call { - _c.Call.Return(run) - return _c -} - -// Start provides a mock function with given fields: _a0 -func (_m *MockChainWriter) 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) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockChainWriter_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' -type MockChainWriter_Start_Call struct { - *mock.Call -} - -// Start is a helper method to define mock.On call -// - _a0 context.Context -func (_e *MockChainWriter_Expecter) Start(_a0 interface{}) *MockChainWriter_Start_Call { - return &MockChainWriter_Start_Call{Call: _e.mock.On("Start", _a0)} -} - -func (_c *MockChainWriter_Start_Call) Run(run func(_a0 context.Context)) *MockChainWriter_Start_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context)) - }) - return _c -} - -func (_c *MockChainWriter_Start_Call) Return(_a0 error) *MockChainWriter_Start_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockChainWriter_Start_Call) RunAndReturn(run func(context.Context) error) *MockChainWriter_Start_Call { - _c.Call.Return(run) - return _c -} - -// SubmitTransaction provides a mock function with given fields: ctx, contractName, method, args, transactionID, toAddress, meta, value -func (_m *MockChainWriter) SubmitTransaction(ctx context.Context, contractName string, method string, args interface{}, transactionID string, toAddress string, meta *types.TxMeta, value *big.Int) error { - ret := _m.Called(ctx, contractName, method, args, transactionID, toAddress, meta, value) - - if len(ret) == 0 { - panic("no return value specified for SubmitTransaction") - } - - var r0 error - if rf, ok := ret.Get(0).(func(context.Context, string, string, interface{}, string, string, *types.TxMeta, *big.Int) error); ok { - r0 = rf(ctx, contractName, method, args, transactionID, toAddress, meta, value) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// MockChainWriter_SubmitTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SubmitTransaction' -type MockChainWriter_SubmitTransaction_Call struct { - *mock.Call -} - -// SubmitTransaction is a helper method to define mock.On call -// - ctx context.Context -// - contractName string -// - method string -// - args interface{} -// - transactionID string -// - toAddress string -// - meta *types.TxMeta -// - value *big.Int -func (_e *MockChainWriter_Expecter) SubmitTransaction(ctx interface{}, contractName interface{}, method interface{}, args interface{}, transactionID interface{}, toAddress interface{}, meta interface{}, value interface{}) *MockChainWriter_SubmitTransaction_Call { - return &MockChainWriter_SubmitTransaction_Call{Call: _e.mock.On("SubmitTransaction", ctx, contractName, method, args, transactionID, toAddress, meta, value)} -} - -func (_c *MockChainWriter_SubmitTransaction_Call) Run(run func(ctx context.Context, contractName string, method string, args interface{}, transactionID string, toAddress string, meta *types.TxMeta, value *big.Int)) *MockChainWriter_SubmitTransaction_Call { - _c.Call.Run(func(args mock.Arguments) { - run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(interface{}), args[4].(string), args[5].(string), args[6].(*types.TxMeta), args[7].(*big.Int)) - }) - return _c -} - -func (_c *MockChainWriter_SubmitTransaction_Call) Return(_a0 error) *MockChainWriter_SubmitTransaction_Call { - _c.Call.Return(_a0) - return _c -} - -func (_c *MockChainWriter_SubmitTransaction_Call) RunAndReturn(run func(context.Context, string, string, interface{}, string, string, *types.TxMeta, *big.Int) error) *MockChainWriter_SubmitTransaction_Call { - _c.Call.Return(run) - return _c -} - -// NewMockChainWriter creates a new instance of MockChainWriter. 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 NewMockChainWriter(t interface { - mock.TestingT - Cleanup(func()) -}) *MockChainWriter { - mock := &MockChainWriter{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/mocks/chainlink_common/contract_writer.go b/mocks/chainlink_common/contract_writer.go new file mode 100644 index 000000000..64cecc205 --- /dev/null +++ b/mocks/chainlink_common/contract_writer.go @@ -0,0 +1,435 @@ +// Code generated by mockery v2.43.2. DO NOT EDIT. + +package types + +import ( + context "context" + big "math/big" + + mock "github.com/stretchr/testify/mock" + + types "github.com/smartcontractkit/chainlink-common/pkg/types" +) + +// MockContractWriter is an autogenerated mock type for the ContractWriter type +type MockContractWriter struct { + mock.Mock +} + +type MockContractWriter_Expecter struct { + mock *mock.Mock +} + +func (_m *MockContractWriter) EXPECT() *MockContractWriter_Expecter { + return &MockContractWriter_Expecter{mock: &_m.Mock} +} + +// Close provides a mock function with given fields: +func (_m *MockContractWriter) 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() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockContractWriter_Close_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Close' +type MockContractWriter_Close_Call struct { + *mock.Call +} + +// Close is a helper method to define mock.On call +func (_e *MockContractWriter_Expecter) Close() *MockContractWriter_Close_Call { + return &MockContractWriter_Close_Call{Call: _e.mock.On("Close")} +} + +func (_c *MockContractWriter_Close_Call) Run(run func()) *MockContractWriter_Close_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockContractWriter_Close_Call) Return(_a0 error) *MockContractWriter_Close_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockContractWriter_Close_Call) RunAndReturn(run func() error) *MockContractWriter_Close_Call { + _c.Call.Return(run) + return _c +} + +// GetFeeComponents provides a mock function with given fields: ctx +func (_m *MockContractWriter) GetFeeComponents(ctx context.Context) (*types.ChainFeeComponents, error) { + ret := _m.Called(ctx) + + if len(ret) == 0 { + panic("no return value specified for GetFeeComponents") + } + + var r0 *types.ChainFeeComponents + var r1 error + if rf, ok := ret.Get(0).(func(context.Context) (*types.ChainFeeComponents, error)); ok { + return rf(ctx) + } + if rf, ok := ret.Get(0).(func(context.Context) *types.ChainFeeComponents); ok { + r0 = rf(ctx) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(*types.ChainFeeComponents) + } + } + + if rf, ok := ret.Get(1).(func(context.Context) error); ok { + r1 = rf(ctx) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockContractWriter_GetFeeComponents_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetFeeComponents' +type MockContractWriter_GetFeeComponents_Call struct { + *mock.Call +} + +// GetFeeComponents is a helper method to define mock.On call +// - ctx context.Context +func (_e *MockContractWriter_Expecter) GetFeeComponents(ctx interface{}) *MockContractWriter_GetFeeComponents_Call { + return &MockContractWriter_GetFeeComponents_Call{Call: _e.mock.On("GetFeeComponents", ctx)} +} + +func (_c *MockContractWriter_GetFeeComponents_Call) Run(run func(ctx context.Context)) *MockContractWriter_GetFeeComponents_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockContractWriter_GetFeeComponents_Call) Return(_a0 *types.ChainFeeComponents, _a1 error) *MockContractWriter_GetFeeComponents_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockContractWriter_GetFeeComponents_Call) RunAndReturn(run func(context.Context) (*types.ChainFeeComponents, error)) *MockContractWriter_GetFeeComponents_Call { + _c.Call.Return(run) + return _c +} + +// GetTransactionStatus provides a mock function with given fields: ctx, transactionID +func (_m *MockContractWriter) GetTransactionStatus(ctx context.Context, transactionID string) (types.TransactionStatus, error) { + ret := _m.Called(ctx, transactionID) + + if len(ret) == 0 { + panic("no return value specified for GetTransactionStatus") + } + + var r0 types.TransactionStatus + var r1 error + if rf, ok := ret.Get(0).(func(context.Context, string) (types.TransactionStatus, error)); ok { + return rf(ctx, transactionID) + } + if rf, ok := ret.Get(0).(func(context.Context, string) types.TransactionStatus); ok { + r0 = rf(ctx, transactionID) + } else { + r0 = ret.Get(0).(types.TransactionStatus) + } + + if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { + r1 = rf(ctx, transactionID) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + +// MockContractWriter_GetTransactionStatus_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetTransactionStatus' +type MockContractWriter_GetTransactionStatus_Call struct { + *mock.Call +} + +// GetTransactionStatus is a helper method to define mock.On call +// - ctx context.Context +// - transactionID string +func (_e *MockContractWriter_Expecter) GetTransactionStatus(ctx interface{}, transactionID interface{}) *MockContractWriter_GetTransactionStatus_Call { + return &MockContractWriter_GetTransactionStatus_Call{Call: _e.mock.On("GetTransactionStatus", ctx, transactionID)} +} + +func (_c *MockContractWriter_GetTransactionStatus_Call) Run(run func(ctx context.Context, transactionID string)) *MockContractWriter_GetTransactionStatus_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string)) + }) + return _c +} + +func (_c *MockContractWriter_GetTransactionStatus_Call) Return(_a0 types.TransactionStatus, _a1 error) *MockContractWriter_GetTransactionStatus_Call { + _c.Call.Return(_a0, _a1) + return _c +} + +func (_c *MockContractWriter_GetTransactionStatus_Call) RunAndReturn(run func(context.Context, string) (types.TransactionStatus, error)) *MockContractWriter_GetTransactionStatus_Call { + _c.Call.Return(run) + return _c +} + +// HealthReport provides a mock function with given fields: +func (_m *MockContractWriter) HealthReport() map[string]error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for HealthReport") + } + + var r0 map[string]error + if rf, ok := ret.Get(0).(func() map[string]error); ok { + r0 = rf() + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).(map[string]error) + } + } + + return r0 +} + +// MockContractWriter_HealthReport_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'HealthReport' +type MockContractWriter_HealthReport_Call struct { + *mock.Call +} + +// HealthReport is a helper method to define mock.On call +func (_e *MockContractWriter_Expecter) HealthReport() *MockContractWriter_HealthReport_Call { + return &MockContractWriter_HealthReport_Call{Call: _e.mock.On("HealthReport")} +} + +func (_c *MockContractWriter_HealthReport_Call) Run(run func()) *MockContractWriter_HealthReport_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockContractWriter_HealthReport_Call) Return(_a0 map[string]error) *MockContractWriter_HealthReport_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockContractWriter_HealthReport_Call) RunAndReturn(run func() map[string]error) *MockContractWriter_HealthReport_Call { + _c.Call.Return(run) + return _c +} + +// Name provides a mock function with given fields: +func (_m *MockContractWriter) 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 +} + +// MockContractWriter_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name' +type MockContractWriter_Name_Call struct { + *mock.Call +} + +// Name is a helper method to define mock.On call +func (_e *MockContractWriter_Expecter) Name() *MockContractWriter_Name_Call { + return &MockContractWriter_Name_Call{Call: _e.mock.On("Name")} +} + +func (_c *MockContractWriter_Name_Call) Run(run func()) *MockContractWriter_Name_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockContractWriter_Name_Call) Return(_a0 string) *MockContractWriter_Name_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockContractWriter_Name_Call) RunAndReturn(run func() string) *MockContractWriter_Name_Call { + _c.Call.Return(run) + return _c +} + +// Ready provides a mock function with given fields: +func (_m *MockContractWriter) Ready() error { + ret := _m.Called() + + if len(ret) == 0 { + panic("no return value specified for Ready") + } + + var r0 error + if rf, ok := ret.Get(0).(func() error); ok { + r0 = rf() + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockContractWriter_Ready_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Ready' +type MockContractWriter_Ready_Call struct { + *mock.Call +} + +// Ready is a helper method to define mock.On call +func (_e *MockContractWriter_Expecter) Ready() *MockContractWriter_Ready_Call { + return &MockContractWriter_Ready_Call{Call: _e.mock.On("Ready")} +} + +func (_c *MockContractWriter_Ready_Call) Run(run func()) *MockContractWriter_Ready_Call { + _c.Call.Run(func(args mock.Arguments) { + run() + }) + return _c +} + +func (_c *MockContractWriter_Ready_Call) Return(_a0 error) *MockContractWriter_Ready_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockContractWriter_Ready_Call) RunAndReturn(run func() error) *MockContractWriter_Ready_Call { + _c.Call.Return(run) + return _c +} + +// Start provides a mock function with given fields: _a0 +func (_m *MockContractWriter) 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) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockContractWriter_Start_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Start' +type MockContractWriter_Start_Call struct { + *mock.Call +} + +// Start is a helper method to define mock.On call +// - _a0 context.Context +func (_e *MockContractWriter_Expecter) Start(_a0 interface{}) *MockContractWriter_Start_Call { + return &MockContractWriter_Start_Call{Call: _e.mock.On("Start", _a0)} +} + +func (_c *MockContractWriter_Start_Call) Run(run func(_a0 context.Context)) *MockContractWriter_Start_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context)) + }) + return _c +} + +func (_c *MockContractWriter_Start_Call) Return(_a0 error) *MockContractWriter_Start_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockContractWriter_Start_Call) RunAndReturn(run func(context.Context) error) *MockContractWriter_Start_Call { + _c.Call.Return(run) + return _c +} + +// SubmitTransaction provides a mock function with given fields: ctx, contractName, method, args, transactionID, toAddress, meta, value +func (_m *MockContractWriter) SubmitTransaction(ctx context.Context, contractName string, method string, args interface{}, transactionID string, toAddress string, meta *types.TxMeta, value *big.Int) error { + ret := _m.Called(ctx, contractName, method, args, transactionID, toAddress, meta, value) + + if len(ret) == 0 { + panic("no return value specified for SubmitTransaction") + } + + var r0 error + if rf, ok := ret.Get(0).(func(context.Context, string, string, interface{}, string, string, *types.TxMeta, *big.Int) error); ok { + r0 = rf(ctx, contractName, method, args, transactionID, toAddress, meta, value) + } else { + r0 = ret.Error(0) + } + + return r0 +} + +// MockContractWriter_SubmitTransaction_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'SubmitTransaction' +type MockContractWriter_SubmitTransaction_Call struct { + *mock.Call +} + +// SubmitTransaction is a helper method to define mock.On call +// - ctx context.Context +// - contractName string +// - method string +// - args interface{} +// - transactionID string +// - toAddress string +// - meta *types.TxMeta +// - value *big.Int +func (_e *MockContractWriter_Expecter) SubmitTransaction(ctx interface{}, contractName interface{}, method interface{}, args interface{}, transactionID interface{}, toAddress interface{}, meta interface{}, value interface{}) *MockContractWriter_SubmitTransaction_Call { + return &MockContractWriter_SubmitTransaction_Call{Call: _e.mock.On("SubmitTransaction", ctx, contractName, method, args, transactionID, toAddress, meta, value)} +} + +func (_c *MockContractWriter_SubmitTransaction_Call) Run(run func(ctx context.Context, contractName string, method string, args interface{}, transactionID string, toAddress string, meta *types.TxMeta, value *big.Int)) *MockContractWriter_SubmitTransaction_Call { + _c.Call.Run(func(args mock.Arguments) { + run(args[0].(context.Context), args[1].(string), args[2].(string), args[3].(interface{}), args[4].(string), args[5].(string), args[6].(*types.TxMeta), args[7].(*big.Int)) + }) + return _c +} + +func (_c *MockContractWriter_SubmitTransaction_Call) Return(_a0 error) *MockContractWriter_SubmitTransaction_Call { + _c.Call.Return(_a0) + return _c +} + +func (_c *MockContractWriter_SubmitTransaction_Call) RunAndReturn(run func(context.Context, string, string, interface{}, string, string, *types.TxMeta, *big.Int) error) *MockContractWriter_SubmitTransaction_Call { + _c.Call.Return(run) + return _c +} + +// NewMockContractWriter creates a new instance of MockContractWriter. 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 NewMockContractWriter(t interface { + mock.TestingT + Cleanup(func()) +}) *MockContractWriter { + mock := &MockContractWriter{} + mock.Mock.Test(t) + + t.Cleanup(func() { mock.AssertExpectations(t) }) + + return mock +} diff --git a/pkg/reader/ccip.go b/pkg/reader/ccip.go index e3ea281cc..84503cd4b 100644 --- a/pkg/reader/ccip.go +++ b/pkg/reader/ccip.go @@ -38,7 +38,7 @@ import ( type ccipChainReader struct { lggr logger.Logger contractReaders map[cciptypes.ChainSelector]contractreader.Extended - contractWriters map[cciptypes.ChainSelector]types.ChainWriter + contractWriters map[cciptypes.ChainSelector]types.ContractWriter destChain cciptypes.ChainSelector offrampAddress string } @@ -47,7 +47,7 @@ func newCCIPChainReaderInternal( ctx context.Context, lggr logger.Logger, contractReaders map[cciptypes.ChainSelector]contractreader.ContractReaderFacade, - contractWriters map[cciptypes.ChainSelector]types.ChainWriter, + contractWriters map[cciptypes.ChainSelector]types.ContractWriter, destChain cciptypes.ChainSelector, offrampAddress []byte, ) *ccipChainReader { diff --git a/pkg/reader/ccip_interface.go b/pkg/reader/ccip_interface.go index fa12371f9..7c95b032a 100644 --- a/pkg/reader/ccip_interface.go +++ b/pkg/reader/ccip_interface.go @@ -41,7 +41,7 @@ func NewCCIPChainReader( ctx context.Context, lggr logger.Logger, contractReaders map[cciptypes.ChainSelector]contractreader.ContractReaderFacade, - contractWriters map[cciptypes.ChainSelector]types.ChainWriter, + contractWriters map[cciptypes.ChainSelector]types.ContractWriter, destChain cciptypes.ChainSelector, offrampAddress []byte, ) CCIPReader { @@ -60,7 +60,7 @@ func NewCCIPReaderWithExtendedContractReaders( ctx context.Context, lggr logger.Logger, contractReaders map[cciptypes.ChainSelector]contractreader.Extended, - contractWriters map[cciptypes.ChainSelector]types.ChainWriter, + contractWriters map[cciptypes.ChainSelector]types.ContractWriter, destChain cciptypes.ChainSelector, offrampAddress []byte, ) CCIPReader { diff --git a/pkg/reader/ccip_test.go b/pkg/reader/ccip_test.go index 25fe25654..b2b135541 100644 --- a/pkg/reader/ccip_test.go +++ b/pkg/reader/ccip_test.go @@ -922,7 +922,7 @@ func TestCCIPChainReader_getFeeQuoterTokenPriceUSD(t *testing.T) { } func TestCCIPFeeComponents_HappyPath(t *testing.T) { - cw := writer_mocks.NewMockChainWriter(t) + cw := writer_mocks.NewMockContractWriter(t) cw.EXPECT().GetFeeComponents(mock.Anything).Return( &types.ChainFeeComponents{ ExecutionFee: big.NewInt(1), @@ -930,7 +930,7 @@ func TestCCIPFeeComponents_HappyPath(t *testing.T) { }, nil, ) - contractWriters := make(map[cciptypes.ChainSelector]types.ChainWriter) + contractWriters := make(map[cciptypes.ChainSelector]types.ContractWriter) // Missing writer for chainB contractWriters[chainA] = cw contractWriters[chainC] = cw @@ -958,8 +958,8 @@ func TestCCIPFeeComponents_HappyPath(t *testing.T) { } func TestCCIPFeeComponents_NotFoundErrors(t *testing.T) { - cw := writer_mocks.NewMockChainWriter(t) - contractWriters := make(map[cciptypes.ChainSelector]types.ChainWriter) + cw := writer_mocks.NewMockContractWriter(t) + contractWriters := make(map[cciptypes.ChainSelector]types.ContractWriter) // Missing writer for dest chain chainC contractWriters[chainA] = cw ccipReader := newCCIPChainReaderInternal(