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

[BCI-3989][solana] - CR methods err when service unstarted #829

Draft
wants to merge 29 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
e4b1032
add missing methods to testing interface
Farber98 Aug 22, 2024
72b155d
rename interface tester methods
Farber98 Aug 23, 2024
ae54542
remove unnecesary Start method
Farber98 Aug 26, 2024
826bfb9
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Aug 29, 2024
07e8c77
close method impl
Farber98 Aug 29, 2024
06201dc
svc not started test in solana
Farber98 Aug 29, 2024
411032a
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Aug 30, 2024
e666621
start service again so cleanup closes gracefully
Farber98 Aug 30, 2024
c14eed5
bump common ref
Farber98 Sep 3, 2024
a0b44bd
close ignoring error as core does. It might be already closed
Farber98 Sep 3, 2024
fc6cfe8
add start. address comment
Farber98 Sep 4, 2024
b15fafd
bump common
Farber98 Sep 4, 2024
0c335b0
merge develop
Farber98 Sep 4, 2024
6254cdb
bump common
Farber98 Sep 4, 2024
9769b7d
bump data streams for core integration tests
Farber98 Sep 4, 2024
048d13c
fix v2 dependencies
Farber98 Sep 4, 2024
c82beda
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Sep 5, 2024
53f53b6
fix conflicts with chain components pr
Farber98 Sep 5, 2024
f629984
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Sep 12, 2024
1cf0ccd
fix pr conflicts
Farber98 Sep 12, 2024
6d6b396
bump common version
Farber98 Sep 12, 2024
3f986a2
add flag to control if we return cr started
Farber98 Sep 15, 2024
1f37e8a
bump common
Farber98 Sep 15, 2024
79b4500
bump common
Farber98 Sep 16, 2024
cf4ce48
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Sep 16, 2024
71454f3
make gomodtidy
Farber98 Sep 16, 2024
b7f19d9
refactor codec and chaincomponents ifaces
Farber98 Sep 16, 2024
099f8de
Merge branch 'develop' into BCI-3989-cr-methods-error-when-unstarted
Farber98 Sep 16, 2024
bc3a0f4
bump common
Farber98 Sep 16, 2024
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ require (
github.com/hashicorp/go-plugin v1.6.2-0.20240829161738-06afb6d7ae99
github.com/pelletier/go-toml/v2 v2.2.0
github.com/prometheus/client_golang v1.17.0
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240913191949-44d96950c886
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916214706-e7280848cd7b
github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e
github.com/stretchr/testify v1.9.0
go.uber.org/zap v1.27.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,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.2.2-0.20240913191949-44d96950c886 h1:69C4DkuBLomL5mO4pt82B4zjv+ruT76LZdfXiVK08lg=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240913191949-44d96950c886/go.mod h1:sjiiPwd4KsYOCf68MwL86EKphdXeT66EY7j53WH5DCc=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916214706-e7280848cd7b h1:7RyN8+dNTN+hjnKfgfEYdRfxqeHTnPq8ILcHn/gOe6k=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916214706-e7280848cd7b/go.mod h1:sjiiPwd4KsYOCf68MwL86EKphdXeT66EY7j53WH5DCc=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs=
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA=
github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e h1:9ypZ/8aW8Vm497i1gXHcT96oNLiu88jbg9QdX+IUE3E=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/lib/pq v1.10.9
github.com/pelletier/go-toml/v2 v2.2.2
github.com/rs/zerolog v1.33.0
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240913191949-44d96950c886
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916214706-e7280848cd7b
github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911182932-3c609a6ac664
github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.5
github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1394,8 +1394,8 @@ github.com/smartcontractkit/chainlink-automation v1.0.4 h1:iyW181JjKHLNMnDleI8um
github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240911145028-d346e3ace978 h1:BPuehkAQ8R112SlTitukSdKYRJMY3zkvaQS4VSTNn0Q=
github.com/smartcontractkit/chainlink-ccip v0.0.0-20240911145028-d346e3ace978/go.mod h1:X1f4CKlR1RilSgzArQv5HNvMrVSt+Zloihm3REwxhdQ=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240913191949-44d96950c886 h1:69C4DkuBLomL5mO4pt82B4zjv+ruT76LZdfXiVK08lg=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240913191949-44d96950c886/go.mod h1:sjiiPwd4KsYOCf68MwL86EKphdXeT66EY7j53WH5DCc=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916214706-e7280848cd7b h1:7RyN8+dNTN+hjnKfgfEYdRfxqeHTnPq8ILcHn/gOe6k=
github.com/smartcontractkit/chainlink-common v0.2.2-0.20240916214706-e7280848cd7b/go.mod h1:sjiiPwd4KsYOCf68MwL86EKphdXeT66EY7j53WH5DCc=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 h1:lTGIOQYLk1Ufn++X/AvZnt6VOcuhste5yp+C157No/Q=
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7/go.mod h1:BMYE1vC/pGmdFSsOJdPrAA0/4gZ0Xo0SxTMdGspBtRo=
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240906125718-9f0a98d32fbc h1:tRmTlaoAt+7FakMXXgeCuRPmzzBo5jsGpeCVvcU6KMc=
Expand Down
61 changes: 40 additions & 21 deletions pkg/solana/chainreader/chain_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,40 @@ func (r *chainReaderInterfaceTester) Name() string {
return "Solana"
}

func (r *chainReaderInterfaceTester) Setup(t *testing.T) {
func (r *chainReaderInterfaceTester) Setup(t *testing.T, started bool) {
r.setContractReader(t, started)
}

func (r *chainReaderInterfaceTester) setContractReader(t *testing.T, started bool) {
t.Cleanup(func() {
if started {
require.NoError(t, r.reader.Close())
}
})

r.setContractReaderConfig(t)

client := new(mockedRPCClient)
svc, err := chainreader.NewChainReaderService(logger.Test(t), client, r.conf)
if err != nil {
t.Logf("contract reader service was not able to start: %s", err.Error())
t.FailNow()
}

if started {
require.NoError(t, svc.Start(tests.Context(t)))
}

if r.reader == nil {
r.reader = &wrappedTestChainReader{tester: r}
}

r.reader.test = t
r.reader.service = svc
r.reader.client = client
}

func (r *chainReaderInterfaceTester) setContractReaderConfig(t *testing.T) {
r.address = make([]string, 7)
for idx := range r.address {
r.address[idx] = ag_solana.NewWallet().PublicKey().String()
Expand Down Expand Up @@ -527,26 +560,6 @@ func (r *chainReaderInterfaceTester) Setup(t *testing.T) {
}

func (r *chainReaderInterfaceTester) GetContractReader(t *testing.T) types.ContractReader {
client := new(mockedRPCClient)
svc, err := chainreader.NewChainReaderService(logger.Test(t), client, r.conf)
if err != nil {
t.Logf("chain reader service was not able to start: %s", err.Error())
t.FailNow()
}

require.NoError(t, svc.Start(context.Background()))
t.Cleanup(func() {
require.NoError(t, svc.Close())
})

if r.reader == nil {
r.reader = &wrappedTestChainReader{tester: r}
}

r.reader.test = t
r.reader.service = svc
r.reader.client = client

return r.reader
}

Expand Down Expand Up @@ -590,6 +603,12 @@ func (r *wrappedTestChainReader) GetLatestValue(ctx context.Context, readIdentif
a ag_solana.PublicKey
b ag_solana.PublicKey
)

// If you called the method and the service is not started
if err := r.service.Ready(); err != nil {
return fmt.Errorf("service not ready. err: %w", err)
}

parts := strings.Split(readIdentifier, "-")
if len(parts) < 3 {
panic("unexpected readIdentifier length")
Expand Down
Loading