-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(confix): add migration to v2 (#21052)
- Loading branch information
1 parent
3f22acc
commit e7b6d73
Showing
8 changed files
with
305 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
[comet] | ||
# min-retain-blocks defines the minimum block height offset from the current block being committed, such that all blocks past this offset are pruned from CometBFT. A value of 0 indicates that no blocks should be pruned. | ||
min-retain-blocks = 0 | ||
# index-events defines the set of events in the form {eventType}.{attributeKey}, which informs CometBFT what to index. If empty, all events will be indexed. | ||
index-events = [] | ||
# halt-height contains a non-zero block height at which a node will gracefully halt and shutdown that can be used to assist upgrades and testing. | ||
halt-height = 0 | ||
# halt-time contains a non-zero minimum block time (in Unix seconds) at which a node will gracefully halt and shutdown that can be used to assist upgrades and testing. | ||
halt-time = 0 | ||
# address defines the CometBFT RPC server address to bind to. | ||
address = 'tcp://127.0.0.1:26658' | ||
# transport defines the CometBFT RPC server transport protocol: socket, grpc | ||
transport = 'socket' | ||
# trace enables the CometBFT RPC server to output trace information about its internal operations. | ||
trace = false | ||
# standalone starts the application without the CometBFT node. The node should be started separately. | ||
standalone = false | ||
|
||
[grpc] | ||
# Enable defines if the gRPC server should be enabled. | ||
enable = true | ||
# Address defines the gRPC server address to bind to. | ||
address = 'localhost:9090' | ||
# MaxRecvMsgSize defines the max message size in bytes the server can receive. | ||
# The default value is 10MB. | ||
max-recv-msg-size = 10485760 | ||
# MaxSendMsgSize defines the max message size in bytes the server can send. | ||
# The default value is math.MaxInt32. | ||
max-send-msg-size = 2147483647 | ||
|
||
[store] | ||
# The type of database for application and snapshots databases. | ||
app-db-backend = 'goleveldb' | ||
|
||
[store.options] | ||
# State storage database type. Currently we support: 0 for SQLite, 1 for Pebble | ||
ss-type = 0 | ||
# State commitment database type. Currently we support:0 for iavl, 1 for iavl v2 | ||
sc-type = 0 | ||
|
||
# Pruning options for state storage | ||
[store.options.ss-pruning-option] | ||
# Number of recent heights to keep on disk. | ||
keep-recent = 2 | ||
# Height interval at which pruned heights are removed from disk. | ||
interval = 1 | ||
|
||
# Pruning options for state commitment | ||
[store.options.sc-pruning-option] | ||
# Number of recent heights to keep on disk. | ||
keep-recent = 2 | ||
# Height interval at which pruned heights are removed from disk. | ||
interval = 1 | ||
|
||
[store.options.iavl-config] | ||
# CacheSize set the size of the iavl tree cache. | ||
cache-size = 100000 | ||
# If true, the tree will work like no fast storage and always not upgrade fast storage. | ||
skip-fast-storage-upgrade = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This is a TOML config file. | ||
# For more information, see https://github.com/toml-lang/toml | ||
|
||
############################################################################### | ||
### Client Configuration ### | ||
############################################################################### | ||
|
||
# The network chain ID | ||
chain-id = "" | ||
# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory) | ||
keyring-backend = "test" | ||
# Default key name, if set, defines the default key to use for signing transaction when the --from flag is not specified | ||
keyring-default-keyname = "" | ||
# CLI output format (text|json) | ||
output = "text" | ||
# <host>:<port> to CometBFT RPC interface for this chain | ||
node = "tcp://localhost:26657" | ||
# Transaction broadcasting mode (sync|async) | ||
broadcast-mode = "sync" | ||
|
||
# gRPC server endpoint to which the client will connect. | ||
# It can be overwritten by the --grpc-addr flag in each command. | ||
grpc-address = "" | ||
|
||
# Allow the gRPC client to connect over insecure channels. | ||
# It can be overwritten by the --grpc-insecure flag in each command. | ||
grpc-insecure = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package confix | ||
|
||
import ( | ||
"sort" | ||
|
||
"github.com/creachadair/tomledit" | ||
"github.com/creachadair/tomledit/transform" | ||
) | ||
|
||
// MatchKeys diffs the keyspaces of the TOML documents in files lhs and rhs. | ||
// Comments, order, and values are ignored for comparison purposes. | ||
// It will return in the format of map[oldKey]newKey | ||
func MatchKeys(lhs, rhs *tomledit.Document) map[string]string { | ||
matches := matchDocs(map[string]string{}, allKVs(lhs.Global), allKVs(rhs.Global)) | ||
|
||
lsec, rsec := lhs.Sections, rhs.Sections | ||
transform.SortSectionsByName(lsec) | ||
transform.SortSectionsByName(rsec) | ||
|
||
i, j := 0, 0 | ||
for i < len(lsec) && j < len(rsec) { | ||
switch { | ||
case lsec[i].Name.Before(rsec[j].Name): | ||
i++ | ||
case rsec[j].Name.Before(lsec[i].Name): | ||
j++ | ||
default: | ||
matches = matchDocs(matches, allKVs(lsec[i]), allKVs(rsec[j])) | ||
i++ | ||
j++ | ||
} | ||
} | ||
|
||
return matches | ||
} | ||
|
||
// matchDocs get all the keys matching in lhs and rhs. | ||
// value of keys are ignored | ||
func matchDocs(matchesMap map[string]string, lhs, rhs []KV) map[string]string { | ||
sort.Slice(lhs, func(i, j int) bool { | ||
return lhs[i].Key < lhs[j].Key | ||
}) | ||
sort.Slice(rhs, func(i, j int) bool { | ||
return rhs[i].Key < rhs[j].Key | ||
}) | ||
|
||
i, j := 0, 0 | ||
for i < len(lhs) && j < len(rhs) { | ||
switch { | ||
case lhs[i].Key < rhs[j].Key: | ||
i++ | ||
case lhs[i].Key > rhs[j].Key: | ||
j++ | ||
default: | ||
// key exists in both lhs and rhs | ||
matchesMap[lhs[i].Key] = rhs[j].Key | ||
i++ | ||
j++ | ||
} | ||
} | ||
|
||
return matchesMap | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.