Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Satisfy Relayer interface with unsupported NewContractReader impl. #718

Merged
merged 4 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cmd/monitoring/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"context"
"fmt"

"github.com/gagliardetto/solana-go/rpc"
Expand Down Expand Up @@ -44,7 +43,7 @@ func main() {
)

monitor, err := commonMonitoring.NewMonitor(
context.Background(),
make(chan struct{}),
log,
chainConfig,
envelopeSourceFactory,
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/mitchellh/mapstructure v1.5.0
github.com/pelletier/go-toml/v2 v2.1.1
github.com/prometheus/client_golang v1.17.0
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240522203001-10ea0211efd7
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240524173852-a74b009c7303
github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c
github.com/stretchr/testify v1.9.0
go.uber.org/zap v1.26.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240522203001-10ea0211efd7 h1:od+11B83s0mQwAMPP3lhtb0nYz63pIKpJEKddfFpu/M=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240522203001-10ea0211efd7/go.mod h1:cFHRblGbGn/rFYOOGsNbtLicMc1+5YdN0KoebYr93pk=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240524173852-a74b009c7303 h1:iyLE5c2YFxy89t2v5u+aQOHqRE4c+sCMze70KIo07mI=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240524173852-a74b009c7303/go.mod h1:DUZccDEW98n+J1mhdWGO7wr/Njad9p9Fzks839JN7Rs=
github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss=
github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4=
github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU=
Expand Down
12 changes: 6 additions & 6 deletions integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ require (
github.com/lib/pq v1.10.9
github.com/pelletier/go-toml/v2 v2.1.1
github.com/rs/zerolog v1.30.0
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240522203001-10ea0211efd7
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240524131846-a10ff1f030c9
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240524173852-a74b009c7303
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240524160213-b47649f55e0b
github.com/smartcontractkit/chainlink-testing-framework v1.28.15
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240524135402-6bd866a31530
github.com/smartcontractkit/chainlink/v2 v2.10.0-beta0.0.20240524135402-6bd866a31530
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240524164411-7a51959eb75a
github.com/smartcontractkit/chainlink/v2 v2.10.0-beta0.0.20240524164411-7a51959eb75a
github.com/smartcontractkit/libocr v0.0.0-20240419185742-fd3cab206b2c
github.com/smartcontractkit/seth v1.0.9
github.com/stretchr/testify v1.9.0
Expand Down Expand Up @@ -359,10 +359,10 @@ require (
github.com/slack-go/slack v0.12.2 // indirect
github.com/smartcontractkit/chain-selectors v1.0.10 // indirect
github.com/smartcontractkit/chainlink-automation v1.0.3 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240508101745-af1ed7bc8a69 // indirect
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524163550-be7ac130554f // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240522213638-159fb2d99917 // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240524163844-2b5c69896faa // indirect
github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240328204215-ac91f55f1449 // indirect
github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772 // indirect
github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect
Expand Down
20 changes: 10 additions & 10 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1406,26 +1406,26 @@ github.com/smartcontractkit/chain-selectors v1.0.10 h1:t9kJeE6B6G+hKD0GYR4kGJSCq
github.com/smartcontractkit/chain-selectors v1.0.10/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE=
github.com/smartcontractkit/chainlink-automation v1.0.3 h1:h/ijT0NiyV06VxYVgcNfsE3+8OEzT3Q0Z9au0z1BPWs=
github.com/smartcontractkit/chainlink-automation v1.0.3/go.mod h1:RjboV0Qd7YP+To+OrzHGXaxUxoSONveCoAK2TQ1INLU=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240522203001-10ea0211efd7 h1:od+11B83s0mQwAMPP3lhtb0nYz63pIKpJEKddfFpu/M=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240522203001-10ea0211efd7/go.mod h1:cFHRblGbGn/rFYOOGsNbtLicMc1+5YdN0KoebYr93pk=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240508101745-af1ed7bc8a69 h1:Sec/GpBpUVaTEax1kSHlTvkzF/+d3w5roAQXaj5+SLA=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240508101745-af1ed7bc8a69/go.mod h1:ZQKf+0OLzCLYIisH/OdOIQuFRI6bDuw+jPBTATyHfFM=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240524173852-a74b009c7303 h1:iyLE5c2YFxy89t2v5u+aQOHqRE4c+sCMze70KIo07mI=
github.com/smartcontractkit/chainlink-common v0.1.7-0.20240524173852-a74b009c7303/go.mod h1:DUZccDEW98n+J1mhdWGO7wr/Njad9p9Fzks839JN7Rs=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524163550-be7ac130554f h1:k8h4Yjj3kXKm11dujvcknkplDOqmFz+d+8bwQFOzq6E=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240524163550-be7ac130554f/go.mod h1:reWTkkx0lPclYjRa3kFaV2fmbDl6H06HLiAFhsNoP8E=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 h1:xFSv8561jsLtF6gYZr/zW2z5qUUAkcFkApin2mnbYTo=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540/go.mod h1:sjAmX8K2kbQhvDarZE1ZZgDgmHJ50s0BBc/66vKY2ek=
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240522213638-159fb2d99917 h1:MD80ZRCTvxxJ8PBmhtrKoTnky8cVNYrCrIBLVRbrOM0=
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240522213638-159fb2d99917/go.mod h1:jwVxhctE6BgLOSSsVq9wbREpZ8Ev34H+UBxeUhESZRs=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 h1:ssh/w3oXWu+C6bE88GuFRC1+0Bx/4ihsbc80XMLrl2k=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69/go.mod h1:VsfjhvWgjxqWja4q+FlXEtX5lu8BSxn10xRo6gi948g=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240524163844-2b5c69896faa h1:mbjbmV83e5u761pqWqbGg+MyH64z0B9QM5ZjboVG2js=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240524163844-2b5c69896faa/go.mod h1:DBWzejxlSL855eM8DphHrxvJ9WhQ9C6cBHEGbcomFwQ=
github.com/smartcontractkit/chainlink-testing-framework v1.28.15 h1:mga7N6jtXQ3UOCt43IdsEnCMBh9xjOWPaE9BiM6kr6Q=
github.com/smartcontractkit/chainlink-testing-framework v1.28.15/go.mod h1:x1zDOz8zcLjEvs9fNA9y/DMguLam/2+CJdpxX0+rM8A=
github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240328204215-ac91f55f1449 h1:fX/xmGm1GBsD1ZZnooNT+eWA0hiTAqFlHzOC5CY4dy8=
github.com/smartcontractkit/chainlink-testing-framework/grafana v0.0.0-20240328204215-ac91f55f1449/go.mod h1:DC8sQMyTlI/44UCTL8QWFwb0bYNoXCfjwCv2hMivYZU=
github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772 h1:LQmRsrzzaYYN3wEU1l5tWiccznhvbyGnu2N+wHSXZAo=
github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772/go.mod h1:Kn1Hape05UzFZ7bOUnm3GVsHzP0TNrVmpfXYNHdqGGs=
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240524135402-6bd866a31530 h1:QmIxClaisbyLQ06Ztbq+u1pvd9j/7fDC2QKHq3GbFQg=
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240524135402-6bd866a31530/go.mod h1:+a2IIu/Q1+fB9mPkbjNyYUZcM91YDYfivzByE9kDIco=
github.com/smartcontractkit/chainlink/v2 v2.10.0-beta0.0.20240524135402-6bd866a31530 h1:yEddXtOMcIlx+UbI+DfeFcYdyd3xM8/xlCl1Qa9W7ik=
github.com/smartcontractkit/chainlink/v2 v2.10.0-beta0.0.20240524135402-6bd866a31530/go.mod h1:GoS6m5Bn8aAYLgy2231pxbfr4fSD3rmJBd0Jg2m+gvs=
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240524164411-7a51959eb75a h1:MvkbkOXU5SKKCEMWcqvuEYDTjDOLBT1UvOaPDFMITtY=
github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240524164411-7a51959eb75a/go.mod h1:CD4LdBwQCtHjpID2UZTUuISMd06R8AnmcgcYGAgA9+I=
github.com/smartcontractkit/chainlink/v2 v2.10.0-beta0.0.20240524164411-7a51959eb75a h1:C3yHYi9OuddN3mi3h6aaAbxjz0pNHhV2T+MD1sCIaZM=
github.com/smartcontractkit/chainlink/v2 v2.10.0-beta0.0.20240524164411-7a51959eb75a/go.mod h1:hTGmFkhasOS1P+DeUppBu1FmjMKAv/Vijumuqh3o2ow=
github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss=
github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4=
github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f h1:hgJif132UCdjo8u43i7iPN1/MFnu49hv7lFGFftCHKU=
Expand Down
10 changes: 5 additions & 5 deletions pkg/solana/chainreader/chain_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ type SolanaChainReaderService struct {
}

var (
_ services.Service = &SolanaChainReaderService{}
_ types.ChainReader = &SolanaChainReaderService{}
_ services.Service = &SolanaChainReaderService{}
_ types.ContractReader = &SolanaChainReaderService{}
)

// NewChainReaderService is a constructor for a new ChainReaderService for Solana. Returns a nil service on error.
Expand Down Expand Up @@ -91,7 +91,7 @@ func (s *SolanaChainReaderService) HealthReport() map[string]error {
return map[string]error{s.Name(): s.Healthy()}
}

// GetLatestValue implements the types.ChainReader interface and requests and parses on-chain
// GetLatestValue implements the types.ContractReader interface and requests and parses on-chain
// data named by the provided contract, method, and params.
func (s *SolanaChainReaderService) GetLatestValue(ctx context.Context, contractName, method string, params any, returnVal any) error {
if err := s.Ready(); err != nil {
Expand Down Expand Up @@ -169,12 +169,12 @@ func (s *SolanaChainReaderService) GetLatestValue(ctx context.Context, contractN
return nil
}

// QueryKey implements the types.ChainReader interface.
// QueryKey implements the types.ContractReader interface.
func (s *SolanaChainReaderService) QueryKey(ctx context.Context, contractName string, filter query.KeyFilter, limitAndSort query.LimitAndSort, sequenceDataType any) ([]types.Sequence, error) {
return nil, errors.New("unimplemented")
}

// Bind implements the types.ChainReader interface and allows new contract bindings to be added
// Bind implements the types.ContractReader interface and allows new contract bindings to be added
// to the service.
func (s *SolanaChainReaderService) Bind(_ context.Context, bindings []types.BoundContract) error {
return s.bindings.Bind(bindings)
Expand Down
34 changes: 27 additions & 7 deletions pkg/solana/chainreader/chain_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ func (r *chainReaderInterfaceTester) Setup(t *testing.T) {
}
}

func (r *chainReaderInterfaceTester) GetChainReader(t *testing.T) types.ChainReader {
func (r *chainReaderInterfaceTester) GetChainReader(t *testing.T) types.ContractReader {
client := new(mockedRPCClient)
svc, err := chainreader.NewChainReaderService(logger.Test(t), client, r.conf)
if err != nil {
Expand Down Expand Up @@ -552,6 +552,26 @@ type wrappedTestChainReader struct {
testStructQueue []*TestStruct
}

func (r *wrappedTestChainReader) Start(ctx context.Context) error {
return nil
}

func (r *wrappedTestChainReader) Close() error {
return nil
}

func (r *wrappedTestChainReader) Ready() error {
return nil
}

func (r *wrappedTestChainReader) HealthReport() map[string]error {
return nil
}

func (r *wrappedTestChainReader) Name() string {
return "wrappedTestChainReader"
}

func (r *wrappedTestChainReader) GetLatestValue(ctx context.Context, contractName string, method string, params, returnVal any) error {
var (
a ag_solana.PublicKey
Expand Down Expand Up @@ -644,7 +664,7 @@ func (r *wrappedTestChainReader) GetLatestValue(ctx context.Context, contractNam
return r.service.GetLatestValue(ctx, contractName, method, params, returnVal)
}

// QueryKey implements the types.ChainReader interface.
// QueryKey implements the types.ContractReader interface.
func (r *wrappedTestChainReader) QueryKey(ctx context.Context, contractName string, filter query.KeyFilter, limitAndSort query.LimitAndSort, sequenceDataType any) ([]types.Sequence, error) {
r.test.Skip("QueryKey is not yet supported in Solana")
return nil, nil
Expand Down Expand Up @@ -825,15 +845,15 @@ const (
// Required to allow test skipping to be on the same goroutine
type skipEventsChainReaderTester struct{ ChainReaderInterfaceTester }

func (s *skipEventsChainReaderTester) GetChainReader(t *testing.T) types.ChainReader {
func (s *skipEventsChainReaderTester) GetChainReader(t *testing.T) types.ContractReader {
return &skipEventsChainReader{
ChainReader: s.ChainReaderInterfaceTester.GetChainReader(t),
t: t,
ContractReader: s.ChainReaderInterfaceTester.GetChainReader(t),
t: t,
}
}

type skipEventsChainReader struct {
types.ChainReader
types.ContractReader
t *testing.T
}

Expand All @@ -842,7 +862,7 @@ func (s *skipEventsChainReader) GetLatestValue(ctx context.Context, contractName
s.t.Skip("Events are not yet supported in Solana")
}

return s.ChainReader.GetLatestValue(ctx, contractName, method, params, returnVal)
return s.ContractReader.GetLatestValue(ctx, contractName, method, params, returnVal)
}

func (s *skipEventsChainReader) QueryKey(ctx context.Context, contractName string, filter query.KeyFilter, limitAndSort query.LimitAndSort, sequenceDataType any) ([]types.Sequence, error) {
Expand Down
6 changes: 5 additions & 1 deletion pkg/solana/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ func (r *Relayer) NewConfigProvider(args relaytypes.RelayArgs) (relaytypes.Confi
return configWatcher, err
}

func (r *Relayer) NewContractReader(_ []byte) (relaytypes.ContractReader, error) {
return nil, errors.New("contract reader is not supported for solana")
}

func (r *Relayer) NewMedianProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.MedianProvider, error) {
ctx, cancel := r.stopCh.NewCtx()
defer cancel()
Expand Down Expand Up @@ -283,7 +287,7 @@ func (p *medianProvider) OnchainConfigCodec() median.OnchainConfigCodec {
return median.StandardOnchainConfigCodec{}
}

func (p *medianProvider) ChainReader() relaytypes.ChainReader {
func (p *medianProvider) ChainReader() relaytypes.ContractReader {
return nil
}

Expand Down
Loading