diff --git a/UPGRADING.md b/UPGRADING.md index 90827854d845..7a1f2118a926 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -72,7 +72,7 @@ More information about [confix](https://docs.cosmos.network/main/tooling/confix) #### gRPC-Web -gRPC-Web is now listening to the same address as the gRPC Gateway API server (default: `localhost:1317`). +gRPC-Web is now listening to the same address and port as the gRPC Gateway API server (default: `localhost:1317`). The possibility to listen to a different address has been removed, as well as its settings. Use `confix` to clean-up your `app.toml`. A nginx (or alike) reverse-proxy can be set to keep the previous behavior. diff --git a/tools/confix/data/v0.47-app.toml b/tools/confix/data/v0.47-app.toml index 6f26abc13c09..c45f5f246bdd 100644 --- a/tools/confix/data/v0.47-app.toml +++ b/tools/confix/data/v0.47-app.toml @@ -59,8 +59,7 @@ inter-block-cache = true # ["message.sender", "message.recipient"] index-events = [] -# IavlCacheSize set the size of the iavl tree cache. -# Default cache size is 50mb. +# IavlCacheSize set the size of the iavl tree cache (in number of nodes). iavl-cache-size = 781250 # IAVLDisableFastNode enables or disables the fast node feature of IAVL. @@ -141,6 +140,42 @@ rpc-max-body-bytes = 1000000 # EnableUnsafeCORS defines if CORS should be enabled (unsafe - use it at your own risk). enabled-unsafe-cors = false +############################################################################### +### Rosetta Configuration ### +############################################################################### + +[rosetta] + +# Enable defines if the Rosetta API server should be enabled. +enable = false + +# Address defines the Rosetta API server to listen on. +address = ":8080" + +# Network defines the name of the blockchain that will be returned by Rosetta. +blockchain = "app" + +# Network defines the name of the network that will be returned by Rosetta. +network = "network" + +# Retries defines the number of retries when connecting to the node before failing. +retries = 3 + +# Offline defines if Rosetta server should run in offline mode. +offline = false + +# EnableDefaultSuggestedFee defines if the server should suggest fee by default. +# If 'construction/medata' is called without gas limit and gas price, +# suggested fee based on gas-to-suggest and denom-to-suggest will be given. +enable-fee-suggestion = false + +# GasToSuggest defines gas limit when calculating the fee +gas-to-suggest = 200000 + +# DenomToSuggest defines the defult denom for fee suggestion. +# Price must be in minimum-gas-prices. +denom-to-suggest = "uatom" + ############################################################################### ### gRPC Configuration ### ############################################################################### @@ -233,4 +268,4 @@ max-txs = "5000" query_gas_limit = 300000 # This is the number of wasm vm instances we keep cached in memory for speed-up # Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally -lru_size = 0 +lru_size = 0 \ No newline at end of file diff --git a/tools/confix/diff.go b/tools/confix/diff.go index 9abc4cd87aff..6cb3ea048bdc 100644 --- a/tools/confix/diff.go +++ b/tools/confix/diff.go @@ -10,9 +10,11 @@ import ( "github.com/creachadair/tomledit/transform" ) +type DiffType string + const ( - Section = "S" - Mapping = "M" + Section DiffType = "S" + Mapping DiffType = "M" ) type KV struct { @@ -22,7 +24,7 @@ type KV struct { } type Diff struct { - Type string // "section" or "mapping" + Type DiffType Deleted bool KV KV @@ -41,7 +43,6 @@ func DiffKeys(lhs, rhs *tomledit.Document) []Diff { i, j := 0, 0 for i < len(lsec) && j < len(rsec) { switch { - case lsec[i].Name.Before(rsec[j].Name): diff = append(diff, Diff{Type: Section, Deleted: true, KV: KV{Key: lsec[i].Name.String()}}) for _, kv := range allKVs(lsec[i]) { diff --git a/tools/confix/migrations.go b/tools/confix/migrations.go index 254fb9fa2dc4..d5347c9bc301 100644 --- a/tools/confix/migrations.go +++ b/tools/confix/migrations.go @@ -51,12 +51,13 @@ func PlanBuilder(from *tomledit.Document, to string) transform.Plan { step = transform.Step{ Desc: fmt.Sprintf("add %s section", kv.Key), T: transform.Func(func(_ context.Context, doc *tomledit.Document) error { + title := fmt.Sprintf("### %s Configuration ###", strings.Title(kv.Key)) doc.Sections = append(doc.Sections, &tomledit.Section{ Heading: &parser.Heading{ Block: parser.Comments{ - "###############################################################################", - fmt.Sprintf("### %s Configuration ###", strings.Title(kv.Key)), - "###############################################################################", + strings.Repeat("#", len(title)), + title, + strings.Repeat("#", len(title)), }, Name: keys, }, @@ -77,9 +78,9 @@ func PlanBuilder(from *tomledit.Document, to string) transform.Plan { } else if len(keys) > 1 { step = transform.Step{ Desc: fmt.Sprintf("add %s key", kv.Key), - T: transform.EnsureKey(parser.Key{keys[0]}, &parser.KeyValue{ + T: transform.EnsureKey(keys[0:len(keys)-1], &parser.KeyValue{ Block: kv.Block, - Name: parser.Key{keys[1]}, + Name: parser.Key{keys[len(keys)-1]}, Value: parser.MustValue(kv.Value), }), } @@ -90,16 +91,20 @@ func PlanBuilder(from *tomledit.Document, to string) transform.Plan { } else { if diff.Type == Section { deletedSections[kv.Key] = true - } - - // when the whole section is deleted we don't need to remove the keys - if len(keys) > 1 && deletedSections[keys[0]] { - continue - } + step = transform.Step{ + Desc: fmt.Sprintf("remove %s section", kv.Key), + T: transform.Remove(keys), + } + } else { + // when the whole section is deleted we don't need to remove the keys + if len(keys) > 1 && deletedSections[keys[0]] { + continue + } - step = transform.Step{ - Desc: fmt.Sprintf("remove %s key", kv.Key), - T: transform.Remove(keys), + step = transform.Step{ + Desc: fmt.Sprintf("remove %s key", kv.Key), + T: transform.Remove(keys), + } } } diff --git a/tools/confix/upgrade.go b/tools/confix/upgrade.go index 203410d163e5..1c01d6fbc22e 100644 --- a/tools/confix/upgrade.go +++ b/tools/confix/upgrade.go @@ -83,7 +83,7 @@ func CheckValid(fileName string, data []byte) error { } if err := cfg.ValidateBasic(); err != nil { - return fmt.Errorf("server config invalid : %w", err) + return fmt.Errorf("server config invalid: %w", err) } case strings.HasSuffix(fileName, ClientConfig): var cfg clientcfg.ClientConfig diff --git a/tools/confix/upgrade_test.go b/tools/confix/upgrade_test.go index e2f1d8e21c08..e3f8f094ec34 100644 --- a/tools/confix/upgrade_test.go +++ b/tools/confix/upgrade_test.go @@ -18,10 +18,6 @@ func mustReadConfig(t *testing.T, path string) []byte { return f } -func TestUpgrade(t *testing.T) { - // TODO: add more test cases -} - func TestCheckValid(t *testing.T) { err := confix.CheckValid("foo", []byte{}) assert.ErrorContains(t, err, "unknown config")