-
Notifications
You must be signed in to change notification settings - Fork 879
Expand file tree
/
Copy pathtoml.go
More file actions
149 lines (117 loc) · 7.21 KB
/
toml.go
File metadata and controls
149 lines (117 loc) · 7.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
package config
// StateCommitConfigTemplate defines the configuration template for state-commit
const StateCommitConfigTemplate = `
###############################################################################
### State Commit Configuration ###
###############################################################################
[state-commit]
# Enable defines if the SeiDB state-commit should be enabled.
sc-enable = {{ .StateCommit.Enable }}
# Defines the SC store directory, if not explicitly set, default to application home directory
sc-directory = "{{ .StateCommit.Directory }}"
# Max concurrent historical proof queries (RPC /store path)
sc-historical-proof-max-inflight = {{ .StateCommit.HistoricalProofMaxInFlight }}
# Historical proof query rate limit in req/sec (<=0 disables rate limiting)
sc-historical-proof-rate-limit = {{ .StateCommit.HistoricalProofRateLimit }}
# Historical proof query burst size
sc-historical-proof-burst = {{ .StateCommit.HistoricalProofBurst }}
# AsyncCommitBuffer defines the size of asynchronous commit queue, this greatly improve block catching-up
# performance, setting to 0 means synchronous commit.
sc-async-commit-buffer = {{ .StateCommit.MemIAVLConfig.AsyncCommitBuffer }}
# KeepRecent defines how many state-commit snapshots (besides the latest one) to keep
# defaults to 0 to only keep one current snapshot
sc-keep-recent = {{ .StateCommit.MemIAVLConfig.SnapshotKeepRecent }}
# SnapshotInterval defines the block interval the snapshot is taken, default to 10000 blocks.
sc-snapshot-interval = {{ .StateCommit.MemIAVLConfig.SnapshotInterval }}
# SnapshotMinTimeInterval defines the minimum time interval (in seconds) between snapshots.
# This prevents excessive snapshot creation during catch-up and ensures snapshots don't overlap
# (current snapshot creation takes 3+ hours). Default to 3600 seconds (1 hour).
# Note: If you set a small sc-snapshot-interval (e.g., < 5000), you may want to reduce this value
# to allow more frequent snapshots during normal operation.
sc-snapshot-min-time-interval = {{ .StateCommit.MemIAVLConfig.SnapshotMinTimeInterval }}
# SnapshotPrefetchThreshold defines the page cache residency threshold (0.0-1.0) to trigger snapshot prefetch.
# Prefetch sequentially reads nodes/leaves files into page cache for faster cold-start replay.
# Only active trees (evm/bank/acc/wasm) are prefetched, skipping sparse kv files to save memory.
# Skips prefetch if more than threshold of pages already resident (e.g., 0.8 = 80%).
# Defaults to 0.8
sc-snapshot-prefetch-threshold = {{ .StateCommit.MemIAVLConfig.SnapshotPrefetchThreshold }}
# Maximum snapshot write rate in MB/s (global across all trees). 0 = unlimited. Default 100.
sc-snapshot-write-rate-mbps = {{ .StateCommit.MemIAVLConfig.SnapshotWriteRateMBps }}
###############################################################################
### FlatKV (EVM) Configuration ###
###############################################################################
[state-commit.flatkv]
# Fsync controls whether PebbleDB writes (data DBs + metadataDB) use fsync.
# WAL always uses NoSync (matching memiavl); crash recovery relies on
# WAL catchup, which is idempotent. Default: false.
fsync = {{ .StateCommit.FlatKVConfig.Fsync }}
# AsyncWriteBuffer defines the size of the async write buffer for data DBs.
# Set <= 0 for synchronous writes.
async-write-buffer = {{ .StateCommit.FlatKVConfig.AsyncWriteBuffer }}
# SnapshotInterval defines how often (in blocks) a PebbleDB checkpoint is taken.
# 0 disables auto-snapshots. Default: 10000.
snapshot-interval = {{ .StateCommit.FlatKVConfig.SnapshotInterval }}
# SnapshotKeepRecent defines how many old snapshots to keep besides the latest one.
# 0 = keep only the current snapshot. Default: 2.
snapshot-keep-recent = {{ .StateCommit.FlatKVConfig.SnapshotKeepRecent }}
`
// StateStoreConfigTemplate defines the configuration template for state-store
const StateStoreConfigTemplate = `
###############################################################################
### State Store Configuration ###
###############################################################################
[state-store]
# Enable defines whether the state-store should be enabled for storing historical data.
# Supporting historical queries or exporting state snapshot requires setting this to true
# This config only take effect when SeiDB is enabled (sc-enable = true)
ss-enable = {{ .StateStore.Enable }}
# Defines the directory to store the state store db files
# If not explicitly set, default to application home directory
ss-db-directory = "{{ .StateStore.DBDirectory }}"
# DBBackend defines the backend database used for state-store.
# Supported backends: pebbledb, rocksdb
# defaults to pebbledb (recommended)
ss-backend = "{{ .StateStore.Backend }}"
# AsyncWriteBuffer defines the async queue length for commits to be applied to State Store
# Set <= 0 for synchronous writes, which means commits also need to wait for data to be persisted in State Store.
# defaults to 100 for asynchronous writes
ss-async-write-buffer = {{ .StateStore.AsyncWriteBuffer }}
# KeepRecent defines the number of versions to keep in state store
# Setting it to 0 means keep everything
# Default to keep the last 100,000 blocks
ss-keep-recent = {{ .StateStore.KeepRecent }}
# PruneInterval defines the minimum interval in seconds + some random delay to trigger SS pruning.
# It is recommended to trigger pruning less frequently with a large interval.
# default to 600 seconds
ss-prune-interval = {{ .StateStore.PruneIntervalSeconds }}
# ImportNumWorkers defines the concurrency for state sync import
# defaults to 1
ss-import-num-workers = {{ .StateStore.ImportNumWorkers }}
`
// ReceiptStoreConfigTemplate defines the configuration template for receipt-store
const ReceiptStoreConfigTemplate = `
###############################################################################
### Receipt Store Configuration ###
###############################################################################
[receipt-store]
# Backend defines the receipt store backend.
# Supported backends: pebble (aka pebbledb), parquet
# defaults to pebbledb
rs-backend = "{{ .ReceiptStore.Backend }}"
# Defines the receipt store directory. If unset, defaults to <home>/data/ledger/receipt/{backend}
db-directory = "{{ .ReceiptStore.DBDirectory }}"
# AsyncWriteBuffer defines the async queue length for commits to be applied to receipt store.
# Applies only when rs-backend = "pebbledb"; parquet ignores this setting.
# Set <= 0 for synchronous writes.
# defaults to 100
async-write-buffer = {{ .ReceiptStore.AsyncWriteBuffer }}
# KeepRecent defines the number of versions to keep in receipt store
# Setting it to 0 means keep everything.
# Default to keep the last 100,000 blocks
keep-recent = {{ .ReceiptStore.KeepRecent }}
# PruneIntervalSeconds defines the interval in seconds to trigger pruning.
# defaults to 600 seconds
prune-interval-seconds = {{ .ReceiptStore.PruneIntervalSeconds }}
`
// DefaultConfigTemplate combines both templates for backward compatibility
const DefaultConfigTemplate = StateCommitConfigTemplate + StateStoreConfigTemplate + ReceiptStoreConfigTemplate