Skip to content

Commit a897b6b

Browse files
committed
pkg/solana/config: config enhancements
1 parent ec20f1a commit a897b6b

15 files changed

Lines changed: 727 additions & 191 deletions

File tree

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require (
2121
github.com/prometheus/client_model v0.6.1
2222
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250417161444-6af45cb2bf9e
2323
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250411163110-21a13ceb3ac4
24-
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250429205337-7ee5f91ed065
24+
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250430133340-d04a3b64e331
2525
github.com/smartcontractkit/chainlink-common/pkg/monitoring v0.0.0-20250415235644-8703639403c7
2626
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20250502210357-2df484128afa
2727
github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20250502210357-2df484128afa

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@ github.com/smartcontractkit/chainlink-ccip v0.0.0-20250417161444-6af45cb2bf9e h1
407407
github.com/smartcontractkit/chainlink-ccip v0.0.0-20250417161444-6af45cb2bf9e/go.mod h1:Jb05WL6lj5H89XGcaaOinxTf4Gdj+vXO4TcUhqTgqIM=
408408
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250411163110-21a13ceb3ac4 h1:ujhHdxB3+K6lOnhku7lqpj3WsoOhyvOAAkdsGtwon/o=
409409
github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20250411163110-21a13ceb3ac4/go.mod h1:k3/Z6AvwurPUlfuDFEonRbkkiTSgNSrtVNhJEWNlUZA=
410-
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250429205337-7ee5f91ed065 h1:8UsqHv+LkrO2KdXbfZd5qejsy4Z4Xz5/DNVfUGT6gTM=
411-
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250429205337-7ee5f91ed065/go.mod h1:vHs/mPpAztdKJtzRKLnmLinmpS78fBh9sAuyKqQrQ+I=
410+
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250430133340-d04a3b64e331 h1:+bN5yuawZeQeVw7vG+Me7kXLFK1vcesVeku3mdgRwqI=
411+
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250430133340-d04a3b64e331/go.mod h1:UGZVg18zzyJ1KimGM5SSmxG5jb7aCSq3OwQQKfhHGyE=
412412
github.com/smartcontractkit/chainlink-common/pkg/monitoring v0.0.0-20250415235644-8703639403c7 h1:9wh1G+WbXwPVqf0cfSRSgwIcaXTQgvYezylEAfwmrbw=
413413
github.com/smartcontractkit/chainlink-common/pkg/monitoring v0.0.0-20250415235644-8703639403c7/go.mod h1:yaDOAZF6MNB+NGYpxGCUc+owIdKrjvFW0JODdTcQ3V0=
414414
github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20250502210357-2df484128afa h1:NNFspORov2OGt7ex+mYFm+7nTUvjrUWBbCQBYvVXKK4=

integration-tests/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ require (
266266
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
267267
github.com/kr/pretty v0.3.1 // indirect
268268
github.com/kr/text v0.2.0 // indirect
269+
github.com/kylelemons/godebug v1.1.0 // indirect
269270
github.com/leanovate/gopter v0.2.11 // indirect
270271
github.com/leodido/go-urn v1.4.0 // indirect
271272
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect

integration-tests/testconfig/testconfig.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,6 @@ func (c *TestConfig) GetNodeConfigTOML() (string, error) {
281281
// Increase timeout for TransactionSender
282282
TxTimeout: config.MustNewDuration(2 * time.Minute),
283283
}
284-
chainCfg.SetDefaults()
285284

286285
solConfig := solcfg.TOMLConfig{
287286
Enabled: ptr.Ptr(true),

pkg/solana/CONFIG.md

Lines changed: 361 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,361 @@
1+
[//]: # (Documentation generated from docs.toml - DO NOT EDIT.)
2+
This document describes the TOML format for configuration.
3+
## Example
4+
5+
```toml
6+
# TODO
7+
```
8+
9+
## Global
10+
```toml
11+
ChainID = 'mainnet' # Example
12+
Enabled = false # Default
13+
BlockTime = '500ms' # Default
14+
BalancePollPeriod = '5s' # Default
15+
ConfirmPollPeriod = '500ms' # Default
16+
OCR2CachePollPeriod = '1s' # Default
17+
OCR2CacheTTL = '1m' # Default
18+
TxTimeout = '1m' # Default
19+
TxRetryTimeout = '10s' # Default
20+
TxConfirmTimeout = '30s' # Default
21+
TxExpirationRebroadcast = false # Default
22+
TxRetentionTimeout = '0s' # Default
23+
SkipPreflight = true # Default
24+
Commitment = 'confirmed' # Default
25+
MaxRetries = 0 # Default
26+
FeeEstimatorMode = 'fixed' # Default
27+
ComputeUnitPriceMax = 1000 # Default
28+
ComputeUnitPriceMin = 0 # Default
29+
ComputeUnitPriceDefault = 0 # Default
30+
FeeBumpPeriod = '3s' # Default
31+
BlockHistoryPollPeriod = '5s' # Default
32+
BlockHistorySize = 1 # Default
33+
BlockHistoryBatchLoadSize = 20 # Default
34+
ComputeUnitLimitDefault = 200_000 # Default
35+
EstimateComputeUnitLimit = false # Default
36+
LogPollerStartingLookback = '24h' # Default
37+
```
38+
39+
40+
### ChainID
41+
```toml
42+
ChainID = 'mainnet' # Example
43+
```
44+
ChainID is the Solana chain ID. Must be one of: mainnet, testnet, devnet, localnet. Mandatory.
45+
46+
### Enabled
47+
```toml
48+
Enabled = false # Default
49+
```
50+
Enabled enables this chain.
51+
52+
### BlockTime
53+
```toml
54+
BlockTime = '500ms' # Default
55+
```
56+
BlockTime specifies the average time between blocks on this chain
57+
58+
### BalancePollPeriod
59+
```toml
60+
BalancePollPeriod = '5s' # Default
61+
```
62+
BalancePollPeriod is the rate to poll for SOL balance and update Prometheus metrics.
63+
64+
### ConfirmPollPeriod
65+
```toml
66+
ConfirmPollPeriod = '500ms' # Default
67+
```
68+
ConfirmPollPeriod is the rate to poll for signature confirmation.
69+
70+
### OCR2CachePollPeriod
71+
```toml
72+
OCR2CachePollPeriod = '1s' # Default
73+
```
74+
OCR2CachePollPeriod is the rate to poll for the OCR2 state cache.
75+
76+
### OCR2CacheTTL
77+
```toml
78+
OCR2CacheTTL = '1m' # Default
79+
```
80+
OCR2CacheTTL is the stale OCR2 cache deadline.
81+
82+
### TxTimeout
83+
```toml
84+
TxTimeout = '1m' # Default
85+
```
86+
TxTimeout is the timeout for sending txes to an RPC endpoint.
87+
88+
### TxRetryTimeout
89+
```toml
90+
TxRetryTimeout = '10s' # Default
91+
```
92+
TxRetryTimeout is the duration for tx manager to attempt rebroadcasting to RPC, before giving up.
93+
94+
### TxConfirmTimeout
95+
```toml
96+
TxConfirmTimeout = '30s' # Default
97+
```
98+
TxConfirmTimeout is the duration to wait when confirming a tx signature, before discarding as unconfirmed.
99+
100+
### TxExpirationRebroadcast
101+
```toml
102+
TxExpirationRebroadcast = false # Default
103+
```
104+
TxExpirationRebroadcast enables or disables transaction rebroadcast if expired. Expiration check is performed every `ConfirmPollPeriod`
105+
A transaction is considered expired if the blockhash it was sent with is 150 blocks older than the latest blockhash.
106+
107+
### TxRetentionTimeout
108+
```toml
109+
TxRetentionTimeout = '0s' # Default
110+
```
111+
TxRetentionTimeout is the duration to retain transactions in storage after being marked as finalized or errored. Set to 0 to immediately drop transactions.
112+
113+
### SkipPreflight
114+
```toml
115+
SkipPreflight = true # Default
116+
```
117+
SkipPreflight enables or disables preflight checks when sending txs.
118+
119+
### Commitment
120+
```toml
121+
Commitment = 'confirmed' # Default
122+
```
123+
Commitment is the confirmation level for solana state and transactions. ([documentation](https://docs.solana.com/developing/clients/jsonrpc-api#configuring-state-commitment))
124+
125+
### MaxRetries
126+
```toml
127+
MaxRetries = 0 # Default
128+
```
129+
MaxRetries is the maximum number of times the RPC node will automatically rebroadcast a tx.
130+
The default is 0 for custom txm rebroadcasting method, set to -1 to use the RPC node's default retry strategy.
131+
132+
### FeeEstimatorMode
133+
```toml
134+
FeeEstimatorMode = 'fixed' # Default
135+
```
136+
FeeEstimatorMode is the method used to determine the base fee
137+
138+
### ComputeUnitPriceMax
139+
```toml
140+
ComputeUnitPriceMax = 1000 # Default
141+
```
142+
ComputeUnitPriceMax is the maximum price per compute unit that a transaction can be bumped to
143+
144+
### ComputeUnitPriceMin
145+
```toml
146+
ComputeUnitPriceMin = 0 # Default
147+
```
148+
ComputeUnitPriceMin is the minimum price per compute unit that transaction can have
149+
150+
### ComputeUnitPriceDefault
151+
```toml
152+
ComputeUnitPriceDefault = 0 # Default
153+
```
154+
ComputeUnitPriceDefault is the default price per compute unit price, and the starting base fee when FeeEstimatorMode = 'fixed'
155+
156+
### FeeBumpPeriod
157+
```toml
158+
FeeBumpPeriod = '3s' # Default
159+
```
160+
FeeBumpPeriod is the amount of time before a tx is retried with a fee bump. WARNING: If FeeBumpPeriod is shorter than blockhash expiration, multiple valid transactions can exist in parallel. This can result in higher costs and can cause unexpected behaviors if contracts do not de-dupe txs
161+
162+
### BlockHistoryPollPeriod
163+
```toml
164+
BlockHistoryPollPeriod = '5s' # Default
165+
```
166+
BlockHistoryPollPeriod is the rate to poll for blocks in the block history fee estimator
167+
168+
### BlockHistorySize
169+
```toml
170+
BlockHistorySize = 1 # Default
171+
```
172+
BlockHistorySize is the number of blocks to take into consideration when using FeeEstimatorMode = 'blockhistory' to determine compute unit price.
173+
If set to 1, the compute unit price will be determined by the median of the last block's compute unit prices.
174+
If set N > 1, the compute unit price will be determined by the average of the medians of the last N blocks' compute unit prices.
175+
DISCLAIMER: If set to a value greater than BlockHistoryBatchLoadSize, initial estimations during startup would be over smaller block ranges until the cache is filled.
176+
177+
### BlockHistoryBatchLoadSize
178+
```toml
179+
BlockHistoryBatchLoadSize = 20 # Default
180+
```
181+
BlockHistoryBatchLoadSize is the number of latest blocks to fetch from the chain to store in the cache every BlockHistoryPollPeriod.
182+
This config is only relevant if BlockHistorySize > 1 and if BlockHistorySize is greater than BlockHistoryBatchLoadSize.
183+
Ensure the value is greater than the number of blocks that would be produced between each BlockHistoryPollPeriod to avoid gaps in block history.
184+
185+
### ComputeUnitLimitDefault
186+
```toml
187+
ComputeUnitLimitDefault = 200_000 # Default
188+
```
189+
ComputeUnitLimitDefault is the compute units limit applied to transactions unless overriden during the txm enqueue
190+
191+
### EstimateComputeUnitLimit
192+
```toml
193+
EstimateComputeUnitLimit = false # Default
194+
```
195+
EstimateComputeUnitLimit enables or disables compute unit limit estimations per transaction. If estimations return 0 used compute, the ComputeUnitLimitDefault value is used, if set.
196+
197+
### LogPollerStartingLookback
198+
```toml
199+
LogPollerStartingLookback = '24h' # Default
200+
```
201+
LogPollerStartingLookback
202+
203+
## MultiNode
204+
```toml
205+
[MultiNode]
206+
Enabled = false # Default
207+
PollFailureThreshold = 5 # Default
208+
PollInterval = '15s' # Default
209+
SelectionMode = 'PriorityLevel' # Default
210+
SyncThreshold = 10 # Default
211+
NodeIsSyncingEnabled = false # Default
212+
LeaseDuration = '1m' # Default
213+
NewHeadsPollInterval = '5s' # Default
214+
FinalizedBlockPollInterval = '5s' # Default
215+
EnforceRepeatableRead = true # Default
216+
DeathDeclarationDelay = '20s' # Default
217+
VerifyChainID = true # Default
218+
NodeNoNewHeadsThreshold = '20s' # Default
219+
NoNewFinalizedHeadsThreshold = '20s' # Default
220+
FinalityDepth = 0 # Default
221+
FinalityTagEnabled = true # Default
222+
FinalizedBlockOffset = 50 # Default
223+
```
224+
225+
226+
### Enabled
227+
```toml
228+
Enabled = false # Default
229+
```
230+
Enabled enables the multinode feature.
231+
232+
### PollFailureThreshold
233+
```toml
234+
PollFailureThreshold = 5 # Default
235+
```
236+
PollFailureThreshold is the number of consecutive poll failures before a node is considered unhealthy.
237+
238+
### PollInterval
239+
```toml
240+
PollInterval = '15s' # Default
241+
```
242+
PollInterval is the rate to poll for node health.
243+
244+
### SelectionMode
245+
```toml
246+
SelectionMode = 'PriorityLevel' # Default
247+
```
248+
SelectionMode is the method used to select the next best node to use.
249+
250+
### SyncThreshold
251+
```toml
252+
SyncThreshold = 10 # Default
253+
```
254+
SyncThreshold is the number of blocks behind the best node that a node can be before it is considered out of sync.
255+
256+
### NodeIsSyncingEnabled
257+
```toml
258+
NodeIsSyncingEnabled = false # Default
259+
```
260+
NodeIsSyncingEnabled enables the feature to avoid sending transactions to nodes that are syncing. Not relavant for Solana.
261+
262+
### LeaseDuration
263+
```toml
264+
LeaseDuration = '1m' # Default
265+
```
266+
LeaseDuration is the max duration a node can be leased for.
267+
268+
### NewHeadsPollInterval
269+
```toml
270+
NewHeadsPollInterval = '5s' # Default
271+
```
272+
NewHeadsPollInterval is the rate to poll for new heads.
273+
274+
### FinalizedBlockPollInterval
275+
```toml
276+
FinalizedBlockPollInterval = '5s' # Default
277+
```
278+
FinalizedBlockPollInterval is the rate to poll for the finalized block.
279+
280+
### EnforceRepeatableRead
281+
```toml
282+
EnforceRepeatableRead = true # Default
283+
```
284+
EnforceRepeatableRead enforces the repeatable read guarantee for multinode.
285+
286+
### DeathDeclarationDelay
287+
```toml
288+
DeathDeclarationDelay = '20s' # Default
289+
```
290+
DeathDeclarationDelay is the duration to wait before declaring a node dead.
291+
292+
### VerifyChainID
293+
```toml
294+
VerifyChainID = true # Default
295+
```
296+
VerifyChainID enforces RPC Client ChainIDs to match configured ChainID
297+
298+
### NodeNoNewHeadsThreshold
299+
```toml
300+
NodeNoNewHeadsThreshold = '20s' # Default
301+
```
302+
NodeNoNewHeadsThreshold is the duration to wait before declaring a node unhealthy due to no new heads.
303+
304+
### NoNewFinalizedHeadsThreshold
305+
```toml
306+
NoNewFinalizedHeadsThreshold = '20s' # Default
307+
```
308+
NoNewFinalizedHeadsThreshold is the duration to wait before declaring a node unhealthy due to no new finalized heads.
309+
310+
### FinalityDepth
311+
```toml
312+
FinalityDepth = 0 # Default
313+
```
314+
FinalityDepth is not used when finality tags are enabled.
315+
316+
### FinalityTagEnabled
317+
```toml
318+
FinalityTagEnabled = true # Default
319+
```
320+
FinalityTagEnabled enables the use of finality tags.
321+
322+
### FinalizedBlockOffset
323+
```toml
324+
FinalizedBlockOffset = 50 # Default
325+
```
326+
FinalizedBlockOffset is the offset from the finalized block to use for finality tags.
327+
328+
## Nodes
329+
```toml
330+
[[Nodes]]
331+
Name = 'primary' # Example
332+
URL = 'http://solana.web' # Example
333+
SendOnly = false # Default
334+
Order = 100 # Default
335+
```
336+
337+
338+
### Name
339+
```toml
340+
Name = 'primary' # Example
341+
```
342+
Name is a unique (per-chain) identifier for this node.
343+
344+
### URL
345+
```toml
346+
URL = 'http://solana.web' # Example
347+
```
348+
URL is the HTTP(S) endpoint for this node.
349+
350+
### SendOnly
351+
```toml
352+
SendOnly = false # Default
353+
```
354+
SendOnly is a multinode config that only sends transactions to a node and does not read state
355+
356+
### Order
357+
```toml
358+
Order = 100 # Default
359+
```
360+
Order specifies the priority for each node. 1 is highest priority down to 100 being the lowest.
361+

0 commit comments

Comments
 (0)