From afdcdd75070dedd0ce1c615bbe2ff6e5731969db Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Fri, 17 Jan 2025 16:41:37 -0600 Subject: [PATCH] relayer/pkg/chainlink/chain: update HealthReport (#583) --- integration-tests/go.mod | 8 ++++---- integration-tests/go.sum | 12 ++++++------ relayer/pkg/chainlink/chain/chain.go | 24 ++++++------------------ 3 files changed, 16 insertions(+), 28 deletions(-) diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 53471bfe1..d3942f993 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -13,12 +13,12 @@ require ( github.com/rs/zerolog v1.33.0 github.com/smartcontractkit/chainlink-common v0.4.2-0.20250116214855-f49c5c27db51 github.com/smartcontractkit/chainlink-starknet/ops v0.0.0-20231205180940-ea2e3e916725 - github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20250116220926-2bc922c6ae8c + github.com/smartcontractkit/chainlink-starknet/relayer v0.1.1-0.20250117171710-b6481e9fcb34 github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.19 github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.9 - github.com/smartcontractkit/chainlink/deployment v0.0.0-20250117154253-e07c2dde5472 - github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20250117154253-e07c2dde5472 - github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20250117154253-e07c2dde5472 + github.com/smartcontractkit/chainlink/deployment v0.0.0-20250117185825-874daef670f3 + github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20250117185825-874daef670f3 + github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20250117185825-874daef670f3 github.com/stretchr/testify v1.10.0 github.com/testcontainers/testcontainers-go v0.34.0 go.uber.org/zap v1.27.0 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 4a6640a82..25fed2820 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -1230,12 +1230,12 @@ github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.19 h1:9PMwKNqF github.com/smartcontractkit/chainlink-testing-framework/lib v1.50.19/go.mod h1:ag7LEgejsVtPXaUNkcoFPpAoDkl1J8V2HSbqVUxfEtk= github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.9 h1:yB1x5UXvpZNka+5h57yo1/GrKfXKCqMzChCISpldZx4= github.com/smartcontractkit/chainlink-testing-framework/seth v1.50.9/go.mod h1:lJk0atEJ5Zyo3Tqrmf1Pl9jUEe79EgDb9bD3K5OTUBI= -github.com/smartcontractkit/chainlink/deployment v0.0.0-20250117154253-e07c2dde5472 h1:GuApsiVlcpsOPJLIoItMy5uovIBHxDWDTUml/wMoaB8= -github.com/smartcontractkit/chainlink/deployment v0.0.0-20250117154253-e07c2dde5472/go.mod h1:Lw9j3HneIfBviMDU+IwxRVyq0CEWHHV/cWYW1xGn4m8= -github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20250117154253-e07c2dde5472 h1:P14MHlEnRg3BSHkWNosLiTk8OCJKnfUq25MhKUvNv/4= -github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20250117154253-e07c2dde5472/go.mod h1:2Vp2SsRDWeM8oWqXb2mCBEmYzg+flLrLfELPOQtytvU= -github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20250117154253-e07c2dde5472 h1:MqEAi+yZGcWJNYquXiqIqnZGVBxe7YeWvryTx76rdD4= -github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20250117154253-e07c2dde5472/go.mod h1:0Ab+tfrirz9qo+UUzpFGyv4lYzuOnEznYJdmSWtlztQ= +github.com/smartcontractkit/chainlink/deployment v0.0.0-20250117185825-874daef670f3 h1:IKQZexGZMzDZJKbLiXYE08QE2+D0F0pYYQmf6IcQq8c= +github.com/smartcontractkit/chainlink/deployment v0.0.0-20250117185825-874daef670f3/go.mod h1:ajblD8urWe7x8zO2KXD6InnL0gPyF5ld5XopApRPw+w= +github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20250117185825-874daef670f3 h1:7VS+ihlcrbPT9UEgJf1aDc4gDa/1vM8SZ5p3YoXWbbc= +github.com/smartcontractkit/chainlink/integration-tests v0.0.0-20250117185825-874daef670f3/go.mod h1:TbUgsGfMHh0OJS63xp7QwBMyBTC40PN+Cdpqe2EhYqY= +github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20250117185825-874daef670f3 h1:YzOPX2Hkhxm7RTFF8WiyB4wpRkg29fCR39p19381CsM= +github.com/smartcontractkit/chainlink/v2 v2.14.0-mercury-20240807.0.20250117185825-874daef670f3/go.mod h1:vbQiTuRExBNxBvtm90pvIwe1cNim/29FaPNmfm5Ar0o= github.com/smartcontractkit/gauntlet-plus-plus/sdks/go-gauntlet v1.1.3 h1:RIApVijvhHI6iW9pyT35Nk39rPGEC4TwVe/f+YA1G5k= github.com/smartcontractkit/gauntlet-plus-plus/sdks/go-gauntlet v1.1.3/go.mod h1:oiUkQxoi0kZzbW125oIt4lr/pqaRSDol1rWHLCyqmNQ= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= diff --git a/relayer/pkg/chainlink/chain/chain.go b/relayer/pkg/chainlink/chain/chain.go index 3e180082f..b66d6e62c 100644 --- a/relayer/pkg/chainlink/chain/chain.go +++ b/relayer/pkg/chainlink/chain/chain.go @@ -15,7 +15,6 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/loop" "github.com/smartcontractkit/chainlink-common/pkg/services" "github.com/smartcontractkit/chainlink-common/pkg/types" - "github.com/smartcontractkit/chainlink-common/pkg/utils" "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/db" @@ -59,7 +58,7 @@ func (o *ChainOpts) Validate() (err error) { var _ Chain = (*chain)(nil) type chain struct { - utils.StartStopOnce + services.StateMachine id string cfg *config.TOMLConfig lggr logger.Logger @@ -78,23 +77,16 @@ func NewChain(cfg *config.TOMLConfig, opts ChainOpts) (Chain, error) { } func newChain(id string, cfg *config.TOMLConfig, loopKs loop.Keystore, lggr logger.Logger) (*chain, error) { + lggr = logger.Named(lggr, "Chain") lggr = logger.With(lggr, "starknetChainID", id) ch := &chain{ id: id, cfg: cfg, - lggr: logger.Named(lggr, "Chain"), - } - - getClient := func() (*starknet.Client, error) { - return ch.getClient() - } - - getFeederClient := func() (*starknet.FeederClient, error) { - return ch.getFeederClient(), nil + lggr: lggr, } var err error - ch.txm, err = txm.New(lggr, loopKs, cfg, getClient, getFeederClient) + ch.txm, err = txm.New(lggr, loopKs, cfg, ch.getClient, ch.getFeederClient) if err != nil { return nil, err } @@ -122,8 +114,8 @@ func (c *chain) ChainID() string { return c.id } -func (c *chain) getFeederClient() *starknet.FeederClient { - return starknet.NewFeederClient(c.cfg.FeederURL.String()) +func (c *chain) getFeederClient() (*starknet.FeederClient, error) { + return starknet.NewFeederClient(c.cfg.FeederURL.String()), nil } // getClient returns a client, randomly selecting one from available and valid nodes @@ -172,10 +164,6 @@ func (c *chain) Close() error { }) } -func (c *chain) Ready() error { - return c.StartStopOnce.Ready() -} - func (c *chain) HealthReport() map[string]error { report := map[string]error{c.Name(): c.Healthy()} services.CopyHealth(report, c.txm.HealthReport())