diff --git a/core/chains/cosmos/chain.go b/core/chains/cosmos/chain.go index a25ad82a863..9e1ed4363b2 100644 --- a/core/chains/cosmos/chain.go +++ b/core/chains/cosmos/chain.go @@ -20,15 +20,14 @@ import ( "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/db" "github.com/smartcontractkit/chainlink/v2/core/services" + relaychains "github.com/smartcontractkit/chainlink-relay/pkg/chains" "github.com/smartcontractkit/chainlink-relay/pkg/logger" "github.com/smartcontractkit/chainlink-relay/pkg/loop" relaytypes "github.com/smartcontractkit/chainlink-relay/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/chains" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos/cosmostxm" - "github.com/smartcontractkit/chainlink/v2/core/chains/internal" "github.com/smartcontractkit/chainlink/v2/core/services/pg" - "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -132,8 +131,8 @@ func (c *chain) ID() string { return c.id } -func (c *chain) ChainID() relay.ChainID { - return relay.ChainID(c.id) +func (c *chain) ChainID() string { + return c.id } func (c *chain) Config() coscfg.Config { @@ -223,7 +222,7 @@ func (c *chain) GetChainStatus(ctx context.Context) (relaytypes.ChainStatus, err }, nil } func (c *chain) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []relaytypes.NodeStatus, nextPageToken string, total int, err error) { - return internal.ListNodeStatuses(int(pageSize), pageToken, c.listNodeStatuses) + return relaychains.ListNodeStatuses(int(pageSize), pageToken, c.listNodeStatuses) } func (c *chain) Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error { @@ -235,7 +234,7 @@ func (c *chain) listNodeStatuses(start, end int) ([]relaytypes.NodeStatus, int, stats := make([]relaytypes.NodeStatus, 0) total := len(c.cfg.Nodes) if start >= total { - return stats, total, internal.ErrOutOfRange + return stats, total, relaychains.ErrOutOfRange } if end > total { end = total diff --git a/core/chains/evm/chain.go b/core/chains/evm/chain.go index 2a8f8a2e840..fc703fb6319 100644 --- a/core/chains/evm/chain.go +++ b/core/chains/evm/chain.go @@ -8,12 +8,12 @@ import ( "net/url" "time" + gotoml "github.com/pelletier/go-toml/v2" "go.uber.org/multierr" "github.com/smartcontractkit/sqlx" - gotoml "github.com/pelletier/go-toml/v2" - + relaychains "github.com/smartcontractkit/chainlink-relay/pkg/chains" "github.com/smartcontractkit/chainlink-relay/pkg/types" "github.com/smartcontractkit/chainlink/v2/core/chains" @@ -29,7 +29,6 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/chains/evm/monitor" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/txmgr" evmtypes "github.com/smartcontractkit/chainlink/v2/core/chains/evm/types" - "github.com/smartcontractkit/chainlink/v2/core/chains/internal" "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services" @@ -422,7 +421,7 @@ func (c *chain) listNodeStatuses(start, end int) ([]types.NodeStatus, int, error nodes := c.cfg.Nodes() total := len(nodes) if start >= total { - return nil, total, internal.ErrOutOfRange + return nil, total, relaychains.ErrOutOfRange } if end > total { end = total @@ -459,7 +458,7 @@ func (c *chain) listNodeStatuses(start, end int) ([]types.NodeStatus, int, error } func (c *chain) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []types.NodeStatus, nextPageToken string, total int, err error) { - return internal.ListNodeStatuses(int(pageSize), pageToken, c.listNodeStatuses) + return relaychains.ListNodeStatuses(int(pageSize), pageToken, c.listNodeStatuses) } func (c *chain) ID() *big.Int { return c.id } diff --git a/core/chains/internal/utils.go b/core/chains/internal/utils.go deleted file mode 100644 index 0932f12209c..00000000000 --- a/core/chains/internal/utils.go +++ /dev/null @@ -1,109 +0,0 @@ -package internal - -import ( - "encoding/base64" - "errors" - "fmt" - "net/url" - "strconv" - - "github.com/smartcontractkit/chainlink-relay/pkg/types" -) - -// PageToken is simple internal representation for coordination requests and responses in a paginated API -// It is inspired by the Google API Design patterns -// https://cloud.google.com/apis/design/design_patterns#list_pagination -// https://google.aip.dev/158 -type PageToken struct { - Page int - Size int -} - -var ( - ErrInvalidToken = errors.New("invalid page token") - ErrOutOfRange = errors.New("out of range") - defaultSize = 100 -) - -// Encode the token in base64 for transmission for the wire -func (pr *PageToken) Encode() string { - if pr.Size == 0 { - pr.Size = defaultSize - } - // this is a simple minded implementation and may benefit from something fancier - // note that this is a valid url.Query string, which we leverage in decoding - s := fmt.Sprintf("page=%d&size=%d", pr.Page, pr.Size) - return base64.RawStdEncoding.EncodeToString([]byte(s)) -} - -// b64enc must be the base64 encoded token string, corresponding to [PageToken.Encode()] -func NewPageToken(b64enc string) (*PageToken, error) { - // empty is valid - if b64enc == "" { - return &PageToken{Page: 0, Size: defaultSize}, nil - } - - b, err := base64.RawStdEncoding.DecodeString(b64enc) - if err != nil { - return nil, err - } - // here too, this is simple minded and could be fancier - - vals, err := url.ParseQuery(string(b)) - if err != nil { - return nil, err - } - if !(vals.Has("page") && vals.Has("size")) { - return nil, ErrInvalidToken - } - page, err := strconv.Atoi(vals.Get("page")) - if err != nil { - return nil, fmt.Errorf("%w: bad page", ErrInvalidToken) - } - size, err := strconv.Atoi(vals.Get("size")) - if err != nil { - return nil, fmt.Errorf("%w: bad size", ErrInvalidToken) - } - return &PageToken{ - Page: page, - Size: size, - }, err -} - -func ValidatePageToken(pageSize int, token string) (page int, err error) { - - if token == "" { - return 0, nil - } - t, err := NewPageToken(token) - if err != nil { - return -1, err - } - return t.Page, nil -} - -// if start is out of range, must return ErrOutOfRange -type ListNodeStatusFn = func(start, end int) (stats []types.NodeStatus, total int, err error) - -func ListNodeStatuses(pageSize int, pageToken string, listFn ListNodeStatusFn) (stats []types.NodeStatus, nextPageToken string, total int, err error) { - if pageSize == 0 { - pageSize = defaultSize - } - t := &PageToken{Page: 0, Size: pageSize} - if pageToken != "" { - t, err = NewPageToken(pageToken) - if err != nil { - return nil, "", -1, err - } - } - start, end := t.Page*t.Size, (t.Page+1)*t.Size - stats, total, err = listFn(start, end) - if err != nil { - return stats, "", -1, err - } - if total > end { - next_token := &PageToken{Page: t.Page + 1, Size: t.Size} - nextPageToken = next_token.Encode() - } - return stats, nextPageToken, total, nil -} diff --git a/core/chains/internal/utils_test.go b/core/chains/internal/utils_test.go deleted file mode 100644 index 5a47ed3d8ff..00000000000 --- a/core/chains/internal/utils_test.go +++ /dev/null @@ -1,166 +0,0 @@ -package internal - -import ( - "encoding/base64" - "fmt" - "reflect" - "testing" - - "github.com/stretchr/testify/assert" - - "github.com/smartcontractkit/chainlink-relay/pkg/types" -) - -func TestNewPageToken(t *testing.T) { - type args struct { - t *PageToken - } - tests := []struct { - name string - args args - want *PageToken - wantErr bool - }{ - { - name: "empty", - args: args{t: &PageToken{}}, - want: &PageToken{Page: 0, Size: defaultSize}, - }, - { - name: "page set, size unset", - args: args{t: &PageToken{Page: 1}}, - want: &PageToken{Page: 1, Size: defaultSize}, - }, - { - name: "page set, size set", - args: args{t: &PageToken{Page: 3, Size: 10}}, - want: &PageToken{Page: 3, Size: 10}, - }, - { - name: "page unset, size set", - args: args{t: &PageToken{Size: 17}}, - want: &PageToken{Page: 0, Size: 17}, - }, - } - for _, tt := range tests { - enc := tt.args.t.Encode() - t.Run(tt.name, func(t *testing.T) { - got, err := NewPageToken(enc) - if (err != nil) != tt.wantErr { - t.Errorf("NewPageToken() error = %v, wantErr %v", err, tt.wantErr) - return - } - if !reflect.DeepEqual(got, tt.want) { - t.Errorf("NewPageToken() = %v, want %v", got, tt.want) - } - }) - } -} - -func TestListNodeStatuses(t *testing.T) { - testStats := []types.NodeStatus{ - types.NodeStatus{ - ChainID: "chain-1", - Name: "name-1", - }, - types.NodeStatus{ - ChainID: "chain-2", - Name: "name-2", - }, - types.NodeStatus{ - ChainID: "chain-3", - Name: "name-3", - }, - } - - type args struct { - pageSize int - pageToken string - listFn ListNodeStatusFn - } - tests := []struct { - name string - args args - wantStats []types.NodeStatus - wantNext_pageToken string - wantTotal int - wantErr bool - }{ - { - name: "all on first page", - args: args{ - pageSize: 10, // > length of test stats - pageToken: "", - listFn: func(start, end int) ([]types.NodeStatus, int, error) { - return testStats, len(testStats), nil - }, - }, - wantNext_pageToken: "", - wantTotal: len(testStats), - wantStats: testStats, - }, - { - name: "small first page", - args: args{ - pageSize: len(testStats) - 1, - pageToken: "", - listFn: func(start, end int) ([]types.NodeStatus, int, error) { - return testStats[start:end], len(testStats), nil - }, - }, - wantNext_pageToken: base64.RawStdEncoding.EncodeToString([]byte("page=1&size=2")), // hard coded 2 is len(testStats)-1 - wantTotal: len(testStats), - wantStats: testStats[0 : len(testStats)-1], - }, - { - name: "second page", - args: args{ - pageSize: len(testStats) - 1, - pageToken: base64.RawStdEncoding.EncodeToString([]byte("page=1&size=2")), // hard coded 2 is len(testStats)-1 - listFn: func(start, end int) ([]types.NodeStatus, int, error) { - // note list function must do the start, end bound checking. here we are making it simple - if end > len(testStats) { - end = len(testStats) - } - return testStats[start:end], len(testStats), nil - }, - }, - wantNext_pageToken: "", - wantTotal: len(testStats), - wantStats: testStats[len(testStats)-1:], - }, - { - name: "bad list fn", - args: args{ - listFn: func(start, end int) ([]types.NodeStatus, int, error) { - return nil, 0, fmt.Errorf("i'm a bad list fn") - }, - }, - wantTotal: -1, - wantErr: true, - }, - { - name: "invalid token", - args: args{ - pageToken: "invalid token", - listFn: func(start, end int) ([]types.NodeStatus, int, error) { - return testStats[start:end], len(testStats), nil - }, - }, - wantTotal: -1, - wantErr: true, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - gotStats, gotNext_pageToken, gotTotal, err := ListNodeStatuses(tt.args.pageSize, tt.args.pageToken, tt.args.listFn) - if (err != nil) != tt.wantErr { - t.Errorf("ListNodeStatuses() error = %v, wantErr %v", err, tt.wantErr) - return - } - assert.Equal(t, tt.wantStats, gotStats) - assert.Equal(t, tt.wantNext_pageToken, gotNext_pageToken) - assert.Equal(t, tt.wantTotal, gotTotal) - }) - } -} diff --git a/core/chains/solana/chain.go b/core/chains/solana/chain.go deleted file mode 100644 index 9de4adcb57e..00000000000 --- a/core/chains/solana/chain.go +++ /dev/null @@ -1,460 +0,0 @@ -package solana - -import ( - "context" - "fmt" - "math/big" - "math/rand" - "strings" - "sync" - "time" - - solanago "github.com/gagliardetto/solana-go" - "github.com/gagliardetto/solana-go/programs/system" - "github.com/gagliardetto/solana-go/rpc" - "github.com/pkg/errors" - "go.uber.org/multierr" - - "github.com/smartcontractkit/chainlink-relay/pkg/logger" - "github.com/smartcontractkit/chainlink-relay/pkg/loop" - relaytypes "github.com/smartcontractkit/chainlink-relay/pkg/types" - - "github.com/smartcontractkit/chainlink-solana/pkg/solana" - "github.com/smartcontractkit/chainlink-solana/pkg/solana/client" - "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" - "github.com/smartcontractkit/chainlink-solana/pkg/solana/db" - "github.com/smartcontractkit/chainlink-solana/pkg/solana/txm" - - "github.com/smartcontractkit/chainlink/v2/core/chains" - "github.com/smartcontractkit/chainlink/v2/core/chains/internal" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana/monitor" - "github.com/smartcontractkit/chainlink/v2/core/services" - "github.com/smartcontractkit/chainlink/v2/core/services/relay" - "github.com/smartcontractkit/chainlink/v2/core/utils" -) - -// DefaultRequestTimeout is the default Solana client timeout. -const DefaultRequestTimeout = 30 * time.Second - -// ChainOpts holds options for configuring a Chain. -type ChainOpts struct { - Logger logger.Logger - KeyStore loop.Keystore -} - -func (o *ChainOpts) Validate() (err error) { - required := func(s string) error { - return errors.Errorf("%s is required", s) - } - if o.Logger == nil { - err = multierr.Append(err, required("Logger")) - } - if o.KeyStore == nil { - err = multierr.Append(err, required("KeyStore")) - } - return -} - -func (o *ChainOpts) GetLogger() logger.Logger { - return o.Logger -} - -func NewChain(cfg *SolanaConfig, opts ChainOpts) (solana.Chain, error) { - if !cfg.IsEnabled() { - return nil, fmt.Errorf("cannot create new chain with ID %s: %w", *cfg.ChainID, chains.ErrChainDisabled) - } - c, err := newChain(*cfg.ChainID, cfg, opts.KeyStore, opts.Logger) - if err != nil { - return nil, err - } - return c, nil -} - -var _ solana.Chain = (*chain)(nil) - -type chain struct { - utils.StartStopOnce - id string - cfg *SolanaConfig - txm *txm.Txm - balanceMonitor services.ServiceCtx - lggr logger.Logger - - // tracking node chain id for verification - clientCache map[string]*verifiedCachedClient // map URL -> {client, chainId} [mainnet/testnet/devnet/localnet] - clientLock sync.RWMutex -} - -type verifiedCachedClient struct { - chainID string - expectedChainID string - nodeURL string - - chainIDVerified bool - chainIDVerifiedLock sync.RWMutex - - client.ReaderWriter -} - -func (v *verifiedCachedClient) verifyChainID() (bool, error) { - v.chainIDVerifiedLock.RLock() - if v.chainIDVerified { - v.chainIDVerifiedLock.RUnlock() - return true, nil - } - v.chainIDVerifiedLock.RUnlock() - - var err error - - v.chainIDVerifiedLock.Lock() - defer v.chainIDVerifiedLock.Unlock() - - v.chainID, err = v.ReaderWriter.ChainID() - if err != nil { - v.chainIDVerified = false - return v.chainIDVerified, errors.Wrap(err, "failed to fetch ChainID in verifiedCachedClient") - } - - // check chainID matches expected chainID - expectedChainID := strings.ToLower(v.expectedChainID) - if v.chainID != expectedChainID { - v.chainIDVerified = false - return v.chainIDVerified, errors.Errorf("client returned mismatched chain id (expected: %s, got: %s): %s", expectedChainID, v.chainID, v.nodeURL) - } - - v.chainIDVerified = true - - return v.chainIDVerified, nil -} - -func (v *verifiedCachedClient) SendTx(ctx context.Context, tx *solanago.Transaction) (solanago.Signature, error) { - verified, err := v.verifyChainID() - if !verified { - return [64]byte{}, err - } - - return v.ReaderWriter.SendTx(ctx, tx) -} - -func (v *verifiedCachedClient) SimulateTx(ctx context.Context, tx *solanago.Transaction, opts *rpc.SimulateTransactionOpts) (*rpc.SimulateTransactionResult, error) { - verified, err := v.verifyChainID() - if !verified { - return nil, err - } - - return v.ReaderWriter.SimulateTx(ctx, tx, opts) -} - -func (v *verifiedCachedClient) SignatureStatuses(ctx context.Context, sigs []solanago.Signature) ([]*rpc.SignatureStatusesResult, error) { - verified, err := v.verifyChainID() - if !verified { - return nil, err - } - - return v.ReaderWriter.SignatureStatuses(ctx, sigs) -} - -func (v *verifiedCachedClient) Balance(addr solanago.PublicKey) (uint64, error) { - verified, err := v.verifyChainID() - if !verified { - return 0, err - } - - return v.ReaderWriter.Balance(addr) -} - -func (v *verifiedCachedClient) SlotHeight() (uint64, error) { - verified, err := v.verifyChainID() - if !verified { - return 0, err - } - - return v.ReaderWriter.SlotHeight() -} - -func (v *verifiedCachedClient) LatestBlockhash() (*rpc.GetLatestBlockhashResult, error) { - verified, err := v.verifyChainID() - if !verified { - return nil, err - } - - return v.ReaderWriter.LatestBlockhash() -} - -func (v *verifiedCachedClient) ChainID() (string, error) { - verified, err := v.verifyChainID() - if !verified { - return "", err - } - - return v.chainID, nil -} - -func (v *verifiedCachedClient) GetFeeForMessage(msg string) (uint64, error) { - verified, err := v.verifyChainID() - if !verified { - return 0, err - } - - return v.ReaderWriter.GetFeeForMessage(msg) -} - -func (v *verifiedCachedClient) GetAccountInfoWithOpts(ctx context.Context, addr solanago.PublicKey, opts *rpc.GetAccountInfoOpts) (*rpc.GetAccountInfoResult, error) { - verified, err := v.verifyChainID() - if !verified { - return nil, err - } - - return v.ReaderWriter.GetAccountInfoWithOpts(ctx, addr, opts) -} - -func newChain(id string, cfg *SolanaConfig, ks loop.Keystore, lggr logger.Logger) (*chain, error) { - lggr = logger.With(lggr, "chainID", id, "chain", "solana") - var ch = chain{ - id: id, - cfg: cfg, - lggr: logger.Named(lggr, "Chain"), - clientCache: map[string]*verifiedCachedClient{}, - } - tc := func() (client.ReaderWriter, error) { - return ch.getClient() - } - ch.txm = txm.NewTxm(ch.id, tc, cfg, ks, lggr) - ch.balanceMonitor = monitor.NewBalanceMonitor(ch.id, cfg, lggr, ks, ch.Reader) - return &ch, nil -} - -// ChainService interface -func (c *chain) GetChainStatus(ctx context.Context) (relaytypes.ChainStatus, error) { - toml, err := c.cfg.TOMLString() - if err != nil { - return relaytypes.ChainStatus{}, err - } - return relaytypes.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) { - return internal.ListNodeStatuses(int(pageSize), pageToken, c.listNodeStatuses) -} - -func (c *chain) Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error { - return c.sendTx(ctx, from, to, amount, balanceCheck) -} - -func (c *chain) listNodeStatuses(start, end int) ([]relaytypes.NodeStatus, int, error) { - stats := make([]relaytypes.NodeStatus, 0) - total := len(c.cfg.Nodes) - if start >= total { - return stats, total, internal.ErrOutOfRange - } - if end > total { - end = total - } - nodes := c.cfg.Nodes[start:end] - for _, node := range nodes { - stat, err := nodeStatus(node, c.ChainID()) - if err != nil { - return stats, total, err - } - stats = append(stats, stat) - } - return stats, total, nil -} - -func (c *chain) Name() string { - return c.lggr.Name() -} - -func (c *chain) ID() string { - return c.id -} - -func (c *chain) Config() config.Config { - return c.cfg -} - -func (c *chain) TxManager() solana.TxManager { - return c.txm -} - -func (c *chain) Reader() (client.Reader, error) { - return c.getClient() -} - -func (c *chain) ChainID() relay.ChainID { - return relay.ChainID(c.id) -} - -// getClient returns a client, randomly selecting one from available and valid nodes -func (c *chain) getClient() (client.ReaderWriter, error) { - var node db.Node - var client client.ReaderWriter - nodes, err := c.cfg.ListNodes() - if err != nil { - return nil, errors.Wrap(err, "failed to get nodes") - } - if len(nodes) == 0 { - return nil, errors.New("no nodes available") - } - // #nosec - index := rand.Perm(len(nodes)) // list of node indexes to try - for _, i := range index { - node = nodes[i] - // create client and check - client, err = c.verifiedClient(node) - // if error, try another node - if err != nil { - c.lggr.Warnw("failed to create node", "name", node.Name, "solana-url", node.SolanaURL, "err", err.Error()) - continue - } - // if all checks passed, mark found and break loop - break - } - // if no valid node found, exit with error - if client == nil { - return nil, errors.New("no node valid nodes available") - } - c.lggr.Debugw("Created client", "name", node.Name, "solana-url", node.SolanaURL) - return client, nil -} - -// verifiedClient returns a client for node or an error if fails to create the client. -// The client will still be returned if the nodes are not valid, or the chain id doesn't match. -// Further client calls will try and verify the client, and fail if the client is still not valid. -func (c *chain) verifiedClient(node db.Node) (client.ReaderWriter, error) { - url := node.SolanaURL - var err error - - // check if cached client exists - c.clientLock.RLock() - cl, exists := c.clientCache[url] - c.clientLock.RUnlock() - - if !exists { - cl = &verifiedCachedClient{ - nodeURL: url, - expectedChainID: c.id, - } - // create client - cl.ReaderWriter, err = client.NewClient(url, c.cfg, DefaultRequestTimeout, logger.Named(c.lggr, "Client."+node.Name)) - if err != nil { - return nil, errors.Wrap(err, "failed to create client") - } - - c.clientLock.Lock() - // recheck when writing to prevent parallel writes (discard duplicate if exists) - if cached, exists := c.clientCache[url]; !exists { - c.clientCache[url] = cl - } else { - cl = cached - } - c.clientLock.Unlock() - } - - return cl, nil -} - -func (c *chain) Start(ctx context.Context) error { - return c.StartOnce("Chain", func() error { - c.lggr.Debug("Starting") - c.lggr.Debug("Starting txm") - c.lggr.Debug("Starting balance monitor") - var ms services.MultiStart - return ms.Start(ctx, c.txm, c.balanceMonitor) - }) -} - -func (c *chain) Close() error { - return c.StopOnce("Chain", func() error { - c.lggr.Debug("Stopping") - c.lggr.Debug("Stopping txm") - c.lggr.Debug("Stopping balance monitor") - return services.CloseAll(c.txm, c.balanceMonitor) - }) -} - -func (c *chain) Ready() error { - return multierr.Combine( - c.StartStopOnce.Ready(), - c.txm.Ready(), - ) -} - -func (c *chain) HealthReport() map[string]error { - report := map[string]error{c.Name(): c.Healthy()} - services.CopyHealth(report, c.txm.HealthReport()) - return report -} - -func (c *chain) sendTx(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error { - reader, err := c.Reader() - if err != nil { - return fmt.Errorf("chain unreachable: %w", err) - } - - fromKey, err := solanago.PublicKeyFromBase58(from) - if err != nil { - return fmt.Errorf("failed to parse from key: %w", err) - } - toKey, err := solanago.PublicKeyFromBase58(to) - if err != nil { - return fmt.Errorf("failed to parse to key: %w", err) - } - if !amount.IsUint64() { - return fmt.Errorf("amount %s overflows uint64", amount) - } - amountI := amount.Uint64() - - blockhash, err := reader.LatestBlockhash() - if err != nil { - return fmt.Errorf("failed to get latest block hash: %w", err) - } - tx, err := solanago.NewTransaction( - []solanago.Instruction{ - system.NewTransferInstruction( - amountI, - fromKey, - toKey, - ).Build(), - }, - blockhash.Value.Blockhash, - solanago.TransactionPayer(fromKey), - ) - if err != nil { - return fmt.Errorf("failed to create tx: %w", err) - } - - if balanceCheck { - if err = solanaValidateBalance(reader, fromKey, amountI, tx.Message.ToBase64()); err != nil { - return fmt.Errorf("failed to validate balance: %w", err) - } - } - - txm := c.TxManager() - err = txm.Enqueue("", tx) - if err != nil { - return fmt.Errorf("transaction failed: %w", err) - } - return nil -} - -func solanaValidateBalance(reader client.Reader, from solanago.PublicKey, amount uint64, msg string) error { - balance, err := reader.Balance(from) - if err != nil { - return err - } - - fee, err := reader.GetFeeForMessage(msg) - if err != nil { - return err - } - - if balance < (amount + fee) { - return fmt.Errorf("balance %d is too low for this transaction to be executed: amount %d + fee %d", balance, amount, fee) - } - return nil -} diff --git a/core/chains/solana/chain_test.go b/core/chains/solana/chain_test.go deleted file mode 100644 index c8dfcf8501e..00000000000 --- a/core/chains/solana/chain_test.go +++ /dev/null @@ -1,231 +0,0 @@ -package solana - -import ( - "fmt" - "io" - "net/http" - "net/http/httptest" - "strings" - "sync" - "testing" - - "github.com/pkg/errors" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink-relay/pkg/utils" - "github.com/smartcontractkit/chainlink-solana/pkg/solana/client" - solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" - "github.com/smartcontractkit/chainlink-solana/pkg/solana/db" - - "github.com/smartcontractkit/chainlink/v2/core/logger" -) - -const TestSolanaGenesisHashTemplate = `{"jsonrpc":"2.0","result":"%s","id":1}` - -func TestSolanaChain_GetClient(t *testing.T) { - checkOnce := map[string]struct{}{} - mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - out := fmt.Sprintf(TestSolanaGenesisHashTemplate, client.MainnetGenesisHash) // mainnet genesis hash - - if !strings.Contains(r.URL.Path, "/mismatch") { - // devnet gensis hash - out = fmt.Sprintf(TestSolanaGenesisHashTemplate, client.DevnetGenesisHash) - - // clients with correct chainID should request chainID only once - if _, exists := checkOnce[r.URL.Path]; exists { - assert.NoError(t, errors.Errorf("rpc has been called once already for successful client '%s'", r.URL.Path)) - } - checkOnce[r.URL.Path] = struct{}{} - } - - _, err := w.Write([]byte(out)) - require.NoError(t, err) - })) - defer mockServer.Close() - - ch := solcfg.Chain{} - ch.SetDefaults() - cfg := &SolanaConfig{ - ChainID: ptr("devnet"), - Chain: ch, - } - testChain := chain{ - id: "devnet", - cfg: cfg, - lggr: logger.TestLogger(t), - clientCache: map[string]*verifiedCachedClient{}, - } - - cfg.Nodes = SolanaNodes([]*solcfg.Node{ - &solcfg.Node{ - Name: ptr("devnet"), - URL: utils.MustParseURL(mockServer.URL + "/1"), - }, - &solcfg.Node{ - Name: ptr("devnet"), - URL: utils.MustParseURL(mockServer.URL + "/2"), - }, - }) - _, err := testChain.getClient() - assert.NoError(t, err) - - // random nodes (happy path, 1 valid + multiple invalid) - cfg.Nodes = SolanaNodes([]*solcfg.Node{ - &solcfg.Node{ - Name: ptr("devnet"), - URL: utils.MustParseURL(mockServer.URL + "/1"), - }, - &solcfg.Node{ - Name: ptr("devnet"), - URL: utils.MustParseURL(mockServer.URL + "/mismatch/1"), - }, - &solcfg.Node{ - Name: ptr("devnet"), - URL: utils.MustParseURL(mockServer.URL + "/mismatch/2"), - }, - &solcfg.Node{ - Name: ptr("devnet"), - URL: utils.MustParseURL(mockServer.URL + "/mismatch/3"), - }, - &solcfg.Node{ - Name: ptr("devnet"), - URL: utils.MustParseURL(mockServer.URL + "/mismatch/4"), - }, - }) - _, err = testChain.getClient() - assert.NoError(t, err) - - // empty nodes response - cfg.Nodes = nil - _, err = testChain.getClient() - assert.Error(t, err) - - // no valid nodes to select from - cfg.Nodes = SolanaNodes([]*solcfg.Node{ - &solcfg.Node{ - Name: ptr("devnet"), - URL: utils.MustParseURL(mockServer.URL + "/mismatch/1"), - }, - &solcfg.Node{ - Name: ptr("devnet"), - URL: utils.MustParseURL(mockServer.URL + "/mismatch/2"), - }, - }) - _, err = testChain.getClient() - assert.NoError(t, err) -} - -func TestSolanaChain_VerifiedClient(t *testing.T) { - called := false - mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - out := `{ "jsonrpc": "2.0", "result": 1234, "id": 1 }` // getSlot response - - body, err := io.ReadAll(r.Body) - require.NoError(t, err) - - // handle getGenesisHash request - if strings.Contains(string(body), "getGenesisHash") { - // should only be called once, chainID will be cached in chain - // allowing `mismatch` to be ignored, since invalid nodes will try to verify the chain ID - // if it is not verified - if !strings.Contains(r.URL.Path, "/mismatch") && called { - assert.NoError(t, errors.New("rpc has been called once already")) - } - // devnet genesis hash - out = fmt.Sprintf(TestSolanaGenesisHashTemplate, client.DevnetGenesisHash) - } - _, err = w.Write([]byte(out)) - require.NoError(t, err) - called = true - })) - defer mockServer.Close() - - ch := solcfg.Chain{} - ch.SetDefaults() - cfg := &SolanaConfig{ - ChainID: ptr("devnet"), - Chain: ch, - } - testChain := chain{ - cfg: cfg, - lggr: logger.TestLogger(t), - clientCache: map[string]*verifiedCachedClient{}, - } - node := db.Node{SolanaURL: mockServer.URL} - - // happy path - testChain.id = "devnet" - _, err := testChain.verifiedClient(node) - assert.NoError(t, err) - - // retrieve cached client and retrieve slot height - c, err := testChain.verifiedClient(node) - assert.NoError(t, err) - slot, err := c.SlotHeight() - assert.NoError(t, err) - assert.Equal(t, uint64(1234), slot) - - node.SolanaURL = mockServer.URL + "/mismatch" - testChain.id = "incorrect" - c, err = testChain.verifiedClient(node) - assert.NoError(t, err) - _, err = c.ChainID() - // expect error from id mismatch (even if using a cached client) when performing RPC calls - assert.Error(t, err) - assert.Equal(t, fmt.Sprintf("client returned mismatched chain id (expected: %s, got: %s): %s", "incorrect", "devnet", node.SolanaURL), err.Error()) -} - -func TestSolanaChain_VerifiedClient_ParallelClients(t *testing.T) { - mockServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - out := fmt.Sprintf(TestSolanaGenesisHashTemplate, client.DevnetGenesisHash) - _, err := w.Write([]byte(out)) - require.NoError(t, err) - })) - defer mockServer.Close() - - ch := solcfg.Chain{} - ch.SetDefaults() - cfg := &SolanaConfig{ - ChainID: ptr("devnet"), - Enabled: ptr(true), - Chain: ch, - } - testChain := chain{ - id: "devnet", - cfg: cfg, - lggr: logger.TestLogger(t), - clientCache: map[string]*verifiedCachedClient{}, - } - node := db.Node{SolanaURL: mockServer.URL} - - var wg sync.WaitGroup - wg.Add(2) - - var client0 client.ReaderWriter - var client1 client.ReaderWriter - var err0 error - var err1 error - - // call verifiedClient in parallel - go func() { - client0, err0 = testChain.verifiedClient(node) - assert.NoError(t, err0) - wg.Done() - }() - go func() { - client1, err1 = testChain.verifiedClient(node) - assert.NoError(t, err1) - wg.Done() - }() - - wg.Wait() - - // check if pointers are all the same - assert.Equal(t, testChain.clientCache[mockServer.URL], client0) - assert.Equal(t, testChain.clientCache[mockServer.URL], client1) -} - -func ptr[T any](t T) *T { - return &t -} diff --git a/core/chains/solana/config.go b/core/chains/solana/config.go deleted file mode 100644 index 772d660a164..00000000000 --- a/core/chains/solana/config.go +++ /dev/null @@ -1,272 +0,0 @@ -package solana - -import ( - "fmt" - "net/url" - "slices" - "time" - - "github.com/gagliardetto/solana-go/rpc" - "github.com/pelletier/go-toml/v2" - "go.uber.org/multierr" - - relaytypes "github.com/smartcontractkit/chainlink-relay/pkg/types" - - solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" - soldb "github.com/smartcontractkit/chainlink-solana/pkg/solana/db" - - "github.com/smartcontractkit/chainlink/v2/core/services/relay" - "github.com/smartcontractkit/chainlink/v2/core/utils/config" -) - -type SolanaConfigs []*SolanaConfig - -func (cs SolanaConfigs) ValidateConfig() (err error) { - return cs.validateKeys() -} - -func (cs SolanaConfigs) validateKeys() (err error) { - // Unique chain IDs - chainIDs := config.UniqueStrings{} - for i, c := range cs { - if chainIDs.IsDupe(c.ChainID) { - err = multierr.Append(err, config.NewErrDuplicate(fmt.Sprintf("%d.ChainID", i), *c.ChainID)) - } - } - - // Unique node names - names := config.UniqueStrings{} - for i, c := range cs { - for j, n := range c.Nodes { - if names.IsDupe(n.Name) { - err = multierr.Append(err, config.NewErrDuplicate(fmt.Sprintf("%d.Nodes.%d.Name", i, j), *n.Name)) - } - } - } - - // Unique URLs - urls := config.UniqueStrings{} - for i, c := range cs { - for j, n := range c.Nodes { - u := (*url.URL)(n.URL) - if urls.IsDupeFmt(u) { - err = multierr.Append(err, config.NewErrDuplicate(fmt.Sprintf("%d.Nodes.%d.URL", i, j), u.String())) - } - } - } - return -} - -func (cs *SolanaConfigs) SetFrom(fs *SolanaConfigs) (err error) { - if err1 := fs.validateKeys(); err1 != nil { - return err1 - } - for _, f := range *fs { - if f.ChainID == nil { - *cs = append(*cs, f) - } else if i := slices.IndexFunc(*cs, func(c *SolanaConfig) bool { - return c.ChainID != nil && *c.ChainID == *f.ChainID - }); i == -1 { - *cs = append(*cs, f) - } else { - (*cs)[i].SetFrom(f) - } - } - return -} - -func nodeStatus(n *solcfg.Node, id relay.ChainID) (relaytypes.NodeStatus, error) { - var s relaytypes.NodeStatus - s.ChainID = id - s.Name = *n.Name - b, err := toml.Marshal(n) - if err != nil { - return relaytypes.NodeStatus{}, err - } - s.Config = string(b) - return s, nil -} - -type SolanaNodes []*solcfg.Node - -func (ns *SolanaNodes) SetFrom(fs *SolanaNodes) { - for _, f := range *fs { - if f.Name == nil { - *ns = append(*ns, f) - } else if i := slices.IndexFunc(*ns, func(n *solcfg.Node) bool { - return n.Name != nil && *n.Name == *f.Name - }); i == -1 { - *ns = append(*ns, f) - } else { - setFromNode((*ns)[i], f) - } - } -} - -func setFromNode(n, f *solcfg.Node) { - if f.Name != nil { - n.Name = f.Name - } - if f.URL != nil { - n.URL = f.URL - } -} - -func legacySolNode(n *solcfg.Node, id relay.ChainID) soldb.Node { - return soldb.Node{ - Name: *n.Name, - SolanaChainID: id, - SolanaURL: (*url.URL)(n.URL).String(), - } -} - -type SolanaConfig struct { - ChainID *string - // Do not access directly, use [IsEnabled] - Enabled *bool - solcfg.Chain - Nodes SolanaNodes -} - -func (c *SolanaConfig) IsEnabled() bool { - return c.Enabled == nil || *c.Enabled -} - -func (c *SolanaConfig) SetFrom(f *SolanaConfig) { - if f.ChainID != nil { - c.ChainID = f.ChainID - } - if f.Enabled != nil { - c.Enabled = f.Enabled - } - setFromChain(&c.Chain, &f.Chain) - c.Nodes.SetFrom(&f.Nodes) -} - -func setFromChain(c, f *solcfg.Chain) { - if f.BalancePollPeriod != nil { - c.BalancePollPeriod = f.BalancePollPeriod - } - if f.ConfirmPollPeriod != nil { - c.ConfirmPollPeriod = f.ConfirmPollPeriod - } - if f.OCR2CachePollPeriod != nil { - c.OCR2CachePollPeriod = f.OCR2CachePollPeriod - } - if f.OCR2CacheTTL != nil { - c.OCR2CacheTTL = f.OCR2CacheTTL - } - if f.TxTimeout != nil { - c.TxTimeout = f.TxTimeout - } - if f.TxRetryTimeout != nil { - c.TxRetryTimeout = f.TxRetryTimeout - } - if f.TxConfirmTimeout != nil { - c.TxConfirmTimeout = f.TxConfirmTimeout - } - if f.SkipPreflight != nil { - c.SkipPreflight = f.SkipPreflight - } - if f.Commitment != nil { - c.Commitment = f.Commitment - } - if f.MaxRetries != nil { - c.MaxRetries = f.MaxRetries - } -} - -func (c *SolanaConfig) ValidateConfig() (err error) { - if c.ChainID == nil { - err = multierr.Append(err, config.ErrMissing{Name: "ChainID", Msg: "required for all chains"}) - } else if *c.ChainID == "" { - err = multierr.Append(err, config.ErrEmpty{Name: "ChainID", Msg: "required for all chains"}) - } - - if len(c.Nodes) == 0 { - err = multierr.Append(err, config.ErrMissing{Name: "Nodes", Msg: "must have at least one node"}) - } - return -} - -func (c *SolanaConfig) TOMLString() (string, error) { - b, err := toml.Marshal(c) - if err != nil { - return "", err - } - return string(b), nil -} - -var _ solcfg.Config = &SolanaConfig{} - -func (c *SolanaConfig) BalancePollPeriod() time.Duration { - return c.Chain.BalancePollPeriod.Duration() -} - -func (c *SolanaConfig) ConfirmPollPeriod() time.Duration { - return c.Chain.ConfirmPollPeriod.Duration() -} - -func (c *SolanaConfig) OCR2CachePollPeriod() time.Duration { - return c.Chain.OCR2CachePollPeriod.Duration() -} - -func (c *SolanaConfig) OCR2CacheTTL() time.Duration { - return c.Chain.OCR2CacheTTL.Duration() -} - -func (c *SolanaConfig) TxTimeout() time.Duration { - return c.Chain.TxTimeout.Duration() -} - -func (c *SolanaConfig) TxRetryTimeout() time.Duration { - return c.Chain.TxRetryTimeout.Duration() -} - -func (c *SolanaConfig) TxConfirmTimeout() time.Duration { - return c.Chain.TxConfirmTimeout.Duration() -} - -func (c *SolanaConfig) SkipPreflight() bool { - return *c.Chain.SkipPreflight -} - -func (c *SolanaConfig) Commitment() rpc.CommitmentType { - return rpc.CommitmentType(*c.Chain.Commitment) -} - -func (c *SolanaConfig) MaxRetries() *uint { - if c.Chain.MaxRetries == nil { - return nil - } - mr := uint(*c.Chain.MaxRetries) - return &mr -} - -func (c *SolanaConfig) FeeEstimatorMode() string { - return *c.Chain.FeeEstimatorMode -} - -func (c *SolanaConfig) ComputeUnitPriceMax() uint64 { - return *c.Chain.ComputeUnitPriceMax -} - -func (c *SolanaConfig) ComputeUnitPriceMin() uint64 { - return *c.Chain.ComputeUnitPriceMin -} - -func (c *SolanaConfig) ComputeUnitPriceDefault() uint64 { - return *c.Chain.ComputeUnitPriceDefault -} - -func (c *SolanaConfig) FeeBumpPeriod() time.Duration { - return c.Chain.FeeBumpPeriod.Duration() -} - -func (c *SolanaConfig) ListNodes() ([]soldb.Node, error) { - var allNodes []soldb.Node - for _, n := range c.Nodes { - allNodes = append(allNodes, legacySolNode(n, *c.ChainID)) - } - return allNodes, nil -} diff --git a/core/chains/solana/monitor/balance.go b/core/chains/solana/monitor/balance.go deleted file mode 100644 index 9734a9a3ca7..00000000000 --- a/core/chains/solana/monitor/balance.go +++ /dev/null @@ -1,150 +0,0 @@ -package monitor - -import ( - "context" - "time" - - "github.com/gagliardetto/solana-go" - - "github.com/smartcontractkit/chainlink-relay/pkg/logger" - solanaClient "github.com/smartcontractkit/chainlink-solana/pkg/solana/client" - - "github.com/smartcontractkit/chainlink/v2/core/services" - "github.com/smartcontractkit/chainlink/v2/core/utils" -) - -// Config defines the monitor configuration. -type Config interface { - BalancePollPeriod() time.Duration -} - -// Keystore provides the keys to be monitored. -type Keystore interface { - Accounts(ctx context.Context) ([]string, error) -} - -// NewBalanceMonitor returns a balance monitoring services.Service which reports the SOL balance of all ks keys to prometheus. -func NewBalanceMonitor(chainID string, cfg Config, lggr logger.Logger, ks Keystore, newReader func() (solanaClient.Reader, error)) services.ServiceCtx { - return newBalanceMonitor(chainID, cfg, lggr, ks, newReader) -} - -func newBalanceMonitor(chainID string, cfg Config, lggr logger.Logger, ks Keystore, newReader func() (solanaClient.Reader, error)) *balanceMonitor { - b := balanceMonitor{ - chainID: chainID, - cfg: cfg, - lggr: logger.Named(lggr, "BalanceMonitor"), - ks: ks, - newReader: newReader, - stop: make(chan struct{}), - done: make(chan struct{}), - } - b.updateFn = b.updateProm - return &b -} - -type balanceMonitor struct { - utils.StartStopOnce - chainID string - cfg Config - lggr logger.Logger - ks Keystore - newReader func() (solanaClient.Reader, error) - updateFn func(acc solana.PublicKey, lamports uint64) // overridable for testing - - reader solanaClient.Reader - - stop, done chan struct{} -} - -func (b *balanceMonitor) Name() string { - return b.lggr.Name() -} - -func (b *balanceMonitor) Start(context.Context) error { - return b.StartOnce("SolanaBalanceMonitor", func() error { - go b.monitor() - return nil - }) -} - -func (b *balanceMonitor) Close() error { - return b.StopOnce("SolanaBalanceMonitor", func() error { - close(b.stop) - <-b.done - return nil - }) -} - -func (b *balanceMonitor) HealthReport() map[string]error { - return map[string]error{b.Name(): b.Healthy()} -} - -func (b *balanceMonitor) monitor() { - defer close(b.done) - ctx, cancel := utils.ContextFromChan(b.stop) - defer cancel() - - tick := time.After(utils.WithJitter(b.cfg.BalancePollPeriod())) - for { - select { - case <-b.stop: - return - case <-tick: - b.updateBalances(ctx) - tick = time.After(utils.WithJitter(b.cfg.BalancePollPeriod())) - } - } -} - -// getReader returns the cached solanaClient.Reader, or creates a new one if nil. -func (b *balanceMonitor) getReader() (solanaClient.Reader, error) { - if b.reader == nil { - var err error - b.reader, err = b.newReader() - if err != nil { - return nil, err - } - } - return b.reader, nil -} - -func (b *balanceMonitor) updateBalances(ctx context.Context) { - keys, err := b.ks.Accounts(ctx) - if err != nil { - b.lggr.Errorw("Failed to get keys", "err", err) - return - } - if len(keys) == 0 { - return - } - reader, err := b.getReader() - if err != nil { - b.lggr.Errorw("Failed to get client", "err", err) - return - } - var gotSomeBals bool - for _, k := range keys { - // Check for shutdown signal, since Balance blocks and may be slow. - select { - case <-b.stop: - return - default: - } - pubKey, err := solana.PublicKeyFromBase58(k) - if err != nil { - b.lggr.Errorw("Failed parse public key", "account", k, "err", err) - continue - } - lamports, err := reader.Balance(pubKey) - if err != nil { - b.lggr.Errorw("Failed to get balance", "account", k, "err", err) - continue - } - gotSomeBals = true - b.updateFn(pubKey, lamports) - } - if !gotSomeBals { - // Try a new client next time. - b.reader = nil - } -} diff --git a/core/chains/solana/monitor/balance_test.go b/core/chains/solana/monitor/balance_test.go deleted file mode 100644 index 5f5ef8e807a..00000000000 --- a/core/chains/solana/monitor/balance_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package monitor - -import ( - "context" - "fmt" - "testing" - "time" - - "github.com/gagliardetto/solana-go" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" - - "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" - "github.com/smartcontractkit/chainlink/v2/core/logger" - "github.com/smartcontractkit/chainlink/v2/core/services/keystore/keys/solkey" - - solanaRelay "github.com/smartcontractkit/chainlink-solana/pkg/solana" - "github.com/smartcontractkit/chainlink-solana/pkg/solana/client/mocks" -) - -func TestBalanceMonitor(t *testing.T) { - const chainID = "Chainlinktest-42" - ks := keystore{} - for i := 0; i < 3; i++ { - k, err := solkey.New() - assert.NoError(t, err) - ks = append(ks, k) - } - - bals := []uint64{0, 1, 1_000_000_000} - expBals := []string{ - "0.000000000", - "0.000000001", - "1.000000000", - } - - client := new(mocks.ReaderWriter) - client.Test(t) - type update struct{ acc, bal string } - var exp []update - for i := range bals { - acc := ks[i].PublicKey() - client.On("Balance", acc).Return(bals[i], nil) - exp = append(exp, update{acc.String(), expBals[i]}) - } - cfg := &config{balancePollPeriod: time.Second} - b := newBalanceMonitor(chainID, cfg, logger.TestLogger(t), ks, nil) - var got []update - done := make(chan struct{}) - b.updateFn = func(acc solana.PublicKey, lamports uint64) { - select { - case <-done: - return - default: - } - v := solanaRelay.LamportsToSol(lamports) // convert from lamports to SOL - got = append(got, update{acc.String(), fmt.Sprintf("%.9f", v)}) - if len(got) == len(exp) { - close(done) - } - } - b.reader = client - - require.NoError(t, b.Start(testutils.Context(t))) - t.Cleanup(func() { - assert.NoError(t, b.Close()) - client.AssertExpectations(t) - }) - select { - case <-time.After(testutils.WaitTimeout(t)): - t.Fatal("timed out waiting for balance monitor") - case <-done: - } - - assert.EqualValues(t, exp, got) -} - -type config struct { - balancePollPeriod time.Duration -} - -func (c *config) BalancePollPeriod() time.Duration { - return c.balancePollPeriod -} - -type keystore []solkey.Key - -func (k keystore) Accounts(ctx context.Context) (ks []string, err error) { - for _, acc := range k { - ks = append(ks, acc.PublicKeyStr()) - } - return -} diff --git a/core/chains/solana/monitor/prom.go b/core/chains/solana/monitor/prom.go deleted file mode 100644 index f853b6610e9..00000000000 --- a/core/chains/solana/monitor/prom.go +++ /dev/null @@ -1,19 +0,0 @@ -package monitor - -import ( - "github.com/gagliardetto/solana-go" - "github.com/prometheus/client_golang/prometheus" - "github.com/prometheus/client_golang/prometheus/promauto" - - solanaRelay "github.com/smartcontractkit/chainlink-solana/pkg/solana" -) - -var promSolanaBalance = promauto.NewGaugeVec( - prometheus.GaugeOpts{Name: "solana_balance", Help: "Solana account balances"}, - []string{"account", "chainID", "chainSet", "denomination"}, -) - -func (b *balanceMonitor) updateProm(acc solana.PublicKey, lamports uint64) { - v := solanaRelay.LamportsToSol(lamports) // convert from lamports to SOL - promSolanaBalance.WithLabelValues(acc.String(), b.chainID, "solana", "SOL").Set(v) -} diff --git a/core/chains/solana/monitor/prom_test.go b/core/chains/solana/monitor/prom_test.go deleted file mode 100644 index d1646e36874..00000000000 --- a/core/chains/solana/monitor/prom_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package monitor - -import ( - "testing" - - "github.com/gagliardetto/solana-go" - "github.com/prometheus/client_golang/prometheus/testutil" - "github.com/stretchr/testify/assert" -) - -func TestPromSolBalance(t *testing.T) { - key := solana.PublicKey{} - balance := uint64(1_000_000_000) - - monitor := balanceMonitor{chainID: "test-chain"} - monitor.updateProm(key, balance) - - // happy path test - promBalance := testutil.ToFloat64(promSolanaBalance.WithLabelValues(key.String(), monitor.chainID, "solana", "SOL")) - assert.Equal(t, float64(balance)/float64(solana.LAMPORTS_PER_SOL), promBalance) -} diff --git a/core/chains/starknet/chain.go b/core/chains/starknet/chain.go index b99aa9e2ff6..37908981370 100644 --- a/core/chains/starknet/chain.go +++ b/core/chains/starknet/chain.go @@ -9,8 +9,10 @@ import ( "github.com/pkg/errors" "go.uber.org/multierr" + relaychains "github.com/smartcontractkit/chainlink-relay/pkg/chains" "github.com/smartcontractkit/chainlink-relay/pkg/logger" "github.com/smartcontractkit/chainlink-relay/pkg/loop" + "github.com/smartcontractkit/chainlink-relay/pkg/services" relaytypes "github.com/smartcontractkit/chainlink-relay/pkg/types" starkChain "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/chain" starkchain "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/chain" @@ -20,9 +22,6 @@ import ( "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/starknet" "github.com/smartcontractkit/chainlink/v2/core/chains" - "github.com/smartcontractkit/chainlink/v2/core/chains/internal" - "github.com/smartcontractkit/chainlink/v2/core/services" - "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -107,8 +106,8 @@ func (c *chain) Reader() (starknet.Reader, error) { return c.getClient() } -func (c *chain) ChainID() relay.ChainID { - return relay.ChainID(c.id) +func (c *chain) ChainID() string { + return c.id } // getClient returns a client, randomly selecting one from available and valid nodes @@ -185,7 +184,7 @@ func (c *chain) GetChainStatus(ctx context.Context) (relaytypes.ChainStatus, err } func (c *chain) ListNodeStatuses(ctx context.Context, pageSize int32, pageToken string) (stats []relaytypes.NodeStatus, nextPageToken string, total int, err error) { - return internal.ListNodeStatuses(int(pageSize), pageToken, c.listNodeStatuses) + return relaychains.ListNodeStatuses(int(pageSize), pageToken, c.listNodeStatuses) } func (c *chain) Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error { @@ -201,7 +200,7 @@ func (c *chain) listNodeStatuses(start, end int) ([]relaytypes.NodeStatus, int, stats := make([]relaytypes.NodeStatus, 0) total := len(c.cfg.Nodes) if start >= total { - return stats, total, internal.ErrOutOfRange + return stats, total, relaychains.ErrOutOfRange } if end <= 0 || end > total { end = total diff --git a/core/cmd/shell_test.go b/core/cmd/shell_test.go index a8190a05951..b3c7af9c06b 100644 --- a/core/cmd/shell_test.go +++ b/core/cmd/shell_test.go @@ -12,10 +12,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" diff --git a/core/cmd/solana_chains_commands_test.go b/core/cmd/solana_chains_commands_test.go index ac80b307d0a..3a0265a5b5a 100644 --- a/core/cmd/solana_chains_commands_test.go +++ b/core/cmd/solana_chains_commands_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/solanatest" diff --git a/core/cmd/solana_node_commands_test.go b/core/cmd/solana_node_commands_test.go index 48a889c0adf..9a39129e34a 100644 --- a/core/cmd/solana_node_commands_test.go +++ b/core/cmd/solana_node_commands_test.go @@ -12,7 +12,7 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/utils" solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/solanatest" diff --git a/core/cmd/solana_transaction_commands_test.go b/core/cmd/solana_transaction_commands_test.go index a23a3dce5c2..8cd8e39daf3 100644 --- a/core/cmd/solana_transaction_commands_test.go +++ b/core/cmd/solana_transaction_commands_test.go @@ -19,7 +19,7 @@ import ( solanaClient "github.com/smartcontractkit/chainlink-solana/pkg/solana/client" solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" ) diff --git a/core/config/docs/docs_test.go b/core/config/docs/docs_test.go index 0eee33cb729..a5fdfbebecb 100644 --- a/core/config/docs/docs_test.go +++ b/core/config/docs/docs_test.go @@ -11,10 +11,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" "github.com/smartcontractkit/chainlink/v2/core/config/docs" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 75c6c1b2293..1583eaff7d3 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -21,7 +21,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 - github.com/smartcontractkit/libocr v0.0.0-20230922131214-122accb19ea6 + github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8 github.com/smartcontractkit/ocr2keepers v0.7.27 github.com/smartcontractkit/ocr2vrf v0.0.0-20230804151440-2f1eb1e20687 github.com/smartcontractkit/sqlx v1.3.5-0.20210805004948-4be295aacbeb @@ -155,7 +155,7 @@ require ( github.com/graph-gophers/dataloader v5.0.0+incompatible // indirect github.com/graph-gophers/graphql-go v1.3.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0-rc.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect @@ -300,8 +300,8 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc47 // indirect - github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231003135342-5e581164f8dd // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231014013935-9adbbcfda447 // indirect + github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231016132219-9c6fdb379595 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231016152201-a10a460e67d8 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 // indirect @@ -340,10 +340,10 @@ require ( go.dedis.ch/fixbuf v1.0.3 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0 // indirect go.opentelemetry.io/otel v1.19.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/sdk v1.16.0 // indirect + go.opentelemetry.io/otel/sdk v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/ratelimit v0.2.0 // indirect @@ -363,7 +363,7 @@ require ( google.golang.org/genproto v0.0.0-20230717213848-3f92550aa753 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230717213848-3f92550aa753 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753 // indirect - google.golang.org/grpc v1.56.2 // indirect + google.golang.org/grpc v1.58.3 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/guregu/null.v2 v2.1.2 // indirect gopkg.in/guregu/null.v4 v4.0.0 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index 42d72960e0e..1da09e040fc 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -634,8 +634,8 @@ github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLt github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0-rc.0 h1:mdLirNAJBxnGgyB6pjZLcs6ue/6eZGBui6gXspfq4ks= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0-rc.0/go.mod h1:kdXbOySqcQeTxiqglW7aahTmWZy3Pgi6SYL36yvKeyA= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0 h1:f4tggROQKKcnh4eItay6z/HbHLqghBxS8g7pyMhmDio= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0/go.mod h1:hKAkSgNkL0FII46ZkJcpVEAai4KV+swlIWCKfekd1pA= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3 h1:o95KDiV/b1xdkumY5YbLR0/n2+wBxUpgf3HgfKgTyLI= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3/go.mod h1:hTxjzRcX49ogbTGVJ1sM5mz5s+SSgiGIyL3jjPxl32E= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= @@ -1456,18 +1456,18 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc47 h1:vdieOW3CZGdD2R5zvCSMS+0vksyExPN3/Fa1uVfld/A= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc47/go.mod h1:xMwqRdj5vqYhCJXgKVqvyAwdcqM6ZAEhnwEQ4Khsop8= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231003135342-5e581164f8dd h1:5r6SDRgZfi0kxc7D6sFV7h/bX+D7yewDq3FkyE0VMIM= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231003135342-5e581164f8dd/go.mod h1:agmAM21+teJkw0aj9KYj3q3s1sFkx3PXo5ibWJIrDfU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231014013935-9adbbcfda447 h1:8Jmwb++1dCI8pnkWMD8C5es+8pp9h0cTVZ75gWUX6Rc= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231014013935-9adbbcfda447/go.mod h1:RIUJXn7EVp24TL2p4FW79dYjyno23x5mjt1nKN+5WEk= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231016132219-9c6fdb379595 h1:a6GfS0N4/7X5YQAdne0TLcdSA7w5UwJ1dG0wx6tP3GY= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231016132219-9c6fdb379595/go.mod h1:mV+ayN6figopkI+9OwHUbBdYMhsrXa+CDvCkEM3FNt0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231016152201-a10a460e67d8 h1:EYo1yJAwBt2RcK45vaExh5cnEJ3nk2RwF0tdNjMoWNI= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231016152201-a10a460e67d8/go.mod h1:S17dRqwSFSrMdueQ3clPI6XWZWKJjTvqTZVd0F05Ugc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 h1:ByVauKFXphRlSNG47lNuxZ9aicu+r8AoNp933VRPpCw= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918/go.mod h1:/yp/sqD8Iz5GU5fcercjrw0ivJF7HDcupYg+Gjr7EPg= 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= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= -github.com/smartcontractkit/libocr v0.0.0-20230922131214-122accb19ea6 h1:eSo9r53fARv2MnIO5pqYvQOXMBsTlAwhHyQ6BAVp6bY= -github.com/smartcontractkit/libocr v0.0.0-20230922131214-122accb19ea6/go.mod h1:2lyRkw/qLQgUWlrWWmq5nj0y90rWeO6Y+v+fCakRgb0= +github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8 h1:R9NkVN+1fooUJFsN9zj9gDY1B+zv54zNO785RQZRVfE= +github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8/go.mod h1:2lyRkw/qLQgUWlrWWmq5nj0y90rWeO6Y+v+fCakRgb0= github.com/smartcontractkit/ocr2keepers v0.7.27 h1:kwqMrzmEdq6gH4yqNuLQCbdlED0KaIjwZzu3FF+Gves= github.com/smartcontractkit/ocr2keepers v0.7.27/go.mod h1:1QGzJURnoWpysguPowOe2bshV0hNp1YX10HHlhDEsas= github.com/smartcontractkit/ocr2vrf v0.0.0-20230804151440-2f1eb1e20687 h1:NwC3SOc25noBTe1KUQjt45fyTIuInhoE2UfgcHAdihM= @@ -1658,14 +1658,14 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 h1:ZOLJc06r4CB42laIXg/7udr0pbZyuAihN10A/XuiQRY= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0/go.mod h1:5z+/ZWJQKXa9YT34fQNx5K8Hd1EoIhvtUygUQPqEOgQ= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0 h1:RsQi0qJ2imFfCvZabqzM9cNXBG8k6gXMv1A0cXRmH6A= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0/go.mod h1:vsh3ySueQCiKPxFLvjWC4Z135gIa34TQ/NSqkDTZYUM= go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= -go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= -go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= +go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -2175,8 +2175,8 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc/examples v0.0.0-20210424002626-9572fd6faeae/go.mod h1:Ly7ZA/ARzg8fnPU9TyZIxoz33sEUuWX7txiqs8lPTgE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/core/services/chainlink/config.go b/core/services/chainlink/config.go index 5578f8c0453..6227faac07e 100644 --- a/core/services/chainlink/config.go +++ b/core/services/chainlink/config.go @@ -1,9 +1,8 @@ package chainlink import ( - "fmt" - "errors" + "fmt" "go.uber.org/multierr" @@ -14,8 +13,8 @@ import ( "github.com/smartcontractkit/chainlink/v2/core/utils" "github.com/smartcontractkit/chainlink/v2/core/utils/config" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/config/docs" "github.com/smartcontractkit/chainlink/v2/core/config/env" "github.com/smartcontractkit/chainlink/v2/core/config/toml" diff --git a/core/services/chainlink/config_general.go b/core/services/chainlink/config_general.go index 33be81add5d..c787a71f240 100644 --- a/core/services/chainlink/config_general.go +++ b/core/services/chainlink/config_general.go @@ -15,9 +15,9 @@ import ( ocrnetworking "github.com/smartcontractkit/libocr/networking" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" "github.com/smartcontractkit/chainlink/v2/core/config" coreconfig "github.com/smartcontractkit/chainlink/v2/core/config" diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index eb01b893543..3f89c1e78d7 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -10,21 +10,22 @@ import ( "github.com/kylelemons/godebug/diff" "github.com/shopspring/decimal" - ocrcommontypes "github.com/smartcontractkit/libocr/commontypes" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/zap/zapcore" + ocrcommontypes "github.com/smartcontractkit/libocr/commontypes" + coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config" relayutils "github.com/smartcontractkit/chainlink-relay/pkg/utils" solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" "github.com/smartcontractkit/chainlink/v2/core/assets" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/client" evmcfg "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" legacy "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/config/toml" diff --git a/core/services/chainlink/mocks/general_config.go b/core/services/chainlink/mocks/general_config.go index 792ec1994dd..915230580d0 100644 --- a/core/services/chainlink/mocks/general_config.go +++ b/core/services/chainlink/mocks/general_config.go @@ -8,7 +8,7 @@ import ( mock "github.com/stretchr/testify/mock" - solana "github.com/smartcontractkit/chainlink/v2/core/chains/solana" + solana "github.com/smartcontractkit/chainlink-solana/pkg/solana" starknet "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" @@ -484,15 +484,15 @@ func (_m *GeneralConfig) ShutdownGracePeriod() time.Duration { } // SolanaConfigs provides a mock function with given fields: -func (_m *GeneralConfig) SolanaConfigs() solana.SolanaConfigs { +func (_m *GeneralConfig) SolanaConfigs() solana.TOMLConfigs { ret := _m.Called() - var r0 solana.SolanaConfigs - if rf, ok := ret.Get(0).(func() solana.SolanaConfigs); ok { + var r0 solana.TOMLConfigs + if rf, ok := ret.Get(0).(func() solana.TOMLConfigs); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(solana.SolanaConfigs) + r0 = ret.Get(0).(solana.TOMLConfigs) } } diff --git a/core/services/chainlink/relayer_chain_interoperators_test.go b/core/services/chainlink/relayer_chain_interoperators_test.go index 527dacd56d8..5c4810bd04e 100644 --- a/core/services/chainlink/relayer_chain_interoperators_test.go +++ b/core/services/chainlink/relayer_chain_interoperators_test.go @@ -15,9 +15,9 @@ import ( solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" diff --git a/core/services/chainlink/relayer_factory.go b/core/services/chainlink/relayer_factory.go index cf5d1516523..3a65a58f257 100644 --- a/core/services/chainlink/relayer_factory.go +++ b/core/services/chainlink/relayer_factory.go @@ -14,9 +14,9 @@ import ( pkgsolana "github.com/smartcontractkit/chainlink-solana/pkg/solana" pkgstarknet "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" "github.com/smartcontractkit/chainlink/v2/core/config/env" "github.com/smartcontractkit/chainlink/v2/core/logger" diff --git a/core/services/chainlink/types.go b/core/services/chainlink/types.go index a286dc3c234..7cfa15f3031 100644 --- a/core/services/chainlink/types.go +++ b/core/services/chainlink/types.go @@ -1,9 +1,9 @@ package chainlink import ( + "github.com/smartcontractkit/chainlink-solana/pkg/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" "github.com/smartcontractkit/chainlink/v2/core/config" ) diff --git a/core/services/multi.go b/core/services/multi.go index d12e56cfad4..4ea263f5a30 100644 --- a/core/services/multi.go +++ b/core/services/multi.go @@ -1,96 +1,27 @@ package services import ( - "context" "io" - "sync" - "go.uber.org/multierr" + "github.com/smartcontractkit/chainlink-relay/pkg/services" ) // StartClose is a subset of the ServiceCtx interface. -type StartClose interface { - Start(context.Context) error - Close() error -} +type StartClose = services.StartClose // MultiStart is a utility for starting multiple services together. // The set of started services is tracked internally, so that they can be closed if any single service fails to start. -type MultiStart struct { - started []StartClose -} - -// Start attempts to Start all services. If any service fails to start, the previously started services will be -// Closed, and an error returned. -func (m *MultiStart) Start(ctx context.Context, srvcs ...StartClose) (err error) { - for _, s := range srvcs { - err = m.start(ctx, s) - if err != nil { - return err - } - } - return -} - -func (m *MultiStart) start(ctx context.Context, s StartClose) (err error) { - err = s.Start(ctx) - if err != nil { - err = multierr.Append(err, m.Close()) - } else { - m.started = append(m.started, s) - } - return -} - -// Close closes all started services, in reverse order. -func (m *MultiStart) Close() (err error) { - for i := len(m.started) - 1; i >= 0; i-- { - s := m.started[i] - err = multierr.Append(err, s.Close()) - } - return -} - -// CloseBecause calls Close and returns reason along with any additional errors. -func (m *MultiStart) CloseBecause(reason error) (err error) { - return multierr.Append(reason, m.Close()) -} +type MultiStart = services.MultiStart // CloseAll closes all elements concurrently. // Use this when you have various different types of io.Closer. func CloseAll(cs ...io.Closer) error { - return multiCloser[io.Closer](cs).Close() + return services.CloseAll(cs...) } // MultiCloser returns an io.Closer which closes all elements concurrently. // Use this when you have a slice of a type which implements io.Closer. // []io.Closer can be cast directly to MultiCloser. func MultiCloser[C io.Closer](cs []C) io.Closer { - return multiCloser[C](cs) -} - -type multiCloser[C io.Closer] []C - -// Close closes all elements concurrently and collects any returned errors as a multierr. -func (m multiCloser[C]) Close() (err error) { - if len(m) == 0 { - return nil - } - var wg sync.WaitGroup - wg.Add(len(m)) - errs := make(chan error, len(m)) - for _, s := range m { - go func(c io.Closer) { - defer wg.Done() - if e := c.Close(); e != nil { - errs <- e - } - }(s) - } - wg.Wait() - close(errs) - for e := range errs { - err = multierr.Append(err, e) - } - return + return services.MultiCloser(cs) } diff --git a/core/services/multi_example_test.go b/core/services/multi_example_test.go deleted file mode 100644 index 235e1615852..00000000000 --- a/core/services/multi_example_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package services - -import ( - "context" - "fmt" -) - -type Healthy string - -func (h Healthy) Start(ctx context.Context) error { - fmt.Println(h, "started") - return nil -} - -func (h Healthy) Close() error { - fmt.Println(h, "closed") - return nil -} - -type CloseFailure string - -func (c CloseFailure) Start(ctx context.Context) error { - fmt.Println(c, "started") - return nil -} - -func (c CloseFailure) Close() error { - fmt.Println(c, "close failure") - return fmt.Errorf("failed to close: %s", c) -} - -type WontStart string - -func (f WontStart) Start(ctx context.Context) error { - fmt.Println(f, "start failure") - return fmt.Errorf("failed to start: %s", f) -} - -func (f WontStart) Close() error { - fmt.Println(f, "close failure") - return fmt.Errorf("cannot call Close after failed Start: %s", f) -} - -func ExampleMultiStart() { - ctx := context.Background() - - a := Healthy("a") - b := CloseFailure("b") - c := WontStart("c") - - var ms MultiStart - if err := ms.Start(ctx, a, b, c); err != nil { - fmt.Println(err) - } - - // Output: - // a started - // b started - // c start failure - // b close failure - // a closed - // failed to start: c; failed to close: b -} - -func ExampleMultiCloser() { - ctx := context.Background() - - f1 := CloseFailure("f") - f2 := CloseFailure("f") - cs := []CloseFailure{f1, f2} - - var ms MultiStart - if err := ms.Start(ctx, f1, f2); err != nil { - fmt.Println(err) - return - } - mc := MultiCloser(cs) - if err := mc.Close(); err != nil { - fmt.Println(err) - } - - // Output: - // f started - // f started - // f close failure - // f close failure - // failed to close: f; failed to close: f -} diff --git a/core/services/service.go b/core/services/service.go index 5bf61e062d2..5ed4e67f272 100644 --- a/core/services/service.go +++ b/core/services/service.go @@ -72,6 +72,8 @@ import "context" // } // // } +// +// Deprecated: use chainlink-relay/pkg/services.Service type ServiceCtx interface { // Start the service. Must quit immediately if the context is cancelled. // The given context applies to Start function only and must not be retained. diff --git a/core/utils/config/validate.go b/core/utils/config/validate.go index 858548e3473..3ed0ffbabba 100644 --- a/core/utils/config/validate.go +++ b/core/utils/config/validate.go @@ -8,6 +8,7 @@ import ( "go.uber.org/multierr" + "github.com/smartcontractkit/chainlink-relay/pkg/config" "github.com/smartcontractkit/chainlink/v2/core/utils" ) @@ -124,73 +125,19 @@ func NamedMultiErrorList(err error, name string) error { return fmt.Errorf("%s: %s", name, msg) } -type ErrInvalid struct { - Name string - Value any - Msg string -} +type ErrInvalid = config.ErrInvalid // NewErrDuplicate returns an ErrInvalid with a standard duplicate message. func NewErrDuplicate(name string, value any) ErrInvalid { - return ErrInvalid{Name: name, Value: value, Msg: "duplicate - must be unique"} -} - -func (e ErrInvalid) Error() string { - return fmt.Sprintf("%s: invalid value (%v): %s", e.Name, e.Value, e.Msg) + return config.NewErrDuplicate(name, value) } -type ErrMissing struct { - Name string - Msg string -} +type ErrMissing = config.ErrMissing -func (e ErrMissing) Error() string { - return fmt.Sprintf("%s: missing: %s", e.Name, e.Msg) -} - -type ErrEmpty struct { - Name string - Msg string -} - -func (e ErrEmpty) Error() string { - return fmt.Sprintf("%s: empty: %s", e.Name, e.Msg) -} +type ErrEmpty = config.ErrEmpty // UniqueStrings is a helper for tracking unique values in string form. -type UniqueStrings map[string]struct{} - -// IsDupeFmt is like IsDupe, but calls String(). -func (u UniqueStrings) IsDupeFmt(t fmt.Stringer) bool { - if t == nil { - return false - } - if reflect.ValueOf(t).IsNil() { - // interface holds a typed-nil value - return false - } - return u.isDupe(t.String()) -} - -// IsDupe returns true if the set already contains the string, otherwise false. -// Non-nil/empty strings are added to the set. -func (u UniqueStrings) IsDupe(s *string) bool { - if s == nil { - return false - } - return u.isDupe(*s) -} - -func (u UniqueStrings) isDupe(s string) bool { - if s == "" { - return false - } - _, ok := u[s] - if !ok { - u[s] = struct{}{} - } - return ok -} +type UniqueStrings = config.UniqueStrings type ErrOverride struct { Name string diff --git a/core/utils/utils.go b/core/utils/utils.go index 71c65e08c14..d96546b3e19 100644 --- a/core/utils/utils.go +++ b/core/utils/utils.go @@ -833,6 +833,7 @@ var ( ) // StartStopOnce contains a StartStopOnceState integer +// Deprecated: use services.StateMachine type StartStopOnce struct { state atomic.Int32 sync.RWMutex // lock is held during startup/shutdown, RLock is held while executing functions dependent on a particular state diff --git a/core/web/solana_chains_controller_test.go b/core/web/solana_chains_controller_test.go index 3112c42856f..432fbb45842 100644 --- a/core/web/solana_chains_controller_test.go +++ b/core/web/solana_chains_controller_test.go @@ -15,7 +15,7 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/utils" "github.com/smartcontractkit/chainlink-solana/pkg/solana/config" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" configtest "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/configtest/v2" diff --git a/go.mod b/go.mod index 8f21fab6673..3c659c780a2 100644 --- a/go.mod +++ b/go.mod @@ -68,10 +68,10 @@ require ( github.com/shopspring/decimal v1.3.1 github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc47 - github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231003135342-5e581164f8dd - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231014013935-9adbbcfda447 + github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231016132219-9c6fdb379595 + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231016152201-a10a460e67d8 github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 - github.com/smartcontractkit/libocr v0.0.0-20230922131214-122accb19ea6 + github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8 github.com/smartcontractkit/ocr2keepers v0.7.27 github.com/smartcontractkit/ocr2vrf v0.0.0-20230804151440-2f1eb1e20687 github.com/smartcontractkit/sqlx v1.3.5-0.20210805004948-4be295aacbeb @@ -198,7 +198,7 @@ require ( github.com/gorilla/context v1.1.1 // indirect github.com/grafana/pyroscope-go/godeltaprof v0.1.4 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0-rc.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect @@ -348,10 +348,10 @@ require ( go.dedis.ch/protobuf v1.0.11 // indirect go.etcd.io/bbolt v1.3.7 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0 // indirect go.opentelemetry.io/otel v1.19.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/sdk v1.16.0 // indirect + go.opentelemetry.io/otel/sdk v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect go.uber.org/ratelimit v0.2.0 // indirect golang.org/x/arch v0.3.0 // indirect @@ -359,7 +359,7 @@ require ( google.golang.org/genproto v0.0.0-20230717213848-3f92550aa753 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230717213848-3f92550aa753 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753 // indirect - google.golang.org/grpc v1.56.2 // indirect + google.golang.org/grpc v1.58.3 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 26697c12f2f..6cc361a762f 100644 --- a/go.sum +++ b/go.sum @@ -631,8 +631,8 @@ github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLt github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0-rc.0 h1:mdLirNAJBxnGgyB6pjZLcs6ue/6eZGBui6gXspfq4ks= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0-rc.0/go.mod h1:kdXbOySqcQeTxiqglW7aahTmWZy3Pgi6SYL36yvKeyA= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0 h1:f4tggROQKKcnh4eItay6z/HbHLqghBxS8g7pyMhmDio= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0/go.mod h1:hKAkSgNkL0FII46ZkJcpVEAai4KV+swlIWCKfekd1pA= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3 h1:o95KDiV/b1xdkumY5YbLR0/n2+wBxUpgf3HgfKgTyLI= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3/go.mod h1:hTxjzRcX49ogbTGVJ1sM5mz5s+SSgiGIyL3jjPxl32E= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= @@ -1457,18 +1457,18 @@ github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 h1:T3lFWumv github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704/go.mod h1:2QuJdEouTWjh5BDy5o/vgGXQtR4Gz8yH1IYB5eT7u4M= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc47 h1:vdieOW3CZGdD2R5zvCSMS+0vksyExPN3/Fa1uVfld/A= github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc47/go.mod h1:xMwqRdj5vqYhCJXgKVqvyAwdcqM6ZAEhnwEQ4Khsop8= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231003135342-5e581164f8dd h1:5r6SDRgZfi0kxc7D6sFV7h/bX+D7yewDq3FkyE0VMIM= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231003135342-5e581164f8dd/go.mod h1:agmAM21+teJkw0aj9KYj3q3s1sFkx3PXo5ibWJIrDfU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231014013935-9adbbcfda447 h1:8Jmwb++1dCI8pnkWMD8C5es+8pp9h0cTVZ75gWUX6Rc= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231014013935-9adbbcfda447/go.mod h1:RIUJXn7EVp24TL2p4FW79dYjyno23x5mjt1nKN+5WEk= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231016132219-9c6fdb379595 h1:a6GfS0N4/7X5YQAdne0TLcdSA7w5UwJ1dG0wx6tP3GY= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231016132219-9c6fdb379595/go.mod h1:mV+ayN6figopkI+9OwHUbBdYMhsrXa+CDvCkEM3FNt0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231016152201-a10a460e67d8 h1:EYo1yJAwBt2RcK45vaExh5cnEJ3nk2RwF0tdNjMoWNI= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231016152201-a10a460e67d8/go.mod h1:S17dRqwSFSrMdueQ3clPI6XWZWKJjTvqTZVd0F05Ugc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 h1:ByVauKFXphRlSNG47lNuxZ9aicu+r8AoNp933VRPpCw= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918/go.mod h1:/yp/sqD8Iz5GU5fcercjrw0ivJF7HDcupYg+Gjr7EPg= 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= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= -github.com/smartcontractkit/libocr v0.0.0-20230922131214-122accb19ea6 h1:eSo9r53fARv2MnIO5pqYvQOXMBsTlAwhHyQ6BAVp6bY= -github.com/smartcontractkit/libocr v0.0.0-20230922131214-122accb19ea6/go.mod h1:2lyRkw/qLQgUWlrWWmq5nj0y90rWeO6Y+v+fCakRgb0= +github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8 h1:R9NkVN+1fooUJFsN9zj9gDY1B+zv54zNO785RQZRVfE= +github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8/go.mod h1:2lyRkw/qLQgUWlrWWmq5nj0y90rWeO6Y+v+fCakRgb0= github.com/smartcontractkit/ocr2keepers v0.7.27 h1:kwqMrzmEdq6gH4yqNuLQCbdlED0KaIjwZzu3FF+Gves= github.com/smartcontractkit/ocr2keepers v0.7.27/go.mod h1:1QGzJURnoWpysguPowOe2bshV0hNp1YX10HHlhDEsas= github.com/smartcontractkit/ocr2vrf v0.0.0-20230804151440-2f1eb1e20687 h1:NwC3SOc25noBTe1KUQjt45fyTIuInhoE2UfgcHAdihM= @@ -1660,14 +1660,14 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 h1:ZOLJc06r4CB42laIXg/7udr0pbZyuAihN10A/XuiQRY= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0/go.mod h1:5z+/ZWJQKXa9YT34fQNx5K8Hd1EoIhvtUygUQPqEOgQ= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0 h1:RsQi0qJ2imFfCvZabqzM9cNXBG8k6gXMv1A0cXRmH6A= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0/go.mod h1:vsh3ySueQCiKPxFLvjWC4Z135gIa34TQ/NSqkDTZYUM= go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= -go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= -go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= +go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -2180,8 +2180,8 @@ google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.56.2 h1:fVRFRnXvU+x6C4IlHZewvJOVHoOv1TUuQyoRsYnB4bI= -google.golang.org/grpc v1.56.2/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc/examples v0.0.0-20210424002626-9572fd6faeae/go.mod h1:Ly7ZA/ARzg8fnPU9TyZIxoz33sEUuWX7txiqs8lPTgE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 49533073344..7a2862e3ca4 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -22,7 +22,7 @@ require ( github.com/smartcontractkit/chainlink-env v0.38.3 github.com/smartcontractkit/chainlink-testing-framework v1.17.12-0.20231016091231-25809996fbd4 github.com/smartcontractkit/chainlink/v2 v2.0.0-00010101000000-000000000000 - github.com/smartcontractkit/libocr v0.0.0-20230922131214-122accb19ea6 + github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8 github.com/smartcontractkit/ocr2keepers v0.7.27 github.com/smartcontractkit/ocr2vrf v0.0.0-20230804151440-2f1eb1e20687 github.com/smartcontractkit/tdh2/go/tdh2 v0.0.0-20230906073235-9e478e5e19f1 @@ -207,7 +207,7 @@ require ( github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd // indirect github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0-rc.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0 // indirect github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect @@ -383,8 +383,8 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/smartcontractkit/caigo v0.0.0-20230621050857-b29a4ca8c704 // indirect github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc47 // indirect - github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231003135342-5e581164f8dd // indirect - github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231014013935-9adbbcfda447 // indirect + github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231016132219-9c6fdb379595 // indirect + github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231016152201-a10a460e67d8 // indirect github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 // indirect github.com/smartcontractkit/sqlx v1.3.5-0.20210805004948-4be295aacbeb // indirect github.com/smartcontractkit/tdh2/go/ocr2/decryptionplugin v0.0.0-20230906073235-9e478e5e19f1 // indirect @@ -434,11 +434,11 @@ require ( go.etcd.io/etcd/client/v3 v3.5.7 // indirect go.mongodb.org/mongo-driver v1.12.0 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 // indirect go.opentelemetry.io/otel v1.19.0 // indirect go.opentelemetry.io/otel/metric v1.19.0 // indirect - go.opentelemetry.io/otel/sdk v1.16.0 // indirect + go.opentelemetry.io/otel/sdk v1.19.0 // indirect go.opentelemetry.io/otel/trace v1.19.0 // indirect go.starlark.net v0.0.0-20220817180228-f738f5508c12 // indirect go.uber.org/atomic v1.11.0 // indirect @@ -463,7 +463,7 @@ require ( google.golang.org/genproto v0.0.0-20230717213848-3f92550aa753 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230717213848-3f92550aa753 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753 // indirect - google.golang.org/grpc v1.57.0 // indirect + google.golang.org/grpc v1.58.3 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/guregu/null.v2 v2.1.2 // indirect gopkg.in/inf.v0 v0.9.1 // indirect @@ -509,5 +509,5 @@ replace ( github.com/mwitkow/grpc-proxy => github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f github.com/prometheus/prometheus => github.com/prometheus/prometheus v0.43.1-0.20230327151049-211ae4f1f0a2 - github.com/sercand/kuberesolver v2.4.0+incompatible => github.com/sercand/kuberesolver/v5 v5.1.0 + github.com/sercand/kuberesolver v2.4.0+incompatible => github.com/sercand/kuberesolver/v5 v5.1.1 ) diff --git a/integration-tests/go.sum b/integration-tests/go.sum index a2b1454a80f..a1f0c2ceb27 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -149,8 +149,8 @@ cloud.google.com/go/compute v1.13.0/go.mod h1:5aPTS0cUNMIc1CE546K+Th6weJUNQErARy cloud.google.com/go/compute v1.14.0/go.mod h1:YfLtxrj9sU4Yxv+sXzZkyPjEyPBZfXHUvjxega5vAdo= cloud.google.com/go/compute v1.15.1/go.mod h1:bjjoF/NtFUrkD/urWfdHaKuOPDR5nWIs63rR+SXhcpA= cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= -cloud.google.com/go/compute v1.20.1 h1:6aKEtlUiwEpJzM001l0yFkpXmUVXaN8W+fbkb2AZNbg= -cloud.google.com/go/compute v1.20.1/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= +cloud.google.com/go/compute v1.21.0 h1:JNBsyXVoOoNJtTQcnEY5uYpZIbeCTYIeDe0Xh1bySMk= +cloud.google.com/go/compute v1.21.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= cloud.google.com/go/compute/metadata v0.1.0/go.mod h1:Z1VN+bulIf6bt4P/C37K4DyZYZEXYonfTBHHFPO/4UU= cloud.google.com/go/compute/metadata v0.2.0/go.mod h1:zFmK7XCadkQkj6TtorcaGlCW1hT1fIilQDwofLpJ20k= cloud.google.com/go/compute/metadata v0.2.1/go.mod h1:jgHgmJd2RKBGzXqF5LR2EZMGxBkeanZ9wwa75XHJgOM= @@ -934,14 +934,14 @@ github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go. github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/go-control-plane v0.10.3/go.mod h1:fJJn/j26vwOu972OllsvAgJJM//w9BV6Fxbg2LuVd34= github.com/envoyproxy/go-control-plane v0.11.0/go.mod h1:VnHyVMpzcLvCFt9yUz1UnCwHLhwx1WguiVDV7pTG/tI= -github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f h1:7T++XKzy4xg7PKy+bM+Sa9/oe1OC88yz2hXQUISoXfA= -github.com/envoyproxy/go-control-plane v0.11.1-0.20230524094728-9239064ad72f/go.mod h1:sfYdkwUW4BA3PbKjySwjJy+O4Pu0h62rlqCMHNk+K+Q= +github.com/envoyproxy/go-control-plane v0.11.1 h1:wSUXTlLfiAQRWs2F+p+EKOY9rUyis1MyGqJ2DIk5HpM= +github.com/envoyproxy/go-control-plane v0.11.1/go.mod h1:uhMcXKCQMEJHiAb0w+YGefQLaTEw+YhGluxZkrTmD0g= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v0.6.7/go.mod h1:dyJXwwfPK2VSqiB9Klm1J6romD608Ba7Hij42vrOBCo= github.com/envoyproxy/protoc-gen-validate v0.9.1/go.mod h1:OKNgG7TCp5pF4d6XftA0++PMirau2/yoOwVac3AbF2w= github.com/envoyproxy/protoc-gen-validate v0.10.0/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= -github.com/envoyproxy/protoc-gen-validate v0.10.1 h1:c0g45+xCJhdgFGw7a5QAfdS4byAbud7miNWJ1WwEVf8= -github.com/envoyproxy/protoc-gen-validate v0.10.1/go.mod h1:DRjgyB0I43LtJapqN6NiRwroiAU2PaFuvk/vjgh61ss= +github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= +github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= github.com/esote/minmaxheap v1.0.0 h1:rgA7StnXXpZG6qlM0S7pUmEv1KpWe32rYT4x8J8ntaA= github.com/esote/minmaxheap v1.0.0/go.mod h1:Ln8+i7fS1k3PLgZI2JAo0iA1as95QnIYiGCrqSJ5FZk= github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw= @@ -1374,8 +1374,8 @@ github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmg github.com/grpc-ecosystem/go-grpc-middleware v1.1.0/go.mod h1:f5nM7jw/oeRSadq3xCzHAvxcr8HZnzsqU6ILg/0NiiE= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0-rc.0 h1:mdLirNAJBxnGgyB6pjZLcs6ue/6eZGBui6gXspfq4ks= -github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0-rc.0/go.mod h1:kdXbOySqcQeTxiqglW7aahTmWZy3Pgi6SYL36yvKeyA= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0 h1:f4tggROQKKcnh4eItay6z/HbHLqghBxS8g7pyMhmDio= +github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.0/go.mod h1:hKAkSgNkL0FII46ZkJcpVEAai4KV+swlIWCKfekd1pA= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3 h1:o95KDiV/b1xdkumY5YbLR0/n2+wBxUpgf3HgfKgTyLI= github.com/grpc-ecosystem/go-grpc-middleware/v2 v2.0.0-rc.3/go.mod h1:hTxjzRcX49ogbTGVJ1sM5mz5s+SSgiGIyL3jjPxl32E= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= @@ -2329,8 +2329,8 @@ github.com/scylladb/go-reflectx v1.0.1 h1:b917wZM7189pZdlND9PbIJ6NQxfDPfBvUaQ7cj github.com/scylladb/go-reflectx v1.0.1/go.mod h1:rWnOfDIRWBGN0miMLIcoPt/Dhi2doCMZqwMCJ3KupFc= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/sercand/kuberesolver/v5 v5.1.0 h1:YLqreB1vUFbZHSidcqI5ChMp+RIRmop0brQOeUFWiRw= -github.com/sercand/kuberesolver/v5 v5.1.0/go.mod h1:Fs1KbKhVRnB2aDWN12NjKCB+RgYMWZJ294T3BtmVCpQ= +github.com/sercand/kuberesolver/v5 v5.1.1 h1:CYH+d67G0sGBj7q5wLK61yzqJJ8gLLC8aeprPTHb6yY= +github.com/sercand/kuberesolver/v5 v5.1.1/go.mod h1:Fs1KbKhVRnB2aDWN12NjKCB+RgYMWZJ294T3BtmVCpQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ= github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= @@ -2360,10 +2360,10 @@ github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc4 github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc47/go.mod h1:xMwqRdj5vqYhCJXgKVqvyAwdcqM6ZAEhnwEQ4Khsop8= github.com/smartcontractkit/chainlink-env v0.38.3 h1:ZtOnwkG622R0VCTxL5V09AnT/QXhlFwkGTjd0Lsfpfg= github.com/smartcontractkit/chainlink-env v0.38.3/go.mod h1:7z4sw/hN8TxioQCLwFqQdhK3vaOV0a22Qe99z4bRUcg= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231003135342-5e581164f8dd h1:5r6SDRgZfi0kxc7D6sFV7h/bX+D7yewDq3FkyE0VMIM= -github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231003135342-5e581164f8dd/go.mod h1:agmAM21+teJkw0aj9KYj3q3s1sFkx3PXo5ibWJIrDfU= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231014013935-9adbbcfda447 h1:8Jmwb++1dCI8pnkWMD8C5es+8pp9h0cTVZ75gWUX6Rc= -github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231014013935-9adbbcfda447/go.mod h1:RIUJXn7EVp24TL2p4FW79dYjyno23x5mjt1nKN+5WEk= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231016132219-9c6fdb379595 h1:a6GfS0N4/7X5YQAdne0TLcdSA7w5UwJ1dG0wx6tP3GY= +github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231016132219-9c6fdb379595/go.mod h1:mV+ayN6figopkI+9OwHUbBdYMhsrXa+CDvCkEM3FNt0= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231016152201-a10a460e67d8 h1:EYo1yJAwBt2RcK45vaExh5cnEJ3nk2RwF0tdNjMoWNI= +github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231016152201-a10a460e67d8/go.mod h1:S17dRqwSFSrMdueQ3clPI6XWZWKJjTvqTZVd0F05Ugc= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 h1:ByVauKFXphRlSNG47lNuxZ9aicu+r8AoNp933VRPpCw= github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918/go.mod h1:/yp/sqD8Iz5GU5fcercjrw0ivJF7HDcupYg+Gjr7EPg= github.com/smartcontractkit/chainlink-testing-framework v1.17.12-0.20231016091231-25809996fbd4 h1:yidN70ecUI3Ydweggk9eHyCSLX7N39YDmYt8GoYx2XU= @@ -2372,8 +2372,8 @@ github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88 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= github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f/go.mod h1:MvMXoufZAtqExNexqi4cjrNYE9MefKddKylxjS+//n0= -github.com/smartcontractkit/libocr v0.0.0-20230922131214-122accb19ea6 h1:eSo9r53fARv2MnIO5pqYvQOXMBsTlAwhHyQ6BAVp6bY= -github.com/smartcontractkit/libocr v0.0.0-20230922131214-122accb19ea6/go.mod h1:2lyRkw/qLQgUWlrWWmq5nj0y90rWeO6Y+v+fCakRgb0= +github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8 h1:R9NkVN+1fooUJFsN9zj9gDY1B+zv54zNO785RQZRVfE= +github.com/smartcontractkit/libocr v0.0.0-20230925165524-ffa38fe11ef8/go.mod h1:2lyRkw/qLQgUWlrWWmq5nj0y90rWeO6Y+v+fCakRgb0= github.com/smartcontractkit/ocr2keepers v0.7.27 h1:kwqMrzmEdq6gH4yqNuLQCbdlED0KaIjwZzu3FF+Gves= github.com/smartcontractkit/ocr2keepers v0.7.27/go.mod h1:1QGzJURnoWpysguPowOe2bshV0hNp1YX10HHlhDEsas= github.com/smartcontractkit/ocr2vrf v0.0.0-20230804151440-2f1eb1e20687 h1:NwC3SOc25noBTe1KUQjt45fyTIuInhoE2UfgcHAdihM= @@ -2613,16 +2613,16 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0 h1:ZOLJc06r4CB42laIXg/7udr0pbZyuAihN10A/XuiQRY= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.0/go.mod h1:5z+/ZWJQKXa9YT34fQNx5K8Hd1EoIhvtUygUQPqEOgQ= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0 h1:RsQi0qJ2imFfCvZabqzM9cNXBG8k6gXMv1A0cXRmH6A= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.45.0/go.mod h1:vsh3ySueQCiKPxFLvjWC4Z135gIa34TQ/NSqkDTZYUM= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 h1:pginetY7+onl4qN1vl0xW/V/v6OBZ0vVdH+esuJgvmM= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0/go.mod h1:XiYsayHc36K3EByOO6nbAXnAWbrUxdjUROCEeeROOH8= go.opentelemetry.io/otel v1.19.0 h1:MuS/TNf4/j4IXsZuJegVzI1cwut7Qc00344rgH7p8bs= go.opentelemetry.io/otel v1.19.0/go.mod h1:i0QyjOq3UPoTzff0PJB2N66fb4S0+rSbSB15/oyH9fY= go.opentelemetry.io/otel/metric v1.19.0 h1:aTzpGtV0ar9wlV4Sna9sdJyII5jTVJEvKETPiOKwvpE= go.opentelemetry.io/otel/metric v1.19.0/go.mod h1:L5rUsV9kM1IxCj1MmSdS+JQAcVm319EUrDVLrt7jqt8= -go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= -go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= +go.opentelemetry.io/otel/sdk v1.19.0 h1:6USY6zH+L8uMH8L3t1enZPR3WFEmSTADlqldyHtJi3o= +go.opentelemetry.io/otel/sdk v1.19.0/go.mod h1:NedEbbS4w3C6zElbLdPJKOpJQOrGUJ+GfzpjUvI0v1A= go.opentelemetry.io/otel/trace v1.19.0 h1:DFVQmlVbfVeOuBRrwdtaehRrWiL1JoVs9CPIQ1Dzxpg= go.opentelemetry.io/otel/trace v1.19.0/go.mod h1:mfaSyvGyEJEI0nyV2I4qhNQnbBOUUmYZpYojqMnX2vo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= @@ -3434,8 +3434,8 @@ google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsA google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= -google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= +google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= +google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/grpc/examples v0.0.0-20210424002626-9572fd6faeae/go.mod h1:Ly7ZA/ARzg8fnPU9TyZIxoz33sEUuWX7txiqs8lPTgE= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= diff --git a/plugins/cmd/chainlink-solana/main.go b/plugins/cmd/chainlink-solana/main.go index ec30fa59f41..8640c04bd2f 100644 --- a/plugins/cmd/chainlink-solana/main.go +++ b/plugins/cmd/chainlink-solana/main.go @@ -11,7 +11,7 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/loop" pkgsol "github.com/smartcontractkit/chainlink-solana/pkg/solana" - "github.com/smartcontractkit/chainlink/v2/core/chains/solana" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" "github.com/smartcontractkit/chainlink/v2/core/services/relay" "github.com/smartcontractkit/chainlink/v2/plugins" )