From a5e734c71067102b9083f9823e2de63a1aa962b5 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Mon, 23 Oct 2023 18:23:06 -0500 Subject: [PATCH] rm chains/starknet (#10994) --- core/chains/starknet/chain.go | 217 ------------------ core/chains/starknet/config.go | 213 ----------------- core/cmd/shell.go | 4 +- core/cmd/shell_test.go | 15 +- core/cmd/starknet_node_commands_test.go | 7 +- core/config/docs/docs_test.go | 5 +- core/internal/cltest/cltest.go | 4 +- core/scripts/go.mod | 2 +- core/scripts/go.sum | 4 +- core/services/chainlink/config.go | 14 +- core/services/chainlink/config_general.go | 5 +- core/services/chainlink/config_test.go | 7 +- .../chainlink/mocks/general_config.go | 14 +- .../chainlink/relayer_chain_interoperators.go | 2 +- .../relayer_chain_interoperators_test.go | 15 +- core/services/chainlink/relayer_factory.go | 16 +- core/services/chainlink/types.go | 5 +- go.mod | 2 +- go.sum | 4 +- integration-tests/go.mod | 2 +- integration-tests/go.sum | 4 +- plugins/cmd/chainlink-starknet/main.go | 10 +- 22 files changed, 70 insertions(+), 501 deletions(-) delete mode 100644 core/chains/starknet/chain.go delete mode 100644 core/chains/starknet/config.go diff --git a/core/chains/starknet/chain.go b/core/chains/starknet/chain.go deleted file mode 100644 index 37908981370..00000000000 --- a/core/chains/starknet/chain.go +++ /dev/null @@ -1,217 +0,0 @@ -package starknet - -import ( - "context" - "fmt" - "math/big" - "math/rand" - - "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" - "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" - "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/db" - "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/txm" - "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/starknet" - - "github.com/smartcontractkit/chainlink/v2/core/chains" - "github.com/smartcontractkit/chainlink/v2/core/utils" -) - -type ChainOpts struct { - Logger logger.Logger - // the implementation used here needs to be co-ordinated with the starknet transaction manager keystore adapter - KeyStore loop.Keystore -} - -func (o *ChainOpts) Name() string { - return o.Logger.Name() -} - -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 -} - -var _ starkChain.Chain = (*chain)(nil) - -type chain struct { - utils.StartStopOnce - id string - cfg *StarknetConfig - lggr logger.Logger - txm txm.StarkTXM -} - -func NewChain(cfg *StarknetConfig, opts ChainOpts) (starkchain.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 -} - -func newChain(id string, cfg *StarknetConfig, loopKs loop.Keystore, lggr logger.Logger) (*chain, error) { - 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() - } - - var err error - ch.txm, err = txm.New(lggr, loopKs, cfg, getClient) - if err != nil { - return nil, err - } - - return ch, nil -} - -func (c *chain) Name() string { - return c.lggr.Name() -} - -func (c *chain) Config() config.Config { - return c.cfg -} - -func (c *chain) TxManager() txm.TxManager { - return c.txm -} - -func (c *chain) Reader() (starknet.Reader, error) { - return c.getClient() -} - -func (c *chain) ChainID() string { - return c.id -} - -// getClient returns a client, randomly selecting one from available and valid nodes -func (c *chain) getClient() (*starknet.Client, error) { - var node db.Node - var client *starknet.Client - 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 - timeout := c.cfg.RequestTimeout() - for _, i := range index { - node = nodes[i] - // create client and check - client, err = starknet.NewClient(node.ChainID, node.URL, c.lggr, &timeout) - // if error, try another node - if err != nil { - c.lggr.Warnw("failed to create node", "name", node.Name, "starknet-url", node.URL, "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, "starknet-url", node.URL) - return client, nil -} - -func (c *chain) Start(ctx context.Context) error { - return c.StartOnce("Chain", func() error { - return c.txm.Start(ctx) - }) -} - -func (c *chain) Close() error { - return c.StopOnce("Chain", func() error { - return c.txm.Close() - }) -} - -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()) - return report -} - -func (c *chain) ID() string { - return c.id -} - -// 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 relaychains.ListNodeStatuses(int(pageSize), pageToken, c.listNodeStatuses) -} - -func (c *chain) Transact(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error { - return chains.ErrLOOPPUnsupported -} - -func (c *chain) SendTx(ctx context.Context, from, to string, amount *big.Int, balanceCheck bool) error { - return c.Transact(ctx, from, to, amount, balanceCheck) -} - -// TODO BCF-2602 statuses are static for non-evm chain and should be dynamic -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, relaychains.ErrOutOfRange - } - if end <= 0 || 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 -} diff --git a/core/chains/starknet/config.go b/core/chains/starknet/config.go deleted file mode 100644 index f659cb7af15..00000000000 --- a/core/chains/starknet/config.go +++ /dev/null @@ -1,213 +0,0 @@ -package starknet - -import ( - "fmt" - "net/url" - "slices" - "time" - - "github.com/pelletier/go-toml/v2" - "go.uber.org/multierr" - - "github.com/smartcontractkit/chainlink-relay/pkg/types" - - stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" - "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/db" - - "github.com/smartcontractkit/chainlink/v2/core/services/relay" - "github.com/smartcontractkit/chainlink/v2/core/utils/config" -) - -type StarknetConfigs []*StarknetConfig - -func (cs StarknetConfigs) ValidateConfig() (err error) { - return cs.validateKeys() -} - -func (cs StarknetConfigs) 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 *StarknetConfigs) SetFrom(fs *StarknetConfigs) (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 *StarknetConfig) bool { - return c.ChainID != nil && *c.ChainID == *f.ChainID - }); i == -1 { - *cs = append(*cs, f) - } else { - (*cs)[i].SetFrom(f) - } - } - return -} - -func nodeStatus(n *stkcfg.Node, id relay.ChainID) (types.NodeStatus, error) { - var s types.NodeStatus - s.ChainID = id - s.Name = *n.Name - b, err := toml.Marshal(n) - if err != nil { - return types.NodeStatus{}, err - } - s.Config = string(b) - return s, nil -} - -type StarknetConfig struct { - ChainID *string - // Do not access directly. Use [IsEnabled] - Enabled *bool - stkcfg.Chain - Nodes StarknetNodes -} - -func (c *StarknetConfig) IsEnabled() bool { - return c.Enabled == nil || *c.Enabled -} - -func (c *StarknetConfig) SetFrom(f *StarknetConfig) { - 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 *stkcfg.Chain) { - if f.OCR2CachePollPeriod != nil { - c.OCR2CachePollPeriod = f.OCR2CachePollPeriod - } - if f.OCR2CacheTTL != nil { - c.OCR2CacheTTL = f.OCR2CacheTTL - } - if f.RequestTimeout != nil { - c.RequestTimeout = f.RequestTimeout - } - if f.TxTimeout != nil { - c.TxTimeout = f.TxTimeout - } - if f.ConfirmationPoll != nil { - c.ConfirmationPoll = f.ConfirmationPoll - } -} - -func (c *StarknetConfig) 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 *StarknetConfig) TOMLString() (string, error) { - b, err := toml.Marshal(c) - if err != nil { - return "", err - } - return string(b), nil -} - -type StarknetNodes []*stkcfg.Node - -func (ns *StarknetNodes) SetFrom(fs *StarknetNodes) { - for _, f := range *fs { - if f.Name == nil { - *ns = append(*ns, f) - } else if i := slices.IndexFunc(*ns, func(n *stkcfg.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 *stkcfg.Node) { - if f.Name != nil { - n.Name = f.Name - } - if f.URL != nil { - n.URL = f.URL - } -} - -func legacyNode(n *stkcfg.Node, id relay.ChainID) db.Node { - return db.Node{ - Name: *n.Name, - ChainID: id, - URL: (*url.URL)(n.URL).String(), - } -} - -var _ stkcfg.Config = &StarknetConfig{} - -func (c *StarknetConfig) TxTimeout() time.Duration { - return c.Chain.TxTimeout.Duration() -} - -func (c *StarknetConfig) ConfirmationPoll() time.Duration { - return c.Chain.ConfirmationPoll.Duration() -} - -func (c *StarknetConfig) OCR2CachePollPeriod() time.Duration { - return c.Chain.OCR2CachePollPeriod.Duration() -} - -func (c *StarknetConfig) OCR2CacheTTL() time.Duration { - return c.Chain.OCR2CacheTTL.Duration() -} - -func (c *StarknetConfig) RequestTimeout() time.Duration { - return c.Chain.RequestTimeout.Duration() -} - -func (c *StarknetConfig) ListNodes() ([]db.Node, error) { - var allNodes []db.Node - for _, n := range c.Nodes { - allNodes = append(allNodes, legacyNode(n, *c.ChainID)) - } - return allNodes, nil -} diff --git a/core/cmd/shell.go b/core/cmd/shell.go index e6a068805c6..fbbce4becbc 100644 --- a/core/cmd/shell.go +++ b/core/cmd/shell.go @@ -188,8 +188,8 @@ func (n ChainlinkAppFactory) NewApplication(ctx context.Context, cfg chainlink.G } if cfg.StarkNetEnabled() { starkCfg := chainlink.StarkNetFactoryConfig{ - Keystore: keyStore.StarkNet(), - StarknetConfigs: cfg.StarknetConfigs(), + Keystore: keyStore.StarkNet(), + TOMLConfigs: cfg.StarknetConfigs(), } initOps = append(initOps, chainlink.InitStarknet(ctx, relayerFactory, starkCfg)) diff --git a/core/cmd/shell_test.go b/core/cmd/shell_test.go index d2fb0738fdf..74768a21928 100644 --- a/core/cmd/shell_test.go +++ b/core/cmd/shell_test.go @@ -16,7 +16,6 @@ import ( 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/starknet" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" @@ -437,20 +436,20 @@ func TestSetupStarkNetRelayer(t *testing.T) { // config 3 chains but only enable 2 => should only be 2 relayer nEnabledChains := 2 tConfig := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.Starknet = starknet.StarknetConfigs{ - &starknet.StarknetConfig{ + c.Starknet = stkcfg.TOMLConfigs{ + &stkcfg.TOMLConfig{ ChainID: ptr[string]("starknet-id-1"), Enabled: ptr(true), Chain: stkcfg.Chain{}, Nodes: []*config.Node{}, }, - &starknet.StarknetConfig{ + &stkcfg.TOMLConfig{ ChainID: ptr[string]("starknet-id-2"), Enabled: ptr(true), Chain: stkcfg.Chain{}, Nodes: []*config.Node{}, }, - &starknet.StarknetConfig{ + &stkcfg.TOMLConfig{ ChainID: ptr[string]("disabled-starknet-id-1"), Enabled: ptr(false), Chain: stkcfg.Chain{}, @@ -486,14 +485,14 @@ func TestSetupStarkNetRelayer(t *testing.T) { // test that duplicate enabled chains is an error when duplicateConfig := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) { - c.Starknet = starknet.StarknetConfigs{ - &starknet.StarknetConfig{ + c.Starknet = stkcfg.TOMLConfigs{ + &stkcfg.TOMLConfig{ ChainID: ptr[string]("dupe"), Enabled: ptr(true), Chain: stkcfg.Chain{}, Nodes: []*config.Node{}, }, - &starknet.StarknetConfig{ + &stkcfg.TOMLConfig{ ChainID: ptr[string]("dupe"), Enabled: ptr(true), Chain: stkcfg.Chain{}, diff --git a/core/cmd/starknet_node_commands_test.go b/core/cmd/starknet_node_commands_test.go index 7df7af429b5..e799e5aac07 100644 --- a/core/cmd/starknet_node_commands_test.go +++ b/core/cmd/starknet_node_commands_test.go @@ -12,13 +12,12 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/utils" "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" - "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" "github.com/smartcontractkit/chainlink/v2/core/cmd" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" ) -func starknetStartNewApplication(t *testing.T, cfgs ...*starknet.StarknetConfig) *cltest.TestApplication { +func starknetStartNewApplication(t *testing.T, cfgs ...*config.TOMLConfig) *cltest.TestApplication { for i := range cfgs { cfgs[i].SetDefaults() } @@ -41,9 +40,9 @@ func TestShell_IndexStarkNetNodes(t *testing.T) { Name: ptr("second"), URL: utils.MustParseURL("https://starknet2.example"), } - chain := starknet.StarknetConfig{ + chain := config.TOMLConfig{ ChainID: &id, - Nodes: starknet.StarknetNodes{&node1, &node2}, + Nodes: config.Nodes{&node1, &node2}, } app := starknetStartNewApplication(t, &chain) client, r := app.NewShellAndRenderer() diff --git a/core/config/docs/docs_test.go b/core/config/docs/docs_test.go index b5e83a322c3..276d0239941 100644 --- a/core/config/docs/docs_test.go +++ b/core/config/docs/docs_test.go @@ -11,10 +11,11 @@ import ( "github.com/stretchr/testify/require" "github.com/smartcontractkit/chainlink-solana/pkg/solana" + stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" + "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/starknet" "github.com/smartcontractkit/chainlink/v2/core/config/docs" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink" "github.com/smartcontractkit/chainlink/v2/core/services/chainlink/cfgtest" @@ -105,7 +106,7 @@ func TestDoc(t *testing.T) { }) t.Run("Starknet", func(t *testing.T) { - var fallbackDefaults starknet.StarknetConfig + var fallbackDefaults stkcfg.TOMLConfig fallbackDefaults.SetDefaults() assertTOML(t, fallbackDefaults.Chain, defaults.Starknet[0].Chain) diff --git a/core/internal/cltest/cltest.go b/core/internal/cltest/cltest.go index 503bcfed8db..93c562f5a0f 100644 --- a/core/internal/cltest/cltest.go +++ b/core/internal/cltest/cltest.go @@ -436,8 +436,8 @@ func NewApplicationWithConfig(t testing.TB, cfg chainlink.GeneralConfig, flagsAn } if cfg.StarkNetEnabled() { starkCfg := chainlink.StarkNetFactoryConfig{ - Keystore: keyStore.StarkNet(), - StarknetConfigs: cfg.StarknetConfigs(), + Keystore: keyStore.StarkNet(), + TOMLConfigs: cfg.StarknetConfigs(), } initOps = append(initOps, chainlink.InitStarknet(testCtx, relayerFactory, starkCfg)) diff --git a/core/scripts/go.mod b/core/scripts/go.mod index 9d23ad94191..bdd85660c8b 100644 --- a/core/scripts/go.mod +++ b/core/scripts/go.mod @@ -304,7 +304,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc47 // indirect github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231020230319-2ede955d1dc9 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231023224324-9be0aa99cc92 // 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 github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/core/scripts/go.sum b/core/scripts/go.sum index b1871711af8..9bfd7d56f62 100644 --- a/core/scripts/go.sum +++ b/core/scripts/go.sum @@ -1462,8 +1462,8 @@ github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231020230319-2ede955d1dc9 github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231020230319-2ede955d1dc9/go.mod h1:M9U1JV7IQi8Sfj4JR1qSi1tIh6omgW78W/8SHN/8BUQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 h1:DaPSVnxe7oz1QJ+AVIhQWs1W3ubQvwvGo9NbHpMs1OQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05/go.mod h1:o0Pn1pbaUluboaK6/yhf8xf7TiFCkyFl6WUOdwqamuU= -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-starknet/relayer v0.0.1-beta-test.0.20231023224324-9be0aa99cc92 h1:WJHoy1d8idGv5rPwY1F46D+gFT9rH4q+aCyDV64Xgqo= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231023224324-9be0aa99cc92/go.mod h1:/30flFG4L/iCYAFeA3DUzR0xuHSxAMONiWTzyzvsNwo= 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= diff --git a/core/services/chainlink/config.go b/core/services/chainlink/config.go index 40339581f4f..62be789f859 100644 --- a/core/services/chainlink/config.go +++ b/core/services/chainlink/config.go @@ -8,17 +8,17 @@ import ( gotoml "github.com/pelletier/go-toml/v2" - "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" - "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" - "github.com/smartcontractkit/chainlink/v2/core/utils" - "github.com/smartcontractkit/chainlink/v2/core/utils/config" - "github.com/smartcontractkit/chainlink-solana/pkg/solana" + stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" + + "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/config/docs" "github.com/smartcontractkit/chainlink/v2/core/config/env" "github.com/smartcontractkit/chainlink/v2/core/config/toml" "github.com/smartcontractkit/chainlink/v2/core/store/models" + "github.com/smartcontractkit/chainlink/v2/core/utils" + "github.com/smartcontractkit/chainlink/v2/core/utils/config" ) // Config is the root type used for TOML configuration. @@ -40,7 +40,7 @@ type Config struct { Solana solana.TOMLConfigs `toml:",omitempty"` - Starknet starknet.StarknetConfigs `toml:",omitempty"` + Starknet stkcfg.TOMLConfigs `toml:",omitempty"` } // TOMLString returns a TOML encoded string. @@ -89,7 +89,7 @@ func (c *Config) setDefaults() { for i := range c.Starknet { if c.Starknet[i] == nil { - c.Starknet[i] = new(starknet.StarknetConfig) + c.Starknet[i] = new(stkcfg.TOMLConfig) } c.Starknet[i].Chain.SetDefaults() } diff --git a/core/services/chainlink/config_general.go b/core/services/chainlink/config_general.go index 50e182e9887..8e3dc100a44 100644 --- a/core/services/chainlink/config_general.go +++ b/core/services/chainlink/config_general.go @@ -16,9 +16,10 @@ import ( ocrnetworking "github.com/smartcontractkit/libocr/networking" "github.com/smartcontractkit/chainlink-solana/pkg/solana" + starknet "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" + "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/starknet" "github.com/smartcontractkit/chainlink/v2/core/config" coreconfig "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/config/env" @@ -201,7 +202,7 @@ func (g *generalConfig) SolanaConfigs() solana.TOMLConfigs { return g.c.Solana } -func (g *generalConfig) StarknetConfigs() starknet.StarknetConfigs { +func (g *generalConfig) StarknetConfigs() starknet.TOMLConfigs { return g.c.Starknet } diff --git a/core/services/chainlink/config_test.go b/core/services/chainlink/config_test.go index 6fecba445a6..d811dd8209d 100644 --- a/core/services/chainlink/config_test.go +++ b/core/services/chainlink/config_test.go @@ -26,7 +26,6 @@ import ( "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/starknet" legacy "github.com/smartcontractkit/chainlink/v2/core/config" "github.com/smartcontractkit/chainlink/v2/core/config/toml" "github.com/smartcontractkit/chainlink/v2/core/logger" @@ -177,7 +176,7 @@ var ( }, }, }, - Starknet: []*starknet.StarknetConfig{ + Starknet: []*stkcfg.TOMLConfig{ { ChainID: ptr("foobar"), Chain: stkcfg.Chain{ @@ -607,7 +606,7 @@ func TestConfig_Marshal(t *testing.T) { }, }, } - full.Starknet = []*starknet.StarknetConfig{ + full.Starknet = []*stkcfg.TOMLConfig{ { ChainID: ptr("foobar"), Enabled: ptr(true), @@ -1411,7 +1410,7 @@ func TestConfig_setDefaults(t *testing.T) { c.EVM = evmcfg.EVMConfigs{{ChainID: utils.NewBigI(99999133712345)}} c.Cosmos = cosmos.CosmosConfigs{{ChainID: ptr("unknown cosmos chain")}} c.Solana = solana.TOMLConfigs{{ChainID: ptr("unknown solana chain")}} - c.Starknet = starknet.StarknetConfigs{{ChainID: ptr("unknown starknet chain")}} + c.Starknet = stkcfg.TOMLConfigs{{ChainID: ptr("unknown starknet chain")}} c.setDefaults() if s, err := c.TOMLString(); assert.NoError(t, err) { t.Log(s, err) diff --git a/core/services/chainlink/mocks/general_config.go b/core/services/chainlink/mocks/general_config.go index d3177d305d4..8098b9634f5 100644 --- a/core/services/chainlink/mocks/general_config.go +++ b/core/services/chainlink/mocks/general_config.go @@ -3,15 +3,15 @@ package mocks import ( - cosmos "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" + chainlinkconfig "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" config "github.com/smartcontractkit/chainlink/v2/core/config" + cosmos "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" + mock "github.com/stretchr/testify/mock" solana "github.com/smartcontractkit/chainlink-solana/pkg/solana" - starknet "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" - time "time" toml "github.com/smartcontractkit/chainlink/v2/core/chains/evm/config/toml" @@ -528,15 +528,15 @@ func (_m *GeneralConfig) StarkNetEnabled() bool { } // StarknetConfigs provides a mock function with given fields: -func (_m *GeneralConfig) StarknetConfigs() starknet.StarknetConfigs { +func (_m *GeneralConfig) StarknetConfigs() chainlinkconfig.TOMLConfigs { ret := _m.Called() - var r0 starknet.StarknetConfigs - if rf, ok := ret.Get(0).(func() starknet.StarknetConfigs); ok { + var r0 chainlinkconfig.TOMLConfigs + if rf, ok := ret.Get(0).(func() chainlinkconfig.TOMLConfigs); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(starknet.StarknetConfigs) + r0 = ret.Get(0).(chainlinkconfig.TOMLConfigs) } } diff --git a/core/services/chainlink/relayer_chain_interoperators.go b/core/services/chainlink/relayer_chain_interoperators.go index 79bb4de5d29..e039afbfc91 100644 --- a/core/services/chainlink/relayer_chain_interoperators.go +++ b/core/services/chainlink/relayer_chain_interoperators.go @@ -161,7 +161,7 @@ func InitSolana(ctx context.Context, factory RelayerFactory, config SolanaFactor // InitStarknet is a option for instantiating Starknet relayers func InitStarknet(ctx context.Context, factory RelayerFactory, config StarkNetFactoryConfig) CoreRelayerChainInitFunc { return func(op *CoreRelayerChainInteroperators) (err error) { - starkRelayers, err := factory.NewStarkNet(config.Keystore, config.StarknetConfigs) + starkRelayers, err := factory.NewStarkNet(config.Keystore, config.TOMLConfigs) if err != nil { return fmt.Errorf("failed to setup StarkNet relayer: %w", err) } diff --git a/core/services/chainlink/relayer_chain_interoperators_test.go b/core/services/chainlink/relayer_chain_interoperators_test.go index 377401f5022..5b17e2e4232 100644 --- a/core/services/chainlink/relayer_chain_interoperators_test.go +++ b/core/services/chainlink/relayer_chain_interoperators_test.go @@ -18,7 +18,6 @@ import ( "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/starknet" "github.com/smartcontractkit/chainlink/v2/core/internal/cltest" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils" "github.com/smartcontractkit/chainlink/v2/core/internal/testutils/pgtest" @@ -100,8 +99,8 @@ func TestCoreRelayerChainInteroperators(t *testing.T) { }, } - c.Starknet = starknet.StarknetConfigs{ - &starknet.StarknetConfig{ + c.Starknet = stkcfg.TOMLConfigs{ + &stkcfg.TOMLConfig{ ChainID: &starknetChainID1, Enabled: ptr(true), Chain: stkcfg.Chain{}, @@ -120,7 +119,7 @@ func TestCoreRelayerChainInteroperators(t *testing.T) { }, }, }, - &starknet.StarknetConfig{ + &stkcfg.TOMLConfig{ ChainID: &starknetChainID2, Enabled: ptr(true), Chain: stkcfg.Chain{}, @@ -243,8 +242,8 @@ func TestCoreRelayerChainInteroperators(t *testing.T) { initFuncs: []chainlink.CoreRelayerChainInitFunc{ chainlink.InitStarknet(testctx, factory, chainlink.StarkNetFactoryConfig{ - Keystore: keyStore.StarkNet(), - StarknetConfigs: cfg.StarknetConfigs()}), + Keystore: keyStore.StarkNet(), + TOMLConfigs: cfg.StarknetConfigs()}), }, expectedStarknetChainCnt: 2, expectedStarknetNodeCnt: 4, @@ -289,8 +288,8 @@ func TestCoreRelayerChainInteroperators(t *testing.T) { CSAETHKeystore: keyStore, }), chainlink.InitStarknet(testctx, factory, chainlink.StarkNetFactoryConfig{ - Keystore: keyStore.StarkNet(), - StarknetConfigs: cfg.StarknetConfigs()}), + Keystore: keyStore.StarkNet(), + TOMLConfigs: cfg.StarknetConfigs()}), chainlink.InitCosmos(testctx, factory, chainlink.CosmosFactoryConfig{ Keystore: keyStore.Cosmos(), CosmosConfigs: cfg.CosmosConfigs(), diff --git a/core/services/chainlink/relayer_factory.go b/core/services/chainlink/relayer_factory.go index ae0863e3b33..31251069df5 100644 --- a/core/services/chainlink/relayer_factory.go +++ b/core/services/chainlink/relayer_factory.go @@ -11,13 +11,13 @@ import ( pkgcosmos "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos" "github.com/smartcontractkit/chainlink-relay/pkg/loop" + "github.com/smartcontractkit/chainlink-solana/pkg/solana" pkgsolana "github.com/smartcontractkit/chainlink-solana/pkg/solana" pkgstarknet "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink" - - "github.com/smartcontractkit/chainlink-solana/pkg/solana" + starkchain "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/chain" + "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" "github.com/smartcontractkit/chainlink/v2/core/chains/cosmos" "github.com/smartcontractkit/chainlink/v2/core/chains/evm" - "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" "github.com/smartcontractkit/chainlink/v2/core/config/env" "github.com/smartcontractkit/chainlink/v2/core/logger" "github.com/smartcontractkit/chainlink/v2/core/services/keystore" @@ -152,12 +152,12 @@ func (r *RelayerFactory) NewSolana(ks keystore.Solana, chainCfgs solana.TOMLConf type StarkNetFactoryConfig struct { Keystore keystore.StarkNet - starknet.StarknetConfigs + config.TOMLConfigs } // TODO BCF-2606 consider consolidating the driving logic with that of NewSolana above via generics // perhaps when we implement a Cosmos LOOP -func (r *RelayerFactory) NewStarkNet(ks keystore.StarkNet, chainCfgs starknet.StarknetConfigs) (map[relay.ID]loop.Relayer, error) { +func (r *RelayerFactory) NewStarkNet(ks keystore.StarkNet, chainCfgs config.TOMLConfigs) (map[relay.ID]loop.Relayer, error) { starknetRelayers := make(map[relay.ID]loop.Relayer) var ( @@ -186,7 +186,7 @@ func (r *RelayerFactory) NewStarkNet(ks keystore.StarkNet, chainCfgs starknet.St if cmdName := env.StarknetPluginCmd.Get(); cmdName != "" { // setup the starknet relayer to be a LOOP cfgTOML, err := toml.Marshal(struct { - Starknet starknet.StarknetConfig + Starknet config.TOMLConfig }{Starknet: *chainCfg}) if err != nil { return nil, fmt.Errorf("failed to marshal StarkNet configs: %w", err) @@ -204,12 +204,12 @@ func (r *RelayerFactory) NewStarkNet(ks keystore.StarkNet, chainCfgs starknet.St starknetRelayers[relayID] = loop.NewRelayerService(lggr, r.GRPCOpts, starknetCmdFn, string(cfgTOML), loopKs) } else { // fallback to embedded chain - opts := starknet.ChainOpts{ + opts := starkchain.ChainOpts{ Logger: lggr, KeyStore: loopKs, } - chain, err := starknet.NewChain(chainCfg, opts) + chain, err := starkchain.NewChain(chainCfg, opts) if err != nil { return nil, err } diff --git a/core/services/chainlink/types.go b/core/services/chainlink/types.go index 88de7d1ec04..1233a179617 100644 --- a/core/services/chainlink/types.go +++ b/core/services/chainlink/types.go @@ -2,9 +2,10 @@ package chainlink import ( "github.com/smartcontractkit/chainlink-solana/pkg/solana" + stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" + "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/starknet" "github.com/smartcontractkit/chainlink/v2/core/config" ) @@ -15,7 +16,7 @@ type GeneralConfig interface { toml.HasEVMConfigs CosmosConfigs() cosmos.CosmosConfigs SolanaConfigs() solana.TOMLConfigs - StarknetConfigs() starknet.StarknetConfigs + StarknetConfigs() stkcfg.TOMLConfigs // ConfigTOML returns both the user provided and effective configuration as TOML. ConfigTOML() (user, effective string) } diff --git a/go.mod b/go.mod index e58e33e99c0..5ec3e45b10a 100644 --- a/go.mod +++ b/go.mod @@ -70,7 +70,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc47 github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231020230319-2ede955d1dc9 github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231023224324-9be0aa99cc92 github.com/smartcontractkit/libocr v0.0.0-20231020123319-d255366a6545 github.com/smartcontractkit/ocr2keepers v0.7.27 github.com/smartcontractkit/ocr2vrf v0.0.0-20230804151440-2f1eb1e20687 diff --git a/go.sum b/go.sum index 6ba65987a27..e822318e94d 100644 --- a/go.sum +++ b/go.sum @@ -1463,8 +1463,8 @@ github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231020230319-2ede955d1dc9 github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231020230319-2ede955d1dc9/go.mod h1:M9U1JV7IQi8Sfj4JR1qSi1tIh6omgW78W/8SHN/8BUQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 h1:DaPSVnxe7oz1QJ+AVIhQWs1W3ubQvwvGo9NbHpMs1OQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05/go.mod h1:o0Pn1pbaUluboaK6/yhf8xf7TiFCkyFl6WUOdwqamuU= -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-starknet/relayer v0.0.1-beta-test.0.20231023224324-9be0aa99cc92 h1:WJHoy1d8idGv5rPwY1F46D+gFT9rH4q+aCyDV64Xgqo= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231023224324-9be0aa99cc92/go.mod h1:/30flFG4L/iCYAFeA3DUzR0xuHSxAMONiWTzyzvsNwo= 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= diff --git a/integration-tests/go.mod b/integration-tests/go.mod index f4845209184..4ce9923b899 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -387,7 +387,7 @@ require ( github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20230913032705-f924d753cc47 // indirect github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231020230319-2ede955d1dc9 // indirect github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 // indirect - github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20230901115736-bbabe542a918 // indirect + github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231023224324-9be0aa99cc92 // 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 github.com/smartcontractkit/wsrpc v0.7.2 // indirect diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 72e7163c4ac..189aed8d232 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -2368,8 +2368,8 @@ github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231020230319-2ede955d1dc9 github.com/smartcontractkit/chainlink-relay v0.1.7-0.20231020230319-2ede955d1dc9/go.mod h1:M9U1JV7IQi8Sfj4JR1qSi1tIh6omgW78W/8SHN/8BUQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05 h1:DaPSVnxe7oz1QJ+AVIhQWs1W3ubQvwvGo9NbHpMs1OQ= github.com/smartcontractkit/chainlink-solana v1.0.3-0.20231023133638-72f4e799ab05/go.mod h1:o0Pn1pbaUluboaK6/yhf8xf7TiFCkyFl6WUOdwqamuU= -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-starknet/relayer v0.0.1-beta-test.0.20231023224324-9be0aa99cc92 h1:WJHoy1d8idGv5rPwY1F46D+gFT9rH4q+aCyDV64Xgqo= +github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20231023224324-9be0aa99cc92/go.mod h1:/30flFG4L/iCYAFeA3DUzR0xuHSxAMONiWTzyzvsNwo= github.com/smartcontractkit/chainlink-testing-framework v1.17.12-0.20231018101901-23824db88d36 h1:ow84QG8vEHMvfjGg0RF8HNYh80WcHci6PIenXyY6K8Y= github.com/smartcontractkit/chainlink-testing-framework v1.17.12-0.20231018101901-23824db88d36/go.mod h1:RWlmjwnjIGbQAnRfKwe02Ife82nNI3rZmdI0zgkfbyk= github.com/smartcontractkit/go-plugin v0.0.0-20231003134350-e49dad63b306 h1:ko88+ZznniNJZbZPWAvHQU8SwKAdHngdDZ+pvVgB5ss= diff --git a/plugins/cmd/chainlink-starknet/main.go b/plugins/cmd/chainlink-starknet/main.go index 5f1569e48cb..ea73858501d 100644 --- a/plugins/cmd/chainlink-starknet/main.go +++ b/plugins/cmd/chainlink-starknet/main.go @@ -10,8 +10,8 @@ import ( "github.com/smartcontractkit/chainlink-relay/pkg/loop" pkgstarknet "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink" - - "github.com/smartcontractkit/chainlink/v2/core/chains/starknet" + starkchain "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/chain" + stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config" ) const ( @@ -58,18 +58,18 @@ func (c *pluginRelayer) NewRelayer(ctx context.Context, config string, loopKs lo d := toml.NewDecoder(strings.NewReader(config)) d.DisallowUnknownFields() var cfg struct { - Starknet starknet.StarknetConfig + Starknet stkcfg.TOMLConfig } if err := d.Decode(&cfg); err != nil { return nil, fmt.Errorf("failed to decode config toml: %w:\n\t%s", err, config) } - opts := starknet.ChainOpts{ + opts := starkchain.ChainOpts{ Logger: c.Logger, KeyStore: loopKs, } - chain, err := starknet.NewChain(&cfg.Starknet, opts) + chain, err := starkchain.NewChain(&cfg.Starknet, opts) if err != nil { return nil, fmt.Errorf("failed to create chain: %w", err) }