diff --git a/go.mod b/go.mod index 904084a74..29c9bc4d7 100644 --- a/go.mod +++ b/go.mod @@ -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.20240910154010-ed9f50de7322 + github.com/smartcontractkit/chainlink-common v0.2.2-0.20240911152814-4836d1d7f16b github.com/smartcontractkit/libocr v0.0.0-20240702141926-063ceef8c42e github.com/stretchr/testify v1.9.0 go.uber.org/zap v1.27.0 diff --git a/go.sum b/go.sum index 6ba1066e2..a4e3f137a 100644 --- a/go.sum +++ b/go.sum @@ -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.20240910154010-ed9f50de7322 h1:9SkeP9lpTMDqtqDd+BKPQhkPcylSoYi63L9YFdbzbEo= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240910154010-ed9f50de7322/go.mod h1:D/qaCoq0SxXzg5NRN5FtBRv98VBf+D2NOC++RbvvuOc= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240911152814-4836d1d7f16b h1:eW1CSdNcDtOFqjrtfR93KTg80rHP+WWh5UybdJcdU8M= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240911152814-4836d1d7f16b/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= diff --git a/integration-tests/common/test_common.go b/integration-tests/common/test_common.go index 597b169ae..a775a5199 100644 --- a/integration-tests/common/test_common.go +++ b/integration-tests/common/test_common.go @@ -218,7 +218,7 @@ func (m *OCRv2TestState) SetupClients() { m.Clients.ChainlinkClient.ChainlinkClientK8s, err = client.ConnectChainlinkNodes(m.Common.Env) require.NoError(m.Config.T, err) } else { - m.Clients.ChainlinkClient.ChainlinkClientDocker = m.Common.DockerEnv.ClCluster + m.Clients.ChainlinkClient.ChainlinkClientDocker = m.Common.DockerEnv.CLClusterTestEnv.ClCluster } } diff --git a/integration-tests/go.mod b/integration-tests/go.mod index c0cebfa3b..ffb4a52c5 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -14,12 +14,12 @@ 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.20240910154010-ed9f50de7322 - github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240910161529-a7050b5193cd + github.com/smartcontractkit/chainlink-common v0.2.2-0.20240911152814-4836d1d7f16b + github.com/smartcontractkit/chainlink-solana v1.1.1-0.20240911160840-cde14abca28e github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.5 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.1 github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240910220528-150634e5880d - github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20240910220528-150634e5880d + github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20240911175355-9eb801069a30 github.com/smartcontractkit/libocr v0.0.0-20240717100443-f6226e09bee7 github.com/stretchr/testify v1.9.0 github.com/testcontainers/testcontainers-go v0.28.0 @@ -375,13 +375,13 @@ require ( github.com/shopspring/decimal v1.4.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/slack-go/slack v0.12.2 // indirect - github.com/smartcontractkit/chain-selectors v1.0.21 // indirect + github.com/smartcontractkit/chain-selectors v1.0.23 // indirect github.com/smartcontractkit/chainlink-automation v1.0.4 // indirect - github.com/smartcontractkit/chainlink-ccip v0.0.0-20240910072312-810030689426 // indirect - github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240910210931-638ba8a76227 // indirect - github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240904093355-e40169857652 // indirect + github.com/smartcontractkit/chainlink-ccip v0.0.0-20240911145028-d346e3ace978 // indirect + github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240911175228-daf2600bb7b7 // indirect + github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240906125718-9f0a98d32fbc // indirect github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240910163253-2a5c9ab97de3 // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911160128-83c49f033146 // indirect github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 // indirect github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 // indirect github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index fbcec534e..ecc0c193b 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1388,22 +1388,22 @@ github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/slack-go/slack v0.12.2 h1:x3OppyMyGIbbiyFhsBmpf9pwkUzMhthJMRNmNlA4LaQ= github.com/slack-go/slack v0.12.2/go.mod h1:hlGi5oXA+Gt+yWTPP0plCdRKmjsDxecdHxYQdlMQKOw= -github.com/smartcontractkit/chain-selectors v1.0.21 h1:KCR9SA7PhOexaBzFieHoLv1WonwhVOPtOStpqTmLC4E= -github.com/smartcontractkit/chain-selectors v1.0.21/go.mod h1:d4Hi+E1zqjy9HqMkjBE5q1vcG9VGgxf5VxiRHfzi2kE= +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-automation v1.0.4 h1:iyW181JjKHLNMnDleI8umfIfVVlwC7+n5izbLSFgjw8= github.com/smartcontractkit/chainlink-automation v1.0.4/go.mod h1:u4NbPZKJ5XiayfKHD/v3z3iflQWqvtdhj13jVZXj/cM= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240910072312-810030689426 h1:siC6AoTs4889FwiqgEp0sC6S8nFlDzVTZAmUX7cV7aM= -github.com/smartcontractkit/chainlink-ccip v0.0.0-20240910072312-810030689426/go.mod h1:v8hmGodMN1s1TQnvZepZ3Pbo+PyzWVdXag7JzJnvrkI= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240910154010-ed9f50de7322 h1:9SkeP9lpTMDqtqDd+BKPQhkPcylSoYi63L9YFdbzbEo= -github.com/smartcontractkit/chainlink-common v0.2.2-0.20240910154010-ed9f50de7322/go.mod h1:D/qaCoq0SxXzg5NRN5FtBRv98VBf+D2NOC++RbvvuOc= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240910210931-638ba8a76227 h1:xow5cYrWxRmzTwhz2AjWOlnI9WRF4O5b84bXm1k292E= -github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240910210931-638ba8a76227/go.mod h1:DUFantPYoBGwBSkNVt2k4ZJi0jPKRRrZVVlAzcZwreA= -github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240904093355-e40169857652 h1:0aZ3HiEz2bMM5ywHAyKlFMN95qTzpNDn7uvnHLrFX6s= -github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240904093355-e40169857652/go.mod h1:PwPcmQNAzVmU8r8JWKrDRgvXesDwxnqbMD6DvYt/Z7M= +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.20240911152814-4836d1d7f16b h1:eW1CSdNcDtOFqjrtfR93KTg80rHP+WWh5UybdJcdU8M= +github.com/smartcontractkit/chainlink-common v0.2.2-0.20240911152814-4836d1d7f16b/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= +github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240906125718-9f0a98d32fbc/go.mod h1:PwPcmQNAzVmU8r8JWKrDRgvXesDwxnqbMD6DvYt/Z7M= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f h1:p4p3jBT91EQyLuAMvHD+zNJsuAYI/QjJbzuGUJ7wIgg= github.com/smartcontractkit/chainlink-feeds v0.0.0-20240910155501-42f20443189f/go.mod h1:FLlWBt2hwiMVgt9AcSo6wBJYIRd/nsc8ENbV1Wir1bw= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240910163253-2a5c9ab97de3 h1:Tkl0/SB1hxjBgphslHf1E6iXp+4QAejuCLIT+8zvX3Y= -github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240910163253-2a5c9ab97de3/go.mod h1:mkuwCChesVqzMQpYQWRwckmQobJLwG4XCsw7KB8UCKY= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911160128-83c49f033146 h1:2HLPLiJO5+c+Fjp+c5VEAHxp10oF0h3k9s+9izihUvA= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240911160128-83c49f033146/go.mod h1:ec/a20UZ7YRK4oxJcnTBFzp1+DBcJcwqEaerUMsktMs= github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.5 h1:Owb1MQZn0NZHwtZAnPZE6TVoTx6xLrfPaUdeOYswE9M= github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.5/go.mod h1:hS4yNF94C1lkS9gvtFXW8Km8K9NzGeR20aNfkqo5qbE= github.com/smartcontractkit/chainlink-testing-framework/lib/grafana v1.50.0 h1:VIxK8u0Jd0Q/VuhmsNm6Bls6Tb31H/sA3A/rbc5hnhg= @@ -1414,8 +1414,8 @@ github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0 h1:gfhfTn7H github.com/smartcontractkit/chainlink-testing-framework/wasp v1.50.0/go.mod h1:tqajhpUJA/9OaMCLitghBXjAgqYO4i27St0F4TUO3+M= github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240910220528-150634e5880d h1:hSCZqU+qRJFbPyYrSNKnwxyV6guQk6Q0T57lrMkGc4o= github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20240910220528-150634e5880d/go.mod h1:v+ChFUEH0OmOsuM+IDQD1zGi+epTx6L47a1Nc8hZzhw= -github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20240910220528-150634e5880d h1:auhzWjBtozxT0sIkmhj9vu9SuZFQ/wjvDhN/XVlhcQ4= -github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20240910220528-150634e5880d/go.mod h1:7REEb+hJYX7znPQbkD2i8/RJJV8GPEBV9qh4BO4fcO8= +github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20240911175355-9eb801069a30 h1:djB51VvvmYL2fP0hOL/px04sTqGipnlXHABtyfWeIy4= +github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20240911175355-9eb801069a30/go.mod h1:PAygo7yv7UxVYVrrNQ8zf9P/6gfvR/Uub3IZLlDbLIo= 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-20240717100443-f6226e09bee7 h1:e38V5FYE7DA1JfKXeD5Buo/7lczALuVXlJ8YNTAUxcw= diff --git a/pkg/solana/chain.go b/pkg/solana/chain.go index 4e03fd425..86545b0de 100644 --- a/pkg/solana/chain.go +++ b/pkg/solana/chain.go @@ -6,6 +6,7 @@ import ( "fmt" "math/big" "math/rand" + "strconv" "strings" "sync" "time" @@ -19,7 +20,6 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/loop" "github.com/smartcontractkit/chainlink-common/pkg/services" "github.com/smartcontractkit/chainlink-common/pkg/types" - relaytypes "github.com/smartcontractkit/chainlink-common/pkg/types" "github.com/smartcontractkit/chainlink-common/pkg/types/core" "github.com/smartcontractkit/chainlink-solana/pkg/solana/client" @@ -232,20 +232,51 @@ func newChain(id string, cfg *config.TOMLConfig, ks loop.Keystore, lggr logger.L return &ch, nil } -// ChainService interface -func (c *chain) GetChainStatus(ctx context.Context) (relaytypes.ChainStatus, error) { +func (c *chain) LatestHead(_ context.Context) (types.Head, error) { + sc, err := c.getClient() + if err != nil { + return types.Head{}, err + } + + latestBlock, err := sc.GetLatestBlock() + if err != nil { + return types.Head{}, nil + } + + if latestBlock.BlockHeight == nil { + return types.Head{}, fmt.Errorf("client returned nil latest block height") + } + + if latestBlock.BlockTime == nil { + return types.Head{}, fmt.Errorf("client returned nil block time") + } + + hashBytes, err := latestBlock.Blockhash.MarshalText() + if err != nil { + return types.Head{}, err + } + + return types.Head{ + Height: strconv.FormatUint(*latestBlock.BlockHeight, 10), + Hash: hashBytes, + Timestamp: uint64(latestBlock.BlockTime.Time().Unix()), + }, nil +} + +// Implement [types.GetChainStatus] interface +func (c *chain) GetChainStatus(ctx context.Context) (types.ChainStatus, error) { toml, err := c.cfg.TOMLString() if err != nil { - return relaytypes.ChainStatus{}, err + return types.ChainStatus{}, err } - return relaytypes.ChainStatus{ + return types.ChainStatus{ ID: c.id, Enabled: c.cfg.IsEnabled(), Config: toml, }, nil } -func (c *chain) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []relaytypes.NodeStatus, nextPageToken string, total int, err error) { +func (c *chain) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []types.NodeStatus, nextPageToken string, total int, err error) { return chains.ListNodeStatuses(int(pageSize), pageToken, c.listNodeStatuses) } @@ -253,8 +284,8 @@ func (c *chain) Transact(ctx context.Context, from, to string, amount *big.Int, return c.sendTx(ctx, from, to, amount, balanceCheck) } -func (c *chain) listNodeStatuses(start, end int) ([]relaytypes.NodeStatus, int, error) { - stats := make([]relaytypes.NodeStatus, 0) +func (c *chain) listNodeStatuses(start, end int) ([]types.NodeStatus, int, error) { + stats := make([]types.NodeStatus, 0) total := len(c.cfg.Nodes) if start >= total { return stats, total, chains.ErrOutOfRange