From 9ba5e764181c8723cad396477b5c165f166fbbe9 Mon Sep 17 00:00:00 2001 From: ilija Date: Fri, 24 May 2024 19:02:32 +0200 Subject: [PATCH] Fix lint --- pkg/loop/adapters/relay/relay_test.go | 2 +- .../relayer/pluginprovider/chainreader/chain_reader.go | 8 ++++---- .../pluginprovider/chainreader/chain_reader_test.go | 4 ++-- .../pluginprovider/chainreader/test/chain_reader.go | 8 ++++---- .../chainreader/test/chain_reader_loop_tester.go | 4 ++-- .../pluginprovider/ext/ccip/test/commit_provider.go | 2 +- .../relayer/pluginprovider/ext/ccip/test/exec_provider.go | 2 +- .../internal/relayer/pluginprovider/ext/median/median.go | 4 ++-- .../relayer/pluginprovider/ext/median/test/median.go | 2 +- .../relayer/pluginprovider/ext/mercury/mercury.go | 4 ++-- .../relayer/pluginprovider/ext/mercury/test/provider.go | 2 +- .../relayer/pluginprovider/ocr2/plugin_provider.go | 4 ++-- .../relayer/pluginprovider/ocr2/test/plugin_provider.go | 2 +- .../inprocessprovider/grpc_provider_server_test.go | 2 +- .../inprocessprovider/standalone_provider_test.go | 4 ++-- pkg/loop/internal/test/types/interfaces.go | 4 ++-- pkg/loop/testutils/utils.go | 2 +- pkg/types/interfacetests/chain_reader_interface_tests.go | 2 +- 18 files changed, 31 insertions(+), 31 deletions(-) diff --git a/pkg/loop/adapters/relay/relay_test.go b/pkg/loop/adapters/relay/relay_test.go index d2a9a1e25..73d9144c1 100644 --- a/pkg/loop/adapters/relay/relay_test.go +++ b/pkg/loop/adapters/relay/relay_test.go @@ -50,7 +50,7 @@ func (s staticMedianProvider) ReportCodec() median.ReportCodec { } // ChainReader implements types.MedianProvider. -func (s staticMedianProvider) ChainReader() types.ChainReader { +func (s staticMedianProvider) ChainReader() types.ContractReader { return nil } diff --git a/pkg/loop/internal/relayer/pluginprovider/chainreader/chain_reader.go b/pkg/loop/internal/relayer/pluginprovider/chainreader/chain_reader.go index c38a6408e..0f5f8e807 100644 --- a/pkg/loop/internal/relayer/pluginprovider/chainreader/chain_reader.go +++ b/pkg/loop/internal/relayer/pluginprovider/chainreader/chain_reader.go @@ -21,7 +21,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types/query/primitives" ) -var _ types.ChainReader = (*Client)(nil) +var _ types.ContractReader = (*Client)(nil) type Client struct { *goplugin.ServiceClient @@ -145,13 +145,13 @@ func (c *Client) Bind(ctx context.Context, bindings []types.BoundContract) error var _ pb.ChainReaderServer = (*Server)(nil) -func NewServer(impl types.ChainReader) pb.ChainReaderServer { +func NewServer(impl types.ContractReader) pb.ChainReaderServer { return &Server{impl: impl} } type Server struct { pb.UnimplementedChainReaderServer - impl types.ChainReader + impl types.ContractReader } func (c *Server) GetLatestValue(ctx context.Context, request *pb.GetLatestValueRequest) (*pb.GetLatestValueReply, error) { @@ -484,6 +484,6 @@ func convertSequencesFromProto(pbSequences []*pb.Sequence, sequenceDataType any) return sequences, nil } -func RegisterContractReaderService(s *grpc.Server, contractReader types.ChainReader) { +func RegisterContractReaderService(s *grpc.Server, contractReader types.ContractReader) { pb.RegisterServiceServer(s, &goplugin.ServiceServer{Srv: contractReader}) } diff --git a/pkg/loop/internal/relayer/pluginprovider/chainreader/chain_reader_test.go b/pkg/loop/internal/relayer/pluginprovider/chainreader/chain_reader_test.go index caaefb18b..9c06647c8 100644 --- a/pkg/loop/internal/relayer/pluginprovider/chainreader/chain_reader_test.go +++ b/pkg/loop/internal/relayer/pluginprovider/chainreader/chain_reader_test.go @@ -172,7 +172,7 @@ func makeEncoder() cbor.EncMode { type fakeChainReaderInterfaceTester struct { interfaceTesterBase - impl types.ChainReader + impl types.ContractReader } func (it *fakeChainReaderInterfaceTester) Setup(_ *testing.T) { @@ -183,7 +183,7 @@ func (it *fakeChainReaderInterfaceTester) Setup(_ *testing.T) { } } -func (it *fakeChainReaderInterfaceTester) GetChainReader(_ *testing.T) types.ChainReader { +func (it *fakeChainReaderInterfaceTester) GetChainReader(_ *testing.T) types.ContractReader { return it.impl } diff --git a/pkg/loop/internal/relayer/pluginprovider/chainreader/test/chain_reader.go b/pkg/loop/internal/relayer/pluginprovider/chainreader/test/chain_reader.go index 15ab8111c..d4ecd7ed4 100644 --- a/pkg/loop/internal/relayer/pluginprovider/chainreader/test/chain_reader.go +++ b/pkg/loop/internal/relayer/pluginprovider/chainreader/test/chain_reader.go @@ -12,7 +12,7 @@ import ( ) var ( - // ChainReader is a static implementation of [types.ChainReader], [testtypes.Evaluator] and [types.PluginProvider + // ChainReader is a static implementation of [types.ContractReader], [testtypes.Evaluator] and [types.PluginProvider // it is used for testing the [types.PluginProvider] interface ChainReader = staticChainReader{ contractName: "anyContract", @@ -30,8 +30,8 @@ type staticChainReader struct { params map[string]any } -var _ testtypes.Evaluator[types.ChainReader] = staticChainReader{} -var _ types.ChainReader = staticChainReader{} +var _ testtypes.Evaluator[types.ContractReader] = staticChainReader{} +var _ types.ContractReader = staticChainReader{} func (c staticChainReader) Start(_ context.Context) error { return nil } @@ -78,7 +78,7 @@ func (c staticChainReader) QueryKey(_ context.Context, _ string, _ query.KeyFilt return nil, nil } -func (c staticChainReader) Evaluate(ctx context.Context, cr types.ChainReader) error { +func (c staticChainReader) Evaluate(ctx context.Context, cr types.ContractReader) error { gotLatestValue := make(map[string]any) err := cr.GetLatestValue(ctx, c.contractName, c.contractMethod, &c.params, &gotLatestValue) if err != nil { diff --git a/pkg/loop/internal/relayer/pluginprovider/chainreader/test/chain_reader_loop_tester.go b/pkg/loop/internal/relayer/pluginprovider/chainreader/test/chain_reader_loop_tester.go index 15b5c21d7..8374ff96c 100644 --- a/pkg/loop/internal/relayer/pluginprovider/chainreader/test/chain_reader_loop_tester.go +++ b/pkg/loop/internal/relayer/pluginprovider/chainreader/test/chain_reader_loop_tester.go @@ -11,7 +11,7 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/types/interfacetests" ) -// WrapChainReaderTesterForLoop allows you to test a [types.ChainReader] implementation behind a LOOP server +// WrapChainReaderTesterForLoop allows you to test a [types.ContractReader] implementation behind a LOOP server func WrapChainReaderTesterForLoop(wrapped interfacetests.ChainReaderInterfaceTester) interfacetests.ChainReaderInterfaceTester { return &chainReaderLoopTester{ChainReaderInterfaceTester: wrapped} } @@ -33,7 +33,7 @@ func (c *chainReaderLoopTester) Setup(t *testing.T) { c.lst.Setup(t) } -func (c *chainReaderLoopTester) GetChainReader(t *testing.T) types.ChainReader { +func (c *chainReaderLoopTester) GetChainReader(t *testing.T) types.ContractReader { return chainreader.NewClient(nil, c.lst.GetConn(t)) } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_provider.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_provider.go index 4937bf087..dd8208368 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_provider.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/commit_provider.go @@ -64,7 +64,7 @@ type staticCommitProvider struct { } // ChainReader implements CommitProviderEvaluator. -func (s staticCommitProvider) ChainReader() types.ChainReader { +func (s staticCommitProvider) ChainReader() types.ContractReader { return nil } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_provider.go b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_provider.go index 5dc7200c5..191df873a 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_provider.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/ccip/test/exec_provider.go @@ -66,7 +66,7 @@ type staticExecProvider struct { } // ChainReader implements ExecProviderEvaluator. -func (s staticExecProvider) ChainReader() types.ChainReader { +func (s staticExecProvider) ChainReader() types.ContractReader { return nil } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/median/median.go b/pkg/loop/internal/relayer/pluginprovider/ext/median/median.go index aa2b20ffb..1e1dd615a 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/median/median.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/median/median.go @@ -34,7 +34,7 @@ type ProviderClient struct { reportCodec median.ReportCodec medianContract median.MedianContract onchainConfigCodec median.OnchainConfigCodec - chainReader types.ChainReader + chainReader types.ContractReader codec types.Codec } @@ -72,7 +72,7 @@ func (m *ProviderClient) OnchainConfigCodec() median.OnchainConfigCodec { return m.onchainConfigCodec } -func (m *ProviderClient) ChainReader() types.ChainReader { +func (m *ProviderClient) ChainReader() types.ContractReader { return m.chainReader } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/median/test/median.go b/pkg/loop/internal/relayer/pluginprovider/ext/median/test/median.go index 8d714c6e5..57496c2a3 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/median/test/median.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/median/test/median.go @@ -231,7 +231,7 @@ func (s staticMedianProvider) OnchainConfigCodec() median.OnchainConfigCodec { return s.onchainConfigCodec } -func (s staticMedianProvider) ChainReader() types.ChainReader { +func (s staticMedianProvider) ChainReader() types.ContractReader { return s.chainReader } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/mercury.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/mercury.go index b4ac2b2b5..eb3904793 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/mercury.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/mercury.go @@ -32,7 +32,7 @@ type ProviderClient struct { reportCodecV1 mercury_v1.ReportCodec onchainConfigCodec mercury.OnchainConfigCodec serverFetcher mercury.ServerFetcher - chainReader types.ChainReader + chainReader types.ContractReader mercuryChainReader mercury.ChainReader } @@ -67,7 +67,7 @@ func (m *ProviderClient) OnchainConfigCodec() mercury.OnchainConfigCodec { return m.onchainConfigCodec } -func (m *ProviderClient) ChainReader() types.ChainReader { +func (m *ProviderClient) ChainReader() types.ContractReader { return m.chainReader } diff --git a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/provider.go b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/provider.go index d76533a86..9dbc919e9 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/provider.go +++ b/pkg/loop/internal/relayer/pluginprovider/ext/mercury/test/provider.go @@ -103,7 +103,7 @@ func (s staticMercuryProvider) MercuryChainReader() mercurytypes.ChainReader { return s.mercuryChainReader } -func (s staticMercuryProvider) ChainReader() types.ChainReader { +func (s staticMercuryProvider) ChainReader() types.ContractReader { //panic("mercury does not use the general ChainReader interface yet") return nil } diff --git a/pkg/loop/internal/relayer/pluginprovider/ocr2/plugin_provider.go b/pkg/loop/internal/relayer/pluginprovider/ocr2/plugin_provider.go index 0cccb241a..ebb4493f9 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ocr2/plugin_provider.go +++ b/pkg/loop/internal/relayer/pluginprovider/ocr2/plugin_provider.go @@ -14,7 +14,7 @@ import ( type PluginProviderClient struct { *ConfigProviderClient contractTransmitter libocr.ContractTransmitter - chainReader types.ChainReader + chainReader types.ContractReader codec types.Codec } @@ -35,7 +35,7 @@ func (p *PluginProviderClient) ContractTransmitter() libocr.ContractTransmitter return p.contractTransmitter } -func (p *PluginProviderClient) ChainReader() types.ChainReader { +func (p *PluginProviderClient) ChainReader() types.ContractReader { return p.chainReader } diff --git a/pkg/loop/internal/relayer/pluginprovider/ocr2/test/plugin_provider.go b/pkg/loop/internal/relayer/pluginprovider/ocr2/test/plugin_provider.go index 042c48338..3849d9a56 100644 --- a/pkg/loop/internal/relayer/pluginprovider/ocr2/test/plugin_provider.go +++ b/pkg/loop/internal/relayer/pluginprovider/ocr2/test/plugin_provider.go @@ -55,7 +55,7 @@ func (s staticPluginProvider) ContractTransmitter() libocr.ContractTransmitter { return s.contractTransmitter } -func (s staticPluginProvider) ChainReader() types.ChainReader { +func (s staticPluginProvider) ChainReader() types.ContractReader { return s.chainReader } diff --git a/pkg/loop/internal/relayerset/inprocessprovider/grpc_provider_server_test.go b/pkg/loop/internal/relayerset/inprocessprovider/grpc_provider_server_test.go index f1816a1ef..98d025103 100644 --- a/pkg/loop/internal/relayerset/inprocessprovider/grpc_provider_server_test.go +++ b/pkg/loop/internal/relayerset/inprocessprovider/grpc_provider_server_test.go @@ -95,7 +95,7 @@ func (s staticMedianProvider) ReportCodec() median.ReportCodec { } // ChainReader implements types.MedianProvider. -func (s staticMedianProvider) ChainReader() types.ChainReader { +func (s staticMedianProvider) ChainReader() types.ContractReader { return nil } diff --git a/pkg/loop/internal/relayerset/inprocessprovider/standalone_provider_test.go b/pkg/loop/internal/relayerset/inprocessprovider/standalone_provider_test.go index 3dcf0b330..83153f750 100644 --- a/pkg/loop/internal/relayerset/inprocessprovider/standalone_provider_test.go +++ b/pkg/loop/internal/relayerset/inprocessprovider/standalone_provider_test.go @@ -72,7 +72,7 @@ func (t testMedianProvider) ContractTransmitter() libocr.ContractTransmitter { return nil } -func (t testMedianProvider) ChainReader() types.ChainReader { +func (t testMedianProvider) ChainReader() types.ContractReader { return nil } @@ -127,7 +127,7 @@ func (t testPluginProvider) ContractTransmitter() ocrtypes.ContractTransmitter { return nil } -func (t testPluginProvider) ChainReader() types.ChainReader { +func (t testPluginProvider) ChainReader() types.ContractReader { return nil } diff --git a/pkg/loop/internal/test/types/interfaces.go b/pkg/loop/internal/test/types/interfaces.go index 74295bf92..346e00d42 100644 --- a/pkg/loop/internal/test/types/interfaces.go +++ b/pkg/loop/internal/test/types/interfaces.go @@ -30,8 +30,8 @@ type AssertEqualer[T any] interface { // ChainReaderTester is a helper interface for testing ChainReaders type ChainReaderTester interface { - types.ChainReader - Evaluator[types.ChainReader] + types.ContractReader + Evaluator[types.ContractReader] } // ContractTransmitterEvaluator is a helper interface for testing ContractTransmitters diff --git a/pkg/loop/testutils/utils.go b/pkg/loop/testutils/utils.go index e21a5902c..55ab178fa 100644 --- a/pkg/loop/testutils/utils.go +++ b/pkg/loop/testutils/utils.go @@ -9,7 +9,7 @@ import ( // the duplication of the function is required so that the test of the LOOP servers themselves // can dog food the same testers without creating a circular dependency. -// WrapChainReaderTesterForLoop allows you to test a [types.ChainReader] implementation behind a LOOP server +// WrapChainReaderTesterForLoop allows you to test a [types.ContractReader] implementation behind a LOOP server func WrapChainReaderTesterForLoop(wrapped interfacetests.ChainReaderInterfaceTester) interfacetests.ChainReaderInterfaceTester { return test.WrapChainReaderTesterForLoop(wrapped) } diff --git a/pkg/types/interfacetests/chain_reader_interface_tests.go b/pkg/types/interfacetests/chain_reader_interface_tests.go index f7a424348..00fa98c98 100644 --- a/pkg/types/interfacetests/chain_reader_interface_tests.go +++ b/pkg/types/interfacetests/chain_reader_interface_tests.go @@ -16,7 +16,7 @@ import ( type ChainReaderInterfaceTester interface { BasicTester - GetChainReader(t *testing.T) types.ChainReader + GetChainReader(t *testing.T) types.ContractReader // SetLatestValue is expected to return the same bound contract and method in the same test // Any setup required for this should be done in Setup.