Skip to content

Commit

Permalink
bump solana + cleanup types
Browse files Browse the repository at this point in the history
  • Loading branch information
aalu1418 committed May 17, 2024
1 parent 53312f0 commit 5e3d59f
Show file tree
Hide file tree
Showing 21 changed files with 62 additions and 68 deletions.
32 changes: 15 additions & 17 deletions core/cmd/shell_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ import (
"github.com/urfave/cli"

commoncfg "github.com/smartcontractkit/chainlink-common/pkg/config"
"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/cmd"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
Expand Down Expand Up @@ -359,20 +357,20 @@ func TestSetupSolanaRelayer(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.Solana = solana.TOMLConfigs{
&solana.TOMLConfig{
c.Solana = solcfg.TOMLConfigs{
&solcfg.TOMLConfig{
ChainID: ptr[string]("solana-id-1"),
Enabled: ptr(true),
Chain: solcfg.Chain{},
Nodes: []*solcfg.Node{},
},
&solana.TOMLConfig{
&solcfg.TOMLConfig{
ChainID: ptr[string]("solana-id-2"),
Enabled: ptr(true),
Chain: solcfg.Chain{},
Nodes: []*solcfg.Node{},
},
&solana.TOMLConfig{
&solcfg.TOMLConfig{
ChainID: ptr[string]("disabled-solana-id-1"),
Enabled: ptr(false),
Chain: solcfg.Chain{},
Expand All @@ -382,8 +380,8 @@ func TestSetupSolanaRelayer(t *testing.T) {
})

t2Config := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) {
c.Solana = solana.TOMLConfigs{
&solana.TOMLConfig{
c.Solana = solcfg.TOMLConfigs{
&solcfg.TOMLConfig{
ChainID: ptr[string]("solana-id-1"),
Enabled: ptr(true),
Chain: solcfg.Chain{},
Expand Down Expand Up @@ -420,14 +418,14 @@ func TestSetupSolanaRelayer(t *testing.T) {

// test that duplicate enabled chains is an error when
duplicateConfig := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) {
c.Solana = solana.TOMLConfigs{
&solana.TOMLConfig{
c.Solana = solcfg.TOMLConfigs{
&solcfg.TOMLConfig{
ChainID: ptr[string]("dupe"),
Enabled: ptr(true),
Chain: solcfg.Chain{},
Nodes: []*solcfg.Node{},
},
&solana.TOMLConfig{
&solcfg.TOMLConfig{
ChainID: ptr[string]("dupe"),
Enabled: ptr(true),
Chain: solcfg.Chain{},
Expand Down Expand Up @@ -478,21 +476,21 @@ func TestSetupStarkNetRelayer(t *testing.T) {
ChainID: ptr[string]("starknet-id-1"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
Nodes: []*stkcfg.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
&stkcfg.TOMLConfig{
ChainID: ptr[string]("starknet-id-2"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
Nodes: []*stkcfg.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
&stkcfg.TOMLConfig{
ChainID: ptr[string]("disabled-starknet-id-1"),
Enabled: ptr(false),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
Nodes: []*stkcfg.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
}
Expand All @@ -504,7 +502,7 @@ func TestSetupStarkNetRelayer(t *testing.T) {
ChainID: ptr[string]("starknet-id-3"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
Nodes: []*stkcfg.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
}
Expand Down Expand Up @@ -542,14 +540,14 @@ func TestSetupStarkNetRelayer(t *testing.T) {
ChainID: ptr[string]("dupe"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
Nodes: []*stkcfg.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
&stkcfg.TOMLConfig{
ChainID: ptr[string]("dupe"),
Enabled: ptr(true),
Chain: stkcfg.Chain{},
Nodes: []*config.Node{},
Nodes: []*stkcfg.Node{},
FeederURL: commoncfg.MustParseURL("https://feeder.url"),
},
}
Expand Down
4 changes: 2 additions & 2 deletions core/cmd/solana_chains_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ 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/v2/core/cmd"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
"github.com/smartcontractkit/chainlink/v2/core/internal/testutils/solanatest"
Expand All @@ -16,7 +16,7 @@ func TestShell_IndexSolanaChains(t *testing.T) {
t.Parallel()

id := solanatest.RandomChainID()
cfg := solana.TOMLConfig{
cfg := solcfg.TOMLConfig{
ChainID: &id,
Enabled: ptr(true),
}
Expand Down
7 changes: 3 additions & 4 deletions core/cmd/solana_node_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,13 @@ import (
"github.com/smartcontractkit/chainlink-common/pkg/config"
solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config"

"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"
"github.com/smartcontractkit/chainlink/v2/core/services/chainlink"
)

func solanaStartNewApplication(t *testing.T, cfgs ...*solana.TOMLConfig) *cltest.TestApplication {
func solanaStartNewApplication(t *testing.T, cfgs ...*solcfg.TOMLConfig) *cltest.TestApplication {
for i := range cfgs {
cfgs[i].SetDefaults()
}
Expand All @@ -41,9 +40,9 @@ func TestShell_IndexSolanaNodes(t *testing.T) {
Name: ptr("second"),
URL: config.MustParseURL("https://solana2.example"),
}
chain := solana.TOMLConfig{
chain := solcfg.TOMLConfig{
ChainID: &id,
Nodes: solana.SolanaNodes{&node1, &node2},
Nodes: solcfg.SolanaNodes{&node1, &node2},
}
app := solanaStartNewApplication(t, &chain)
client, r := app.NewShellAndRenderer()
Expand Down
2 changes: 1 addition & 1 deletion core/cmd/solana_transaction_commands_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func TestShell_SolanaSendSol(t *testing.T) {
Name: ptr(t.Name()),
URL: config.MustParseURL(url),
}
cfg := solana.TOMLConfig{
cfg := solcfg.TOMLConfig{
ChainID: &chainID,
Nodes: solana.SolanaNodes{&node},
Enabled: ptr(true),
Expand Down
4 changes: 2 additions & 2 deletions core/config/docs/docs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/stretchr/testify/require"

coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config"
"github.com/smartcontractkit/chainlink-solana/pkg/solana"
solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config"
stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config"

"github.com/smartcontractkit/chainlink-common/pkg/config"
Expand Down Expand Up @@ -97,7 +97,7 @@ func TestDoc(t *testing.T) {
})

t.Run("Solana", func(t *testing.T) {
var fallbackDefaults solana.TOMLConfig
var fallbackDefaults solcfg.TOMLConfig
fallbackDefaults.SetDefaults()

assertTOML(t, fallbackDefaults.Chain, defaults.Solana[0].Chain)
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ require (
github.com/smartcontractkit/chainlink-cosmos v0.4.1-0.20240508101745-af1ed7bc8a69 // indirect
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540 // indirect
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab // indirect
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83 // indirect
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240517202503-ecb23e9075c9 // indirect
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 // 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
Expand Down
4 changes: 2 additions & 2 deletions core/scripts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1193,8 +1193,8 @@ github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea
github.com/smartcontractkit/chainlink-data-streams v0.0.0-20240220203239-09be0ea34540/go.mod h1:sjAmX8K2kbQhvDarZE1ZZgDgmHJ50s0BBc/66vKY2ek=
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab h1:Ct1oUlyn03HDUVdFHJqtRGRUujMqdoMzvf/Cjhe30Ag=
github.com/smartcontractkit/chainlink-feeds v0.0.0-20240422130241-13c17a91b2ab/go.mod h1:RPUY7r8GxgzXxS1ijtU1P/fpJomOXztXgUbEziNmbCA=
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83 h1:f3W82k9V/XA6ZP/VQVJcGMVR6CrL3pQrPJSwyQWVFys=
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240510181707-46b1311a5a83/go.mod h1:RdAtOeBUWq2zByw2kEbwPlXaPIb7YlaDOmnn+nVUBJI=
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240517202503-ecb23e9075c9 h1:0Nbavnw/oNXAS0zv3U+FHr0LCMtAtl20DNZjw+riHaM=
github.com/smartcontractkit/chainlink-solana v1.0.3-0.20240517202503-ecb23e9075c9/go.mod h1:Z21EINw4ZCUJMMlbmKeOP+l1KMr34ns+bsFVsgU/Y+4=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69 h1:ssh/w3oXWu+C6bE88GuFRC1+0Bx/4ihsbc80XMLrl2k=
github.com/smartcontractkit/chainlink-starknet/relayer v0.0.1-beta-test.0.20240508155030-1024f2b55c69/go.mod h1:VsfjhvWgjxqWja4q+FlXEtX5lu8BSxn10xRo6gi948g=
github.com/smartcontractkit/chainlink-vrf v0.0.0-20240222010609-cd67d123c772 h1:LQmRsrzzaYYN3wEU1l5tWiccznhvbyGnu2N+wHSXZAo=
Expand Down
6 changes: 3 additions & 3 deletions core/services/chainlink/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
gotoml "github.com/pelletier/go-toml/v2"

coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config"
"github.com/smartcontractkit/chainlink-solana/pkg/solana"
solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config"
stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config"

commoncfg "github.com/smartcontractkit/chainlink/v2/common/config"
Expand Down Expand Up @@ -39,7 +39,7 @@ type Config struct {

Cosmos coscfg.TOMLConfigs `toml:",omitempty"`

Solana solana.TOMLConfigs `toml:",omitempty"`
Solana solcfg.TOMLConfigs `toml:",omitempty"`

Starknet stkcfg.TOMLConfigs `toml:",omitempty"`
}
Expand Down Expand Up @@ -122,7 +122,7 @@ func (c *Config) setDefaults() {

for i := range c.Solana {
if c.Solana[i] == nil {
c.Solana[i] = new(solana.TOMLConfig)
c.Solana[i] = new(solcfg.TOMLConfig)
}
c.Solana[i].Chain.SetDefaults()
}
Expand Down
4 changes: 2 additions & 2 deletions core/services/chainlink/config_general.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"go.uber.org/zap/zapcore"

coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config"
"github.com/smartcontractkit/chainlink-solana/pkg/solana"
solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config"
starknet "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config"

commonconfig "github.com/smartcontractkit/chainlink-common/pkg/config"
Expand Down Expand Up @@ -201,7 +201,7 @@ func (g *generalConfig) CosmosConfigs() coscfg.TOMLConfigs {
return g.c.Cosmos
}

func (g *generalConfig) SolanaConfigs() solana.TOMLConfigs {
func (g *generalConfig) SolanaConfigs() solcfg.TOMLConfigs {
return g.c.Solana
}

Expand Down
7 changes: 3 additions & 4 deletions core/services/chainlink/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
commoncfg "github.com/smartcontractkit/chainlink-common/pkg/config"
"github.com/smartcontractkit/chainlink-common/pkg/utils/hex"
coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config"
"github.com/smartcontractkit/chainlink-solana/pkg/solana"
solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config"
stkcfg "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config"
commonconfig "github.com/smartcontractkit/chainlink/v2/common/config"
Expand Down Expand Up @@ -160,7 +159,7 @@ var (
{Name: ptr("secondary"), TendermintURL: commoncfg.MustParseURL("http://bombay.cosmos.com")},
}},
},
Solana: []*solana.TOMLConfig{
Solana: []*solcfg.TOMLConfig{
{
ChainID: ptr("mainnet"),
Chain: solcfg.Chain{
Expand Down Expand Up @@ -632,7 +631,7 @@ func TestConfig_Marshal(t *testing.T) {
},
}},
}
full.Solana = []*solana.TOMLConfig{
full.Solana = []*solcfg.TOMLConfig{
{
ChainID: ptr("mainnet"),
Enabled: ptr(false),
Expand Down Expand Up @@ -1546,7 +1545,7 @@ func TestConfig_setDefaults(t *testing.T) {
var c Config
c.EVM = evmcfg.EVMConfigs{{ChainID: ubig.NewI(99999133712345)}}
c.Cosmos = coscfg.TOMLConfigs{{ChainID: ptr("unknown cosmos chain")}}
c.Solana = solana.TOMLConfigs{{ChainID: ptr("unknown solana chain")}}
c.Solana = solcfg.TOMLConfigs{{ChainID: ptr("unknown solana chain")}}
c.Starknet = stkcfg.TOMLConfigs{{ChainID: ptr("unknown starknet chain")}}
c.setDefaults()
if s, err := c.TOMLString(); assert.NoError(t, err) {
Expand Down
10 changes: 5 additions & 5 deletions core/services/chainlink/mocks/general_config.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions core/services/chainlink/relayer_chain_interoperators_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ 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"
ubig "github.com/smartcontractkit/chainlink/v2/core/chains/evm/utils/big"
"github.com/smartcontractkit/chainlink/v2/core/chains/legacyevm"
"github.com/smartcontractkit/chainlink/v2/core/internal/cltest"
Expand Down Expand Up @@ -75,8 +74,8 @@ func TestCoreRelayerChainInteroperators(t *testing.T) {
Nodes: evmcfg.EVMNodes{&node2_1},
})

c.Solana = solana.TOMLConfigs{
&solana.TOMLConfig{
c.Solana = solcfg.TOMLConfigs{
&solcfg.TOMLConfig{
ChainID: &solanaChainID1,
Enabled: ptr(true),
Chain: solcfg.Chain{},
Expand All @@ -85,7 +84,7 @@ func TestCoreRelayerChainInteroperators(t *testing.T) {
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:8547").URL())),
}},
},
&solana.TOMLConfig{
&solcfg.TOMLConfig{
ChainID: &solanaChainID2,
Enabled: ptr(true),
Chain: solcfg.Chain{},
Expand Down
10 changes: 5 additions & 5 deletions core/services/chainlink/relayer_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos"
coscfg "github.com/smartcontractkit/chainlink-cosmos/pkg/cosmos/config"
"github.com/smartcontractkit/chainlink-solana/pkg/solana"
pkgsolana "github.com/smartcontractkit/chainlink-solana/pkg/solana"
solcfg "github.com/smartcontractkit/chainlink-solana/pkg/solana/config"
pkgstarknet "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink"
starkchain "github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/chain"
"github.com/smartcontractkit/chainlink-starknet/relayer/pkg/chainlink/config"
Expand Down Expand Up @@ -92,10 +92,10 @@ func (r *RelayerFactory) NewEVM(ctx context.Context, config EVMFactoryConfig) (m

type SolanaFactoryConfig struct {
Keystore keystore.Solana
solana.TOMLConfigs
solcfg.TOMLConfigs
}

func (r *RelayerFactory) NewSolana(ks keystore.Solana, chainCfgs solana.TOMLConfigs) (map[types.RelayID]loop.Relayer, error) {
func (r *RelayerFactory) NewSolana(ks keystore.Solana, chainCfgs solcfg.TOMLConfigs) (map[types.RelayID]loop.Relayer, error) {
solanaRelayers := make(map[types.RelayID]loop.Relayer)
var (
solLggr = r.Logger.Named("Solana")
Expand Down Expand Up @@ -123,7 +123,7 @@ func (r *RelayerFactory) NewSolana(ks keystore.Solana, chainCfgs solana.TOMLConf
if cmdName := env.SolanaPlugin.Cmd.Get(); cmdName != "" {
// setup the solana relayer to be a LOOP
cfgTOML, err := toml.Marshal(struct {
Solana solana.TOMLConfig
Solana solcfg.TOMLConfig
}{Solana: *chainCfg})

if err != nil {
Expand Down Expand Up @@ -154,7 +154,7 @@ func (r *RelayerFactory) NewSolana(ks keystore.Solana, chainCfgs solana.TOMLConf
if err != nil {
return nil, err
}
solanaRelayers[relayID] = relay.NewServerAdapter(pkgsolana.NewRelayer(lggr, chain), chain)
solanaRelayers[relayID] = relay.NewServerAdapter(solana.NewRelayer(lggr, chain), chain)
}
}
return solanaRelayers, nil
Expand Down
Loading

0 comments on commit 5e3d59f

Please sign in to comment.