Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Solana Relayer implements checkable #464

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ nodejs 14.19.1
yarn 1.22.19
rust 1.59.0
golang 1.19.3
golangci-lint 1.45.2
golangci-lint 1.51.1
pulumi 3.40.1
ginkgo 2.5.1
actionlint 1.6.22
Expand Down
7 changes: 3 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/smartcontractkit/chainlink-solana

go 1.18
go 1.19

require (
github.com/davecgh/go-spew v1.1.1
Expand All @@ -10,7 +10,7 @@ require (
github.com/gagliardetto/treeout v0.1.4
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.12.1
github.com/smartcontractkit/chainlink-relay v0.1.6-0.20230118141007-0773f68325cd
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230220202756-c2609b4f5b00
github.com/smartcontractkit/libocr v0.0.0-20221121171434-482da3ed36d8
github.com/stretchr/testify v1.7.5
go.uber.org/multierr v1.8.0
Expand All @@ -34,9 +34,9 @@ require (
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/linkedin/goavro/v2 v2.12.0 // indirect
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
github.com/magiconair/properties v1.8.5 // indirect
Expand Down Expand Up @@ -69,7 +69,6 @@ require (
golang.org/x/sys v0.0.0-20220209214540-3681064d5158 // indirect
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
google.golang.org/protobuf v1.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

Expand Down
8 changes: 3 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3Ee
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down Expand Up @@ -225,6 +224,7 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
Expand All @@ -250,7 +250,6 @@ github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/linkedin/goavro/v2 v2.9.7/go.mod h1:UgQUb2N/pmueQYH9bfqFioWxzYCZXSfF8Jw03O5sjqA=
github.com/linkedin/goavro/v2 v2.12.0 h1:rIQQSj8jdAUlKQh6DttK8wCRv4t4QO09g1C4aBWXslg=
github.com/linkedin/goavro/v2 v2.12.0/go.mod h1:KXx+erlq+RPlGSPmLF7xGo6SAbh8sCQ53x064+ioxhk=
Expand Down Expand Up @@ -362,8 +361,8 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/smartcontractkit/chainlink-relay v0.1.6-0.20230118141007-0773f68325cd h1:f7QkXFVgYyjcGTKRbtBc14azb9kBxbXnZ4qAMcOgAns=
github.com/smartcontractkit/chainlink-relay v0.1.6-0.20230118141007-0773f68325cd/go.mod h1:5k0uC8R2ILaP/hs81M1ySmyHWtrRz0Bvx9dEVJjdu8o=
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230220202756-c2609b4f5b00 h1:OeLq8+OCkINrRVBb9A0R5D8GUQGfK09qPiUmqBzvIzw=
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230220202756-c2609b4f5b00/go.mod h1:P7bBrDPwh5DltlVxiharH19uCbNwxVPHPeX3Z25Eol0=
github.com/smartcontractkit/libocr v0.0.0-20221121171434-482da3ed36d8 h1:KcTNxuP5g3GGUqn3WJe7KKnTixqfVZjmHnMAnKkLGJw=
github.com/smartcontractkit/libocr v0.0.0-20221121171434-482da3ed36d8/go.mod h1:5JnCHuYgmIP9ZyXzgAfI5Iwu0WxBtBKp+ApeT5o1Cjw=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
Expand Down Expand Up @@ -762,7 +761,6 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
gopkg.in/guregu/null.v4 v4.0.0 h1:1Wm3S1WEA2I26Kq+6vcW+w0gcDo44YKYD7YIEJNHDjg=
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ require (
github.com/shopspring/decimal v1.3.1 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/slack-go/slack v0.11.4 // indirect
github.com/smartcontractkit/chainlink-relay v0.1.6-0.20230118141007-0773f68325cd // indirect
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230220202756-c2609b4f5b00 // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.0-20220930034704-572ac07611cb // indirect
github.com/smartcontractkit/ocr2keepers v0.4.8 // indirect
github.com/smartcontractkit/ocr2vrf v0.0.0-20221206151523-7ae0ec615c0e // indirect
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1607,8 +1607,8 @@ github.com/smartcontractkit/chainlink v1.10.0 h1:a2ddZ/YM5KCzdiL3XJRAnp2nbLNmdj+
github.com/smartcontractkit/chainlink v1.10.0/go.mod h1:/JCBDA+vIalybAvhy8V0OcD1Hpr1uWUeXMT97df7iT4=
github.com/smartcontractkit/chainlink-env v0.3.8 h1:GMj0Tz0qMjUuzNlhvVtOT4FjUymRVqMFagC1CfKxyCo=
github.com/smartcontractkit/chainlink-env v0.3.8/go.mod h1:zspYFdXS57CzKkpcLkFEPuMQHOmI3L9H5idoPxobxRM=
github.com/smartcontractkit/chainlink-relay v0.1.6-0.20230118141007-0773f68325cd h1:f7QkXFVgYyjcGTKRbtBc14azb9kBxbXnZ4qAMcOgAns=
github.com/smartcontractkit/chainlink-relay v0.1.6-0.20230118141007-0773f68325cd/go.mod h1:5k0uC8R2ILaP/hs81M1ySmyHWtrRz0Bvx9dEVJjdu8o=
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230220202756-c2609b4f5b00 h1:OeLq8+OCkINrRVBb9A0R5D8GUQGfK09qPiUmqBzvIzw=
github.com/smartcontractkit/chainlink-relay v0.1.7-0.20230220202756-c2609b4f5b00/go.mod h1:P7bBrDPwh5DltlVxiharH19uCbNwxVPHPeX3Z25Eol0=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.0-20220930034704-572ac07611cb h1:oRKhJVdoXTVQqBVSPkvfC/hxYoxsL3hldTavEuZrWOk=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.0-20220930034704-572ac07611cb/go.mod h1:FR8+xi6pmUuK6/PaH64B+OT5n/QOz7ox9pp9z05Dc2g=
github.com/smartcontractkit/chainlink-terra v0.1.4-0.20220930034731-ef9eb53de886 h1:VVB/jdEBD9O01uOPvONEWeUVJr2/crLjVVCfTl1fOLM=
Expand Down
29 changes: 28 additions & 1 deletion pkg/solana/relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/gagliardetto/solana-go"
"github.com/pkg/errors"

relaylogger "github.com/smartcontractkit/chainlink-relay/pkg/logger"
relaytypes "github.com/smartcontractkit/chainlink-relay/pkg/types"
"github.com/smartcontractkit/chainlink-relay/pkg/utils"
"github.com/smartcontractkit/libocr/offchainreporting2/reportingplugin/median"
Expand Down Expand Up @@ -40,6 +41,10 @@ func NewRelayer(lggr logger.Logger, chainSet ChainSet) *Relayer {
}
}

func (r *Relayer) Name() string {
return r.lggr.Name()
}

// Start starts the relayer respecting the given context.
func (r *Relayer) Start(context.Context) error {
// No subservices started on relay start, but when the first job is started
Expand All @@ -64,6 +69,14 @@ func (r *Relayer) Healthy() error {
return r.chainSet.Healthy()
}

func (r *Relayer) HealthReport() map[string]error {
return map[string]error{r.Name(): r.Healthy()}
}

func (r *Relayer) NewMercuryProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.MercuryProvider, error) {
return nil, errors.New("mercury is not supported for starknet")
}

func (r *Relayer) NewConfigProvider(args relaytypes.RelayArgs) (relaytypes.ConfigProvider, error) {
configWatcher, err := newConfigProvider(r.ctx, r.lggr, r.chainSet, args)
if err != nil {
Expand All @@ -74,7 +87,8 @@ func (r *Relayer) NewConfigProvider(args relaytypes.RelayArgs) (relaytypes.Confi
}

func (r *Relayer) NewMedianProvider(rargs relaytypes.RelayArgs, pargs relaytypes.PluginArgs) (relaytypes.MedianProvider, error) {
configWatcher, err := newConfigProvider(r.ctx, r.lggr, r.chainSet, rargs)
lggr := relaylogger.Named(r.lggr, "MedianProvider")
configWatcher, err := newConfigProvider(r.ctx, lggr, r.chainSet, rargs)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -134,6 +148,7 @@ type configProvider struct {
}

func newConfigProvider(ctx context.Context, lggr logger.Logger, chainSet ChainSet, args relaytypes.RelayArgs) (*configProvider, error) {
lggr = relaylogger.Named(lggr, "ConfigProvider")
var relayConfig RelayConfig
err := json.Unmarshal(args.RelayConfig, &relayConfig)
if err != nil {
Expand Down Expand Up @@ -177,6 +192,10 @@ func newConfigProvider(ctx context.Context, lggr logger.Logger, chainSet ChainSe
}, nil
}

func (c *configProvider) Name() string {
return c.stateCache.lggr.Name()
}

func (c *configProvider) Start(ctx context.Context) error {
return c.StartOnce("SolanaConfigProvider", func() error {
return c.stateCache.Start()
Expand All @@ -189,6 +208,10 @@ func (c *configProvider) Close() error {
})
}

func (c *configProvider) HealthReport() map[string]error {
return map[string]error{c.Name(): c.Healthy()}
}

func (c *configProvider) OffchainConfigDigester() types.OffchainConfigDigester {
return c.offchainConfigDigester
}
Expand All @@ -207,6 +230,10 @@ type medianProvider struct {
transmitter types.ContractTransmitter
}

func (m *medianProvider) Name() string {
return m.stateCache.lggr.Name()
}

// start both cache services
func (p *medianProvider) Start(ctx context.Context) error {
return p.StartOnce("SolanaMedianProvider", func() error {
Expand Down