Skip to content

Commit e65e50e

Browse files
committed
relay/config: config enhancements
1 parent ac02b03 commit e65e50e

29 files changed

Lines changed: 751 additions & 270 deletions

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: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
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+
//go:embed CONFIG.md
13+
var configMD string
14+
15+
func TestConfigDocs(t *testing.T) {
16+
cfg, err := config.GenerateDocs()
17+
assert.NoError(t, err, "invalid config docs")
18+
assert.Equal(t, configMD, cfg, "CONFIG.md is out of date. Run 'go generate .' to regenerate.")
19+
}

gen.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ package aptos
4545

4646
//go:generate go run ./cmd/bindgen --input ./contracts/platform_secondary/sources/forwarder.move --output ./bindings/platform_secondary/forwarder
4747
//go:generate go run ./cmd/bindgen --input ./contracts/platform_secondary/sources/storage.move --output ./bindings/platform_secondary/storage
48+
49+
//go:generate go run ./cmd/config-docs -o CONFIG.md

0 commit comments

Comments
 (0)