Skip to content

Commit

Permalink
Add pruning subcommand to provenance root cmd. (#1209)
Browse files Browse the repository at this point in the history
* Add pruning subcommand to provenance root cmd.

* We already check that a floor gas fee is paid by every tx, hence i think the validation check for min-gas-price is irrelevant now, and an ante handler already checks that flag if some node wants to enforce higher gas price at node/mempool level already.(min_gas_prices_decorator.go)

* Adding changelog.
  • Loading branch information
arnabmitra authored Nov 15, 2022
1 parent 87e8932 commit 9c7e293
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
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.
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

0 comments on commit 9c7e293

Please sign in to comment.