Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pruning subcommand to provenance root cmd. #1209

Merged
merged 7 commits into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

* Updated Cosmos-SDK to v0.46.3-pio-4 (from v0.46.3-pio-1) [PR 1211](https://github.com/provenance-io/provenance/pull/1211).
* Improve CodeQL workflow to run on Go file changes only [#1225](https://github.com/provenance-io/provenance/issues/1225)
* Add prune command available though cosmos sdk to provenanced.[#1208](https://github.com/provenance-io/provenance/issues/1208).

### Bug Fixes

Expand Down
22 changes: 2 additions & 20 deletions cmd/provenanced/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ import (
"github.com/cosmos/cosmos-sdk/snapshots"
snapshottypes "github.com/cosmos/cosmos-sdk/snapshots/types"

"github.com/cosmos/cosmos-sdk/client/pruning"
"github.com/provenance-io/provenance/app"
"github.com/provenance-io/provenance/app/params"
"github.com/provenance-io/provenance/cmd/provenanced/config"
"github.com/provenance-io/provenance/internal/pioconfig"

"github.com/rs/zerolog"
"github.com/spf13/cast"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -172,7 +172,7 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) {

// Add Rosetta command
rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler))

rootCmd.AddCommand(pruning.PruningCmd(newApp))
// Disable usage when the start command returns an error.
startCmd, _, err := rootCmd.Find([]string{"start"})
if err != nil {
Expand Down Expand Up @@ -271,24 +271,6 @@ func newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts serverty
panic(err)
}

// Validate min-gas-price is a single coin.
arnabmitra marked this conversation as resolved.
Show resolved Hide resolved
if fee, err := sdk.ParseCoinNormalized(cast.ToString(appOpts.Get(server.FlagMinGasPrices))); err == nil {
if int(sdk.GetConfig().GetCoinType()) == app.CoinTypeMainNet {
// require the fee denom to match the bond denom on mainnet(still applies)
if fee.Denom != pioconfig.GetProvenanceConfig().FeeDenom {
panic(fmt.Errorf("invalid min-gas-price fee denom, must be: %s", pioconfig.GetProvenanceConfig().FeeDenom))
}
}
} else {
// panic if there was a parse error (for example more than one coin was passed in for required fee).
if err != nil {
panic(fmt.Errorf("invalid min-gas-price value, expected single decimal coin value such as '%s', got '%s';\n\n %w",
pioconfig.GetProvenanceConfig().ProvenanceMinGasPrices,
appOpts.Get(server.FlagMinGasPrices),
err))
}
}

snapshotOptions := snapshottypes.NewSnapshotOptions(
cast.ToUint64(appOpts.Get(server.FlagStateSyncSnapshotInterval)),
cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)),
Expand Down