Skip to content

Commit eda37a5

Browse files
authored
Merge pull request #17548 from smartcontractkit/cherrypick/solana-node-ordering
Cherrypick: Solana node ordering config
2 parents 66f4d78 + 2b2263c commit eda37a5

24 files changed

Lines changed: 112 additions & 92 deletions

File tree

core/config/docs/chains-solana.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,5 @@ Name = 'primary' # Example
102102
URL = 'http://solana.web' # Example
103103
# SendOnly is a multinode config that only sends transactions to a node and does not read state
104104
SendOnly = false # Default
105+
# Order specifies the priority for each node. 1 is highest priority down to 100 being the lowest.
106+
Order = 100 # Default

core/scripts/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ require (
359359
github.com/smartcontractkit/chainlink-protos/orchestrator v0.5.0 // indirect
360360
github.com/smartcontractkit/chainlink-protos/rmn/v1.6/go v0.0.0-20250131130834-15e0d4cde2a6 // indirect
361361
github.com/smartcontractkit/chainlink-protos/svr v1.1.0 // indirect
362-
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250425213256-30ad97c0e9ca // indirect
362+
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250426000843-1697af47a38e // indirect
363363
github.com/smartcontractkit/chainlink-testing-framework/framework v0.7.4 // indirect
364364
github.com/smartcontractkit/chainlink-tron/relayer v0.0.11-0.20250422175525-b7575d96bd4d // indirect
365365
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 // indirect

core/scripts/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1158,8 +1158,8 @@ github.com/smartcontractkit/chainlink-protos/rmn/v1.6/go v0.0.0-20250131130834-1
11581158
github.com/smartcontractkit/chainlink-protos/rmn/v1.6/go v0.0.0-20250131130834-15e0d4cde2a6/go.mod h1:FRwzI3hGj4CJclNS733gfcffmqQ62ONCkbGi49s658w=
11591159
github.com/smartcontractkit/chainlink-protos/svr v1.1.0 h1:79Z9N9dMbMVRGaLoDPAQ+vOwbM+Hnx8tIN2xCPG8H4o=
11601160
github.com/smartcontractkit/chainlink-protos/svr v1.1.0/go.mod h1:TcOliTQU6r59DwG4lo3U+mFM9WWyBHGuFkkxQpvSujo=
1161-
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250425213256-30ad97c0e9ca h1:/Q++yqhhxmBNQ0GwPBkQtOJNC+dB138DXu2O6JjmgTE=
1162-
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250425213256-30ad97c0e9ca/go.mod h1:13Oevz/mk5ANLZm3xPFZJO7p2hSJylM/g97VwSbjdxs=
1161+
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250426000843-1697af47a38e h1:jwJ6cNo3GWBDX/hlGNcxAXo5Zkc3g8RNBGA5M3KJAMc=
1162+
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250426000843-1697af47a38e/go.mod h1:13Oevz/mk5ANLZm3xPFZJO7p2hSJylM/g97VwSbjdxs=
11631163
github.com/smartcontractkit/chainlink-testing-framework/framework v0.7.4 h1:ks1FuQQ6f7PY/97VFXxtZhAyWZaT0NCvhT+1wKgyOt0=
11641164
github.com/smartcontractkit/chainlink-testing-framework/framework v0.7.4/go.mod h1:zw3QH/GTvPl/7Cjyw+y4cJYnP16QHTEh7wWLJQd9lM8=
11651165
github.com/smartcontractkit/chainlink-testing-framework/lib v1.52.4 h1:+kwLuO9kcq1+ZbRUQjxX1SQmzlL2M6ZP6+L0xQMtmkU=

core/services/chainlink/config_test.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ var (
179179
},
180180
},
181181
Nodes: []*solcfg.Node{
182-
{Name: ptr("primary"), URL: commoncfg.MustParseURL("http://mainnet.solana.com")},
182+
{Name: ptr("primary"), URL: commoncfg.MustParseURL("http://mainnet.solana.com"), Order: ptr(int32(1))},
183183
},
184184
},
185185
{
@@ -209,7 +209,7 @@ var (
209209
},
210210
},
211211
Nodes: []*solcfg.Node{
212-
{Name: ptr("secondary"), URL: commoncfg.MustParseURL("http://testnet.solana.com")},
212+
{Name: ptr("secondary"), URL: commoncfg.MustParseURL("http://testnet.solana.com"), Order: ptr(int32(2))},
213213
},
214214
},
215215
},
@@ -792,9 +792,9 @@ func TestConfig_Marshal(t *testing.T) {
792792
},
793793
},
794794
Nodes: []*solcfg.Node{
795-
{Name: ptr("primary"), URL: commoncfg.MustParseURL("http://solana.web")},
796-
{Name: ptr("foo"), URL: commoncfg.MustParseURL("http://solana.foo"), SendOnly: true},
797-
{Name: ptr("bar"), URL: commoncfg.MustParseURL("http://solana.bar"), SendOnly: true},
795+
{Name: ptr("primary"), URL: commoncfg.MustParseURL("http://solana.web"), Order: ptr(int32(1))},
796+
{Name: ptr("foo"), URL: commoncfg.MustParseURL("http://solana.foo"), SendOnly: true, Order: ptr(int32(2))},
797+
{Name: ptr("bar"), URL: commoncfg.MustParseURL("http://solana.bar"), SendOnly: true, Order: ptr(int32(3))},
798798
},
799799
},
800800
}
@@ -1271,16 +1271,19 @@ FinalizedBlockOffset = 0
12711271
Name = 'primary'
12721272
URL = 'http://solana.web'
12731273
SendOnly = false
1274+
Order = 1
12741275
12751276
[[Solana.Nodes]]
12761277
Name = 'foo'
12771278
URL = 'http://solana.foo'
12781279
SendOnly = true
1280+
Order = 2
12791281
12801282
[[Solana.Nodes]]
12811283
Name = 'bar'
12821284
URL = 'http://solana.bar'
12831285
SendOnly = true
1286+
Order = 3
12841287
`},
12851288
{"Mercury", Config{Core: toml.Core{Mercury: full.Mercury}}, `[Mercury]
12861289
VerboseLogging = true

core/services/chainlink/relayer_chain_interoperators_test.go

Lines changed: 60 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -36,68 +36,67 @@ func TestCoreRelayerChainInteroperators(t *testing.T) {
3636
evmChainID1, evmChainID2 := ubig.New(big.NewInt(1)), ubig.New(big.NewInt(2))
3737
solanaChainID1, solanaChainID2 := "solana-id-1", "solana-id-2"
3838

39-
cfg := configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) {
40-
cfg := toml.Defaults(evmChainID1)
41-
node1_1 := toml.Node{
42-
Name: ptr("Test node chain1:1"),
43-
WSURL: commonconfig.MustParseURL("ws://localhost:8546"),
44-
HTTPURL: commonconfig.MustParseURL("http://localhost:8546"),
45-
SendOnly: ptr(false),
46-
Order: ptr(int32(15)),
47-
}
48-
node1_2 := toml.Node{
49-
Name: ptr("Test node chain1:2"),
50-
WSURL: commonconfig.MustParseURL("ws://localhost:8547"),
51-
HTTPURL: commonconfig.MustParseURL("http://localhost:8547"),
52-
SendOnly: ptr(false),
53-
Order: ptr(int32(36)),
54-
}
55-
node2_1 := toml.Node{
56-
Name: ptr("Test node chain2:1"),
57-
WSURL: commonconfig.MustParseURL("ws://localhost:8547"),
58-
HTTPURL: commonconfig.MustParseURL("http://localhost:8547"),
59-
SendOnly: ptr(false),
60-
Order: ptr(int32(11)),
61-
}
62-
c.EVM[0] = &toml.EVMConfig{
63-
ChainID: evmChainID1,
64-
Enabled: ptr(true),
65-
Chain: cfg,
66-
Nodes: toml.EVMNodes{&node1_1, &node1_2},
67-
}
68-
id2 := ubig.New(big.NewInt(2))
69-
c.EVM = append(c.EVM, &toml.EVMConfig{
70-
ChainID: evmChainID2,
71-
Chain: toml.Defaults(id2),
72-
Enabled: ptr(true),
73-
Nodes: toml.EVMNodes{&node2_1},
74-
})
75-
76-
solChainCfg := solcfg.Chain{}
77-
solChainCfg.SetDefaults()
78-
79-
c.Solana = solcfg.TOMLConfigs{
80-
&solcfg.TOMLConfig{
81-
ChainID: &solanaChainID1,
39+
newConfig := func() chainlink.GeneralConfig {
40+
return configtest.NewGeneralConfig(t, func(c *chainlink.Config, s *chainlink.Secrets) {
41+
node1_1 := toml.Node{
42+
Name: ptr("Test node chain1:1"),
43+
WSURL: commonconfig.MustParseURL("ws://localhost:8546"),
44+
HTTPURL: commonconfig.MustParseURL("http://localhost:8546"),
45+
SendOnly: ptr(false),
46+
Order: ptr(int32(15)),
47+
}
48+
node1_2 := toml.Node{
49+
Name: ptr("Test node chain1:2"),
50+
WSURL: commonconfig.MustParseURL("ws://localhost:8547"),
51+
HTTPURL: commonconfig.MustParseURL("http://localhost:8547"),
52+
SendOnly: ptr(false),
53+
Order: ptr(int32(36)),
54+
}
55+
node2_1 := toml.Node{
56+
Name: ptr("Test node chain2:1"),
57+
WSURL: commonconfig.MustParseURL("ws://localhost:8547"),
58+
HTTPURL: commonconfig.MustParseURL("http://localhost:8547"),
59+
SendOnly: ptr(false),
60+
Order: ptr(int32(11)),
61+
}
62+
c.EVM[0] = &toml.EVMConfig{
63+
ChainID: evmChainID1,
8264
Enabled: ptr(true),
83-
Chain: solChainCfg,
84-
Nodes: []*solcfg.Node{{
85-
Name: ptr("solana chain 1 node 1"),
86-
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:8547").URL())),
87-
}},
88-
},
89-
&solcfg.TOMLConfig{
90-
ChainID: &solanaChainID2,
65+
Chain: toml.Defaults(evmChainID1),
66+
Nodes: toml.EVMNodes{&node1_1, &node1_2},
67+
}
68+
id2 := ubig.New(big.NewInt(2))
69+
c.EVM = append(c.EVM, &toml.EVMConfig{
70+
ChainID: evmChainID2,
71+
Chain: toml.Defaults(id2),
9172
Enabled: ptr(true),
92-
Chain: solChainCfg,
93-
Nodes: []*solcfg.Node{{
94-
Name: ptr("solana chain 2 node 1"),
95-
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:8527").URL())),
96-
}},
97-
},
98-
}
99-
})
73+
Nodes: toml.EVMNodes{&node2_1},
74+
})
75+
76+
c.Solana = solcfg.TOMLConfigs{
77+
&solcfg.TOMLConfig{
78+
ChainID: &solanaChainID1,
79+
Enabled: ptr(true),
80+
Chain: solcfg.NewDefault().Chain,
81+
Nodes: []*solcfg.Node{{
82+
Name: ptr("solana chain 1 node 1"),
83+
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:8547").URL())),
84+
}},
85+
},
86+
&solcfg.TOMLConfig{
87+
ChainID: &solanaChainID2,
88+
Enabled: ptr(true),
89+
Chain: solcfg.NewDefault().Chain,
90+
Nodes: []*solcfg.Node{{
91+
Name: ptr("solana chain 2 node 1"),
92+
URL: ((*commonconfig.URL)(commonconfig.MustParseURL("http://localhost:8527").URL())),
93+
}},
94+
},
95+
}
96+
})
97+
}
10098

99+
cfg := newConfig()
101100
db := pgtest.NewSqlxDB(t)
102101
keyStore := cltest.NewKeyStore(t, db)
103102

@@ -163,7 +162,7 @@ func TestCoreRelayerChainInteroperators(t *testing.T) {
163162
{name: "2 solana chain with 2 node",
164163
initFuncs: []chainlink.CoreRelayerChainInitFunc{
165164
chainlink.InitSolana(factory, keyStore.Solana(), chainlink.SolanaFactoryConfig{
166-
TOMLConfigs: cfg.SolanaConfigs()}),
165+
TOMLConfigs: newConfig().SolanaConfigs()}),
167166
},
168167
expectedSolanaChainCnt: 2,
169168
expectedSolanaNodeCnt: 2,
@@ -176,7 +175,7 @@ func TestCoreRelayerChainInteroperators(t *testing.T) {
176175

177176
{name: "all chains",
178177
initFuncs: []chainlink.CoreRelayerChainInitFunc{chainlink.InitSolana(factory, keyStore.Solana(), chainlink.SolanaFactoryConfig{
179-
TOMLConfigs: cfg.SolanaConfigs()}),
178+
TOMLConfigs: newConfig().SolanaConfigs()}),
180179
chainlink.InitEVM(factory, chainlink.EVMFactoryConfig{
181180
ChainOpts: legacyevm.ChainOpts{
182181
ChainConfigs: cfg.EVMConfigs(),

core/services/chainlink/testdata/config-full.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,13 +537,16 @@ FinalizedBlockOffset = 0
537537
Name = 'primary'
538538
URL = 'http://solana.web'
539539
SendOnly = false
540+
Order = 1
540541

541542
[[Solana.Nodes]]
542543
Name = 'foo'
543544
URL = 'http://solana.foo'
544545
SendOnly = true
546+
Order = 2
545547

546548
[[Solana.Nodes]]
547549
Name = 'bar'
548550
URL = 'http://solana.bar'
549551
SendOnly = true
552+
Order = 3

core/services/chainlink/testdata/config-multi-chain-effective.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,7 @@ FinalizedBlockOffset = 0
698698
Name = 'primary'
699699
URL = 'http://mainnet.solana.com'
700700
SendOnly = false
701+
Order = 1
701702

702703
[[Solana]]
703704
ChainID = 'testnet'
@@ -749,3 +750,4 @@ FinalizedBlockOffset = 0
749750
Name = 'secondary'
750751
URL = 'http://testnet.solana.com'
751752
SendOnly = false
753+
Order = 2

core/services/chainlink/testdata/config-multi-chain.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ FinalizedBlockOffset = 0
102102
Name = 'primary'
103103
URL = 'http://mainnet.solana.com'
104104
SendOnly = false
105+
Order = 1
105106

106107
[[Solana]]
107108
ChainID = 'testnet'
@@ -130,3 +131,4 @@ FinalizedBlockOffset = 0
130131
Name = 'secondary'
131132
URL = 'http://testnet.solana.com'
132133
SendOnly = false
134+
Order = 2

deployment/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ require (
4040
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250402142713-6529d36f91f3
4141
github.com/smartcontractkit/chainlink-protos/job-distributor v0.9.0
4242
github.com/smartcontractkit/chainlink-protos/orchestrator v0.5.0
43-
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250425213256-30ad97c0e9ca
43+
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250426000843-1697af47a38e
4444
github.com/smartcontractkit/chainlink-testing-framework/framework v0.7.4
4545
github.com/smartcontractkit/chainlink-testing-framework/lib v1.52.4
4646
github.com/smartcontractkit/libocr v0.0.0-20250408131511-c90716988ee0

deployment/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,8 +1206,8 @@ github.com/smartcontractkit/chainlink-protos/rmn/v1.6/go v0.0.0-20250131130834-1
12061206
github.com/smartcontractkit/chainlink-protos/rmn/v1.6/go v0.0.0-20250131130834-15e0d4cde2a6/go.mod h1:FRwzI3hGj4CJclNS733gfcffmqQ62ONCkbGi49s658w=
12071207
github.com/smartcontractkit/chainlink-protos/svr v1.1.0 h1:79Z9N9dMbMVRGaLoDPAQ+vOwbM+Hnx8tIN2xCPG8H4o=
12081208
github.com/smartcontractkit/chainlink-protos/svr v1.1.0/go.mod h1:TcOliTQU6r59DwG4lo3U+mFM9WWyBHGuFkkxQpvSujo=
1209-
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250425213256-30ad97c0e9ca h1:/Q++yqhhxmBNQ0GwPBkQtOJNC+dB138DXu2O6JjmgTE=
1210-
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250425213256-30ad97c0e9ca/go.mod h1:13Oevz/mk5ANLZm3xPFZJO7p2hSJylM/g97VwSbjdxs=
1209+
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250426000843-1697af47a38e h1:jwJ6cNo3GWBDX/hlGNcxAXo5Zkc3g8RNBGA5M3KJAMc=
1210+
github.com/smartcontractkit/chainlink-solana v1.1.2-0.20250426000843-1697af47a38e/go.mod h1:13Oevz/mk5ANLZm3xPFZJO7p2hSJylM/g97VwSbjdxs=
12111211
github.com/smartcontractkit/chainlink-testing-framework/framework v0.7.4 h1:ks1FuQQ6f7PY/97VFXxtZhAyWZaT0NCvhT+1wKgyOt0=
12121212
github.com/smartcontractkit/chainlink-testing-framework/framework v0.7.4/go.mod h1:zw3QH/GTvPl/7Cjyw+y4cJYnP16QHTEh7wWLJQd9lM8=
12131213
github.com/smartcontractkit/chainlink-testing-framework/lib v1.52.4 h1:+kwLuO9kcq1+ZbRUQjxX1SQmzlL2M6ZP6+L0xQMtmkU=

0 commit comments

Comments
 (0)