From 3b120ad6da601c990c9b28069f4464122ad12417 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 25 Jul 2024 16:34:36 -0600 Subject: [PATCH] Mark v1.19.1 and fix mainnet CLI queries. (#2108) * Look up the testnet flag the hard way when initially creating the root command. * Mark v1.19.1. * Add blurb. --- CHANGELOG.md | 13 +++++++++++++ cmd/provenanced/cmd/root.go | 19 +++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 997c6dfe6..3d1a801de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,19 @@ Ref: https://keepachangelog.com/en/1.0.0/ --- +## [v1.19.1](https://github.com/provenance-io/provenance/releases/tag/v1.19.1) - 2024-07-25 + +### Bug Fixes + +* Use the correct HRP in the CLI queries [#2108](https://github.com/provenance-io/provenance/issues/2108). + +### Full Commit History + +* https://github.com/provenance-io/provenance/compare/v1.19.0...v1.19.1 +* https://github.com/provenance-io/provenance/compare/v1.18.0...v1.19.1 + +--- + ## [v1.19.0](https://github.com/provenance-io/provenance/releases/tag/v1.19.0) - 2024-07-19 ### Features diff --git a/cmd/provenanced/cmd/root.go b/cmd/provenanced/cmd/root.go index 3bb1a5b96..2e4bc0947 100644 --- a/cmd/provenanced/cmd/root.go +++ b/cmd/provenanced/cmd/root.go @@ -64,8 +64,7 @@ func NewRootCmd(sealConfig bool) (*cobra.Command, params.EncodingConfig) { sdk.SetAddrCacheEnabled(false) defer sdk.SetAddrCacheEnabled(true) - // We initially set the config as testnet so commands that run before start work for testing such as gentx. - app.SetConfig(true, false) + app.SetConfig(isTestnetFlagSet(), false) tempApp := app.New(log.NewNopLogger(), dbm.NewMemDB(), nil, true, simtestutil.NewAppOptionsWithFlagHome(tempDir)) encodingConfig := tempApp.GetEncodingConfig() @@ -438,3 +437,19 @@ func getIAVLCacheSize(options servertypes.AppOptions) int { } return iavlCacheSize } + +// isTestnetFlagSet returns true if the command was invoked with the --testnet flag. +// This should be the same as viper.Get("testnet"), but can be used without needing +// to set up viper. +func isTestnetFlagSet() bool { + ev := os.Getenv("PIO_TESTNET") + if len(ev) > 0 { + return cast.ToBool(ev) + } + for _, arg := range os.Args[1:] { + if arg == "-t" || arg == "--testnet" { + return true + } + } + return false +}