Skip to content

Commit 33a1528

Browse files
committed
relay/config: config enhancements
1 parent bb7e84a commit 33a1528

26 files changed

+1356
-853
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/filepath"
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(filepath.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.20250430133340-d04a3b64e331
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.20250430133340-d04a3b64e331 h1:+bN5yuawZeQeVw7vG+Me7kXLFK1vcesVeku3mdgRwqI=
311+
github.com/smartcontractkit/chainlink-common v0.7.1-0.20250430133340-d04a3b64e331/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=

0 commit comments

Comments
 (0)