Skip to content

Commit 3e10fc5

Browse files
committed
relay/config: config enhancements
1 parent d31a02e commit 3e10fc5

26 files changed

+580
-112
lines changed

CONFIG.md

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
[//]: # (Documentation generated from docs.toml - DO NOT EDIT.)
2+
3+
This document describes the TOML format for configuration.
4+
## Example
5+
6+
```toml
7+
ChainID = "4"
8+
9+
[[Aptos.Nodes]]
10+
Name = 'primary'
11+
URL = "http://chainlink-aptos.devnet:8080/v1"
12+
```
13+
14+
## Global
15+
```toml
16+
Enabled = true # Default
17+
ChainID = 'TODO' # Example
18+
NetworkName = 'TODO' # Example
19+
NetworkNameFull = 'TODO' # Example
20+
```
21+
22+
23+
### Enabled
24+
```toml
25+
Enabled = true # Default
26+
```
27+
Enabled TODO
28+
29+
### ChainID
30+
```toml
31+
ChainID = 'TODO' # Example
32+
```
33+
ChainID TODO
34+
35+
### NetworkName
36+
```toml
37+
NetworkName = 'TODO' # Example
38+
```
39+
NetworkName TODO
40+
41+
### NetworkNameFull
42+
```toml
43+
NetworkNameFull = 'TODO' # Example
44+
```
45+
NetworkNameFull TODO
46+
47+
## TransactionManager
48+
```toml
49+
[TransactionManager]
50+
BroadcastChanSize = 100 # Default
51+
ConfirmPoll = '2s' # Default
52+
ConfirmPollSecs = 1 # Example
53+
DefaultMaxGasAmount = 200000 # Default
54+
MaxSimulateAttempts = 5 # Default
55+
MaxSubmitRetryAttempts = 10 # Default
56+
SubmitDelayDuration = '3s' # Default
57+
TxExpiration = '10s' # Default
58+
TxExpirationSecs = 360 # Example
59+
MaxTxRetryAttempts = 5 # Default
60+
PruneInterval = '4h' # Default
61+
PruneIntervalSecs = 1 # Example
62+
PruneTxExpiration = '2h' # Default
63+
PruneTxExpirationSecs = 42 # Example
64+
```
65+
66+
67+
### BroadcastChanSize
68+
```toml
69+
BroadcastChanSize = 100 # Default
70+
```
71+
BroadcastChanSize TODO
72+
73+
### ConfirmPoll
74+
```toml
75+
ConfirmPoll = '2s' # Default
76+
```
77+
ConfirmPoll TODO
78+
79+
### ConfirmPollSecs
80+
```toml
81+
ConfirmPollSecs = 1 # Example
82+
```
83+
ConfirmPollSecs is deprecated. Use ConfirmPoll instead.
84+
85+
### DefaultMaxGasAmount
86+
```toml
87+
DefaultMaxGasAmount = 200000 # Default
88+
```
89+
DefaultMaxGasAmount TODO
90+
https://github.com/aptos-labs/aptos-ts-sdk/blob/32d4360740392782c1368647f89ba62e1b6a2cb3/src/utils/const.ts#L21
91+
92+
### MaxSimulateAttempts
93+
```toml
94+
MaxSimulateAttempts = 5 # Default
95+
```
96+
MaxSimulateAttempts TODO
97+
98+
### MaxSubmitRetryAttempts
99+
```toml
100+
MaxSubmitRetryAttempts = 10 # Default
101+
```
102+
MaxSubmitRetryAttempts TODO
103+
104+
### SubmitDelayDuration
105+
```toml
106+
SubmitDelayDuration = '3s' # Default
107+
```
108+
SubmitDelayDuration TODO
109+
110+
### TxExpiration
111+
```toml
112+
TxExpiration = '10s' # Default
113+
```
114+
TxExpiration TODO
115+
116+
### TxExpirationSecs
117+
```toml
118+
TxExpirationSecs = 360 # Example
119+
```
120+
TxExpirationSecs is deprecated. Use TxExpiration instead.
121+
122+
### MaxTxRetryAttempts
123+
```toml
124+
MaxTxRetryAttempts = 5 # Default
125+
```
126+
MaxTxRetryAttempts TODO
127+
128+
### PruneInterval
129+
```toml
130+
PruneInterval = '4h' # Default
131+
```
132+
PruneInterval TODO
133+
134+
### PruneIntervalSecs
135+
```toml
136+
PruneIntervalSecs = 1 # Example
137+
```
138+
PruneIntervalSecs is deprecated. Use PruneInterval instead.
139+
140+
### PruneTxExpiration
141+
```toml
142+
PruneTxExpiration = '2h' # Default
143+
```
144+
PruneTxExpiration TODO
145+
146+
### PruneTxExpirationSecs
147+
```toml
148+
PruneTxExpirationSecs = 42 # Example
149+
```
150+
PruneTxExpirationSecs is deprecated. Use PruneTxExpiration instead.
151+
152+
## BalanceMonitor
153+
```toml
154+
[BalanceMonitor]
155+
BalancePollPeriod = '10s' # Default
156+
```
157+
158+
159+
### BalancePollPeriod
160+
```toml
161+
BalancePollPeriod = '10s' # Default
162+
```
163+
BalancePollPeriod TODO
164+
165+
## WriteTargetCap
166+
```toml
167+
[WriteTargetCap]
168+
ConfirmerPollPeriod = '1s' # Default
169+
ConfirmerTimeout = '10s' # Default
170+
```
171+
172+
173+
### ConfirmerPollPeriod
174+
```toml
175+
ConfirmerPollPeriod = '1s' # Default
176+
```
177+
ConfirmerPollPeriod TODO
178+
179+
### ConfirmerTimeout
180+
```toml
181+
ConfirmerTimeout = '10s' # Default
182+
```
183+
ConfirmerTimeout TODO
184+
185+
## Workflow
186+
```toml
187+
[Workflow]
188+
ForwarderAddress = 'TODO' # Example
189+
PublicKey = 'TODO' # Example
190+
```
191+
192+
193+
### ForwarderAddress
194+
```toml
195+
ForwarderAddress = 'TODO' # Example
196+
```
197+
ForwarderAddress TODO
198+
199+
### PublicKey
200+
```toml
201+
PublicKey = 'TODO' # Example
202+
```
203+
PublicKey TODO
204+
205+
## Nodes
206+
```toml
207+
[[Nodes]]
208+
Name = 'TODO' # Example
209+
URL = '' # Example
210+
```
211+
212+
213+
### Name
214+
```toml
215+
Name = 'TODO' # Example
216+
```
217+
Name TODO
218+
219+
### URL
220+
```toml
221+
URL = '' # Example
222+
```
223+
URL TODO
224+

cmd/config-docs/main.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package main
2+
3+
import (
4+
"flag"
5+
"fmt"
6+
"log"
7+
"os"
8+
"path"
9+
10+
"github.com/smartcontractkit/chainlink-aptos/relayer/config"
11+
)
12+
13+
var outDir = flag.String("o", "", "output directory")
14+
15+
func main() {
16+
s, err := config.GenerateDocs()
17+
if err != nil {
18+
log.Fatalln("Failed to generate docs:", err)
19+
}
20+
if err = os.WriteFile(path.Join(*outDir, "CONFIG.md"), []byte(s), 0600); err != nil {
21+
fmt.Fprintf(os.Stderr, "failed to write config docs: %v\n", err)
22+
os.Exit(1)
23+
}
24+
}

config_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package aptos
2+
3+
import (
4+
_ "embed"
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
9+
"github.com/smartcontractkit/chainlink-aptos/relayer/config"
10+
)
11+
12+
var (
13+
//go:embed CONFIG.md
14+
configMD string
15+
)
16+
17+
func TestConfigDocs(t *testing.T) {
18+
cfg, err := config.GenerateDocs()
19+
assert.NoError(t, err, "invalid config docs")
20+
assert.Equal(t, configMD, cfg, "CONFIG.md is out of date. Run 'go generate .' to regenerate.")
21+
}

gen.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ package aptos
2828
//go:generate go run ./cmd/bindgen --input ./contracts/mcms/mcms/sources/mcms_registry.move --output ./bindings/mcms/mcms_registry
2929

3030
//go:generate go run ./cmd/bindgen --input ./contracts/mcms/mcms_test/sources/mcms_user.move --output ./bindings/mcms_test/mcms_user
31+
32+
//go:generate go run ./cmd/config-docs -o CONFIG.md

go.mod

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ require (
1212
github.com/jpillora/backoff v1.0.0
1313
github.com/pelletier/go-toml/v2 v2.2.3
1414
github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82
15-
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250418172423-6b24a042d134
15+
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250428140325-7ea957803c52
1616
github.com/stretchr/testify v1.10.0
1717
github.com/valyala/fastjson v1.6.4
1818
go.opentelemetry.io/otel v1.35.0
@@ -74,6 +74,7 @@ require (
7474
github.com/json-iterator/go v1.1.12 // indirect
7575
github.com/klauspost/compress v1.18.0 // indirect
7676
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
77+
github.com/kylelemons/godebug v1.1.0 // indirect
7778
github.com/leodido/go-urn v1.4.0 // indirect
7879
github.com/lib/pq v1.10.9 // indirect
7980
github.com/mailru/easyjson v0.9.0 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMB
307307
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
308308
github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82 h1:6C8qej6f1bStuePVkLSFxoU22XBS165D3klxlzRg8F4=
309309
github.com/smacker/go-tree-sitter v0.0.0-20240827094217-dd81d9e9be82/go.mod h1:xe4pgH49k4SsmkQq5OT8abwhWmnzkhpgnXeekbx2efw=
310-
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250418172423-6b24a042d134 h1:4CdrrMDzdo9lf1oUi3rGKuprV11TmyUpVMM7fyPsqJA=
311-
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250418172423-6b24a042d134/go.mod h1:vHs/mPpAztdKJtzRKLnmLinmpS78fBh9sAuyKqQrQ+I=
310+
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250428140325-7ea957803c52 h1:s9Wu5Lp9pSOQmVIxHcon5RoFgqm77aO36FTTDTznzI4=
311+
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250428140325-7ea957803c52/go.mod h1:UGZVg18zzyJ1KimGM5SSmxG5jb7aCSq3OwQQKfhHGyE=
312312
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs=
313313
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA=
314314
github.com/smartcontractkit/libocr v0.0.0-20250220133800-f3b940c4f298 h1:PKiqnVOTChlH4a4ljJKL3OKGRgYfIpJS4YD1daAIKks=

integration-tests/go.mod

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ require (
5454
github.com/bits-and-blooms/bitset v1.13.0 // indirect
5555
github.com/blendle/zapdriver v1.3.1 // indirect
5656
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
57+
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
5758
github.com/buger/jsonparser v1.1.1 // indirect
5859
github.com/bytecodealliance/wasmtime-go/v23 v23.0.0 // indirect
5960
github.com/bytedance/sonic v1.11.6 // indirect
@@ -413,18 +414,4 @@ require (
413414
sigs.k8s.io/yaml v1.4.0 // indirect
414415
)
415416

416-
replace (
417-
github.com/btcsuite/btcd => github.com/btcsuite/btcd v0.22.1
418-
github.com/btcsuite/btcd/btcec/v2 => github.com/btcsuite/btcd/btcec/v2 v2.3.2
419-
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
420-
// until merged upstream: https://github.com/hashicorp/go-plugin/pull/257
421-
github.com/hashicorp/go-plugin => github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16
422-
423-
// until merged upstream: https://github.com/mitchellh/mapstructure/pull/343
424-
github.com/mitchellh/mapstructure v1.5.0 => github.com/nolag/mapstructure v1.5.2-0.20240625151721-90ea83a3f479
425-
426-
// until merged upstream: https://github.com/mwitkow/grpc-proxy/pull/69
427-
github.com/mwitkow/grpc-proxy => github.com/smartcontractkit/grpc-proxy v0.0.0-20230731113816-f1be6620749f
428-
429-
github.com/sourcegraph/sourcegraph/lib => github.com/sourcegraph/sourcegraph-public-snapshot/lib v0.0.0-20240822153003-c864f15af264
430-
)
417+
replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

integration-tests/go.sum

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,9 +182,9 @@ github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm
182182
github.com/bketelsen/crypt v0.0.4/go.mod h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
183183
github.com/blendle/zapdriver v1.3.1 h1:C3dydBOWYRiOk+B8X9IVZ5IOe+7cl+tGOexN4QqHfpE=
184184
github.com/blendle/zapdriver v1.3.1/go.mod h1:mdXfREi6u5MArG4j9fewC+FGnXaBR+T4Ox4J2u4eHCc=
185-
github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c=
186-
github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U=
187-
github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
185+
github.com/btcsuite/btcd v0.22.0-beta h1:LTDpDKUM5EeOFBPM8IXpinEcmZ6FWfNZbE3lfrfdnWo=
186+
github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ=
187+
github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04=
188188
github.com/btcsuite/btcd/btcutil v1.1.5 h1:+wER79R5670vs/ZusMTF1yTcRYE5GUsFbdjdisflzM8=
189189
github.com/btcsuite/btcd/btcutil v1.1.5/go.mod h1:PSZZ4UitpLBWzxGd5VGOrLnmOjtPP/a6HaFo12zMs00=
190190
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 h1:59Kx4K6lzOW5w6nFlA0v5+lk/6sjybR934QNHSJZPTQ=
@@ -697,6 +697,8 @@ github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJ
697697
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
698698
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
699699
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
700+
github.com/hashicorp/go-plugin v1.6.2 h1:zdGAEd0V1lCaU0u+MxWQhtSDQmahpkwOun8U8EiRVog=
701+
github.com/hashicorp/go-plugin v1.6.2/go.mod h1:CkgLQ5CZqNmdL9U9JzM532t8ZiYQ35+pj3b1FD37R0Q=
700702
github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
701703
github.com/hashicorp/go-retryablehttp v0.7.7 h1:C8hUCYzor8PIfXHa4UrZkU4VvK8o9ISHxT2Q8+VepXU=
702704
github.com/hashicorp/go-retryablehttp v0.7.7/go.mod h1:pkQpWZeYWskR+D1tR2O5OcBFOxfA7DoAO6xtkuQnHTk=
@@ -941,6 +943,8 @@ github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0Qu
941943
github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
942944
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
943945
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
946+
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
947+
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
944948
github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A=
945949
github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4=
946950
github.com/mmcloughlin/addchain v0.4.0 h1:SobOdjm2xLj1KkXN5/n0xTIWyZA2+s99UCY1iPfkHRY=
@@ -983,8 +987,6 @@ github.com/neelance/astrewrite v0.0.0-20160511093645-99348263ae86/go.mod h1:kHJE
983987
github.com/neelance/sourcemap v0.0.0-20200213170602-2833bce08e4c/go.mod h1:Qr6/a/Q4r9LP1IltGz7tA7iOK1WonHEYhu1HRBA7ZiM=
984988
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
985989
github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E=
986-
github.com/nolag/mapstructure v1.5.2-0.20240625151721-90ea83a3f479 h1:1jCGDLFXDOHF2sdeTJYKrIuSLGMpQZpgXXHNGXR5Ouk=
987-
github.com/nolag/mapstructure v1.5.2-0.20240625151721-90ea83a3f479/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
988990
github.com/nsf/jsondiff v0.0.0-20230430225905-43f6cf3098c1 h1:dOYG7LS/WK00RWZc8XGgcUTlTxpp3mKhdR2Q9z9HbXM=
989991
github.com/nsf/jsondiff v0.0.0-20230430225905-43f6cf3098c1/go.mod h1:mpRZBD8SJ55OIICQ3iWH0Yz3cjzA61JdqMLoWXeB2+8=
990992
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
@@ -1182,8 +1184,6 @@ github.com/smartcontractkit/chainlink/deployment v0.0.0-20241212003547-4aea6f720
11821184
github.com/smartcontractkit/chainlink/deployment v0.0.0-20241212003547-4aea6f720fb5/go.mod h1:ut8/pHBJ5LRLwmUwFKtCEfEt/TzWlCNiHqhCg2NYz1c=
11831185
github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212003547-4aea6f720fb5 h1:1trfQaUmre9ty3B7qxxFa3W0Oa98ui9a0drgEcDGmEs=
11841186
github.com/smartcontractkit/chainlink/v2 v2.0.0-20241212003547-4aea6f720fb5/go.mod h1:/mKFlgouU8Qf+c+N1NbfgEy+TSEgngcd1J96+QKA+KA=
1185-
github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16 h1:TFe+FvzxClblt6qRfqEhUfa4kFQx5UobuoFGO2W4mMo=
1186-
github.com/smartcontractkit/go-plugin v0.0.0-20240208201424-b3b91517de16/go.mod h1:lBS5MtSSBZk0SHc66KACcjjlU6WzEVP/8pwz68aMkCI=
11871187
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs=
11881188
github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA=
11891189
github.com/smartcontractkit/libocr v0.0.0-20241007185508-adbe57025f12 h1:NzZGjaqez21I3DU7objl3xExTH4fxYvzTqar8DC6360=

0 commit comments

Comments
 (0)