Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
ilija42 committed May 24, 2024
1 parent 4faf6e0 commit 9ba5e76
Show file tree
Hide file tree
Showing 18 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion pkg/loop/adapters/relay/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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})
}
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ func makeEncoder() cbor.EncMode {

type fakeChainReaderInterfaceTester struct {
interfaceTesterBase
impl types.ChainReader
impl types.ContractReader
}

func (it *fakeChainReaderInterfaceTester) Setup(_ *testing.T) {
Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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 }

Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
}
Expand All @@ -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))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ type staticCommitProvider struct {
}

// ChainReader implements CommitProviderEvaluator.
func (s staticCommitProvider) ChainReader() types.ChainReader {
func (s staticCommitProvider) ChainReader() types.ContractReader {
return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ type staticExecProvider struct {
}

// ChainReader implements ExecProviderEvaluator.
func (s staticExecProvider) ChainReader() types.ChainReader {
func (s staticExecProvider) ChainReader() types.ContractReader {
return nil
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/loop/internal/relayer/pluginprovider/ext/median/median.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
type PluginProviderClient struct {
*ConfigProviderClient
contractTransmitter libocr.ContractTransmitter
chainReader types.ChainReader
chainReader types.ContractReader
codec types.Codec
}

Expand All @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/loop/internal/test/types/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/loop/testutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/types/interfacetests/chain_reader_interface_tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9ba5e76

Please sign in to comment.