Skip to content

Commit

Permalink
refactor: prune everything (#11177)
Browse files Browse the repository at this point in the history
(cherry picked from commit 75bcf47)

# Conflicts:
#	CHANGELOG.md
#	server/config/config.go
#	server/config/toml.go
#	server/start.go
#	store/rootmulti/store.go
#	store/types/pruning.go
#	store/v2/multi/store_test.go
  • Loading branch information
alexanderbez authored and mergify-bot committed Feb 23, 2022
1 parent 26d573e commit de6bf77
Show file tree
Hide file tree
Showing 7 changed files with 1,059 additions and 1 deletion.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,42 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes

<<<<<<< HEAD
* [#10725](https://github.com/cosmos/cosmos-sdk/pull/10725) populate `ctx.ConsensusParams` for begin/end blockers.
=======
* (store) [\#11177](https://github.com/cosmos/cosmos-sdk/pull/11177) Update the prune `nothing` strategy to store the last two heights.
* [\#10844](https://github.com/cosmos/cosmos-sdk/pull/10844) Automatic recovering non-consistent keyring storage during public key import.
* (store) [\#11117](https://github.com/cosmos/cosmos-sdk/pull/11117) Fix data race in store trace component
* (cli) [\#11065](https://github.com/cosmos/cosmos-sdk/pull/11065) Ensure the `tendermint-validator-set` query command respects the `-o` output flag.
* (grpc) [\#10985](https://github.com/cosmos/cosmos-sdk/pull/10992) The `/cosmos/tx/v1beta1/txs/{hash}` endpoint returns a 404 when a tx does not exist.
* (rosetta) [\#10340](https://github.com/cosmos/cosmos-sdk/pull/10340) Use `GenesisChunked(ctx)` instead `Genesis(ctx)` to get genesis block height
* [#10180](https://github.com/cosmos/cosmos-sdk/issues/10180) Documentation: make references to Cosmos SDK consistent
* [\#9651](https://github.com/cosmos/cosmos-sdk/pull/9651) Change inconsistent limit of `0` to `MaxUint64` on InfiniteGasMeter and add GasRemaining func to GasMeter.
* [\#9639](https://github.com/cosmos/cosmos-sdk/pull/9639) Check store keys length before accessing them by making sure that `key` is of length `m+1` (for `key[n:m]`)
* (types) [\#9627](https://github.com/cosmos/cosmos-sdk/pull/9627) Fix nil pointer panic on `NewBigIntFromInt`
* (x/genutil) [\#9574](https://github.com/cosmos/cosmos-sdk/pull/9575) Actually use the `gentx` client tx flags (like `--keyring-dir`)
* (x/distribution) [\#9599](https://github.com/cosmos/cosmos-sdk/pull/9599) Withdraw rewards event now includes a value attribute even if there are 0 rewards (due to situations like 100% commission).
* (x/genutil) [\#9638](https://github.com/cosmos/cosmos-sdk/pull/9638) Added missing validator key save when recovering from mnemonic
* [\#9762](https://github.com/cosmos/cosmos-sdk/pull/9762) The init command uses the chain-id from the client config if --chain-id is not provided
* [\#9854](https://github.com/cosmos/cosmos-sdk/pull/9854) Fixed the `make proto-gen` to get dynamic container name based on project name for the cosmos based sdks.
* [\#9980](https://github.com/cosmos/cosmos-sdk/pull/9980) Returning the error when the invalid argument is passed to bank query total supply cli.
* (server) [#10016](https://github.com/cosmos/cosmos-sdk/issues/10016) Fix marshaling of index-events into server config file.
* [\#10184](https://github.com/cosmos/cosmos-sdk/pull/10184) Fixed CLI tx commands to no longer explicitly require the chain-id flag as this value can come from a user config.
* [\#10239](https://github.com/cosmos/cosmos-sdk/pull/10239) Fixed x/bank/044 migrateDenomMetadata.
* (x/upgrade) [\#10189](https://github.com/cosmos/cosmos-sdk/issues/10189) Removed potential sources of non-determinism in upgrades
* [\#10258](https://github.com/cosmos/cosmos-sdk/issues/10258) Fixes issue related to segmentation fault on mac m1 arm64
* [\#10466](https://github.com/cosmos/cosmos-sdk/issues/10466) Fixes error with simulation tests when genesis start time is randomly created after the year 2262
* [\#10394](https://github.com/cosmos/cosmos-sdk/issues/10394) Fixes issue related to grpc-gateway of account balance by
ibc-denom.
* [\#10593](https://github.com/cosmos/cosmos-sdk/pull/10593) Update swagger-ui to v4.1.0 to fix xss vulnerability.
* [\#10842](https://github.com/cosmos/cosmos-sdk/pull/10842) Fix error when `--generate-only`, `--max-msgs` fags set while executing `WithdrawAllRewards` command.
* [\#10897](https://github.com/cosmos/cosmos-sdk/pull/10897) Fix: set a non-zero value on gas overflow.
* [#9790](https://github.com/cosmos/cosmos-sdk/pull/10687) Fix behavior of `DecCoins.MulDecTruncate`.
* [\#10990](https://github.com/cosmos/cosmos-sdk/pull/10990) Fixes missing `iavl-cache-size` config parsing in `GetConfig` method.
* (crypto) [#11027] Remove dependency on Tendermint core for xsalsa20symmetric.
* (x/authz) [\#10447](https://github.com/cosmos/cosmos-sdk/pull/10447) Fix authz `NewGrant` expiration check.
* (x/authz) [\#10633](https://github.com/cosmos/cosmos-sdk/pull/10633) Fixed authorization not found error when executing message.
>>>>>>> 75bcf47f1 (refactor: prune everything (#11177))
## [v0.42.11](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.42.11) - 2021-12-07

Expand Down
17 changes: 17 additions & 0 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,3 +245,20 @@ func GetConfig(v *viper.Viper) Config {
},
}
}
<<<<<<< HEAD
=======

// ValidateBasic returns an error if min-gas-prices field is empty in BaseConfig. Otherwise, it returns nil.
func (c Config) ValidateBasic() error {
if c.BaseConfig.MinGasPrices == "" {
return sdkerrors.ErrAppConfig.Wrap("set min gas price in app.toml or flag or env variable")
}
if c.Pruning == storetypes.PruningOptionEverything && c.StateSync.SnapshotInterval > 0 {
return sdkerrors.ErrAppConfig.Wrapf(
"cannot enable state sync snapshots with '%s' pruning setting", storetypes.PruningOptionEverything,
)
}

return nil
}
>>>>>>> 75bcf47f1 (refactor: prune everything (#11177))
5 changes: 5 additions & 0 deletions server/config/toml.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,13 @@ minimum-gas-prices = "{{ .BaseConfig.MinGasPrices }}"
# default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals
# nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node)
<<<<<<< HEAD
# everything: all saved states will be deleted, storing only the current state; pruning at 10 block intervals
# custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval'
=======
# everything: all saved states will be deleted, storing only the current and previous state; pruning at 10 block intervals
# custom: allow pruning options to be manually specified through 'pruning-keep-recent' and 'pruning-interval'
>>>>>>> 75bcf47f1 (refactor: prune everything (#11177))
pruning = "{{ .BaseConfig.Pruning }}"
# These are applied if and only if the pruning strategy is custom.
Expand Down
5 changes: 5 additions & 0 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,13 @@ For '--pruning' the options are as follows:
default: the last 100 states are kept in addition to every 500th state; pruning at 10 block intervals
nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node)
<<<<<<< HEAD
everything: all saved states will be deleted, storing only the current state; pruning at 10 block intervals
custom: allow pruning options to be manually specified through 'pruning-keep-recent', 'pruning-keep-every', and 'pruning-interval'
=======
everything: all saved states will be deleted, storing only the current and previous state; pruning at 10 block intervals
custom: allow pruning options to be manually specified through 'pruning-keep-recent' and 'pruning-interval'
>>>>>>> 75bcf47f1 (refactor: prune everything (#11177))
Node halting configurations exist in the form of two flags: '--halt-height' and '--halt-time'. During
the ABCI Commit phase, the node will check if the current block height is greater than or equal to
Expand Down
7 changes: 6 additions & 1 deletion store/rootmulti/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,17 @@ func (rs *Store) Commit() types.CommitID {
previousHeight = rs.lastCommitInfo.GetVersion()
version = previousHeight + 1
}
<<<<<<< HEAD
=======

rs.lastCommitInfo = commitStores(version, rs.stores, rs.removalMap)
>>>>>>> 75bcf47f1 (refactor: prune everything (#11177))

rs.lastCommitInfo = commitStores(version, rs.stores)

// Determine if pruneHeight height needs to be added to the list of heights to
// be pruned, where pruneHeight = (commitHeight - 1) - KeepRecent.
if int64(rs.pruningOpts.KeepRecent) < previousHeight {
if rs.pruningOpts.Interval > 0 && int64(rs.pruningOpts.KeepRecent) < previousHeight {
pruneHeight := previousHeight - int64(rs.pruningOpts.KeepRecent)
// We consider this height to be pruned iff:
//
Expand Down
6 changes: 6 additions & 0 deletions store/types/pruning.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ var (
PruneDefault = NewPruningOptions(100, 100, 10)

// PruneEverything defines a pruning strategy where all committed heights are
<<<<<<< HEAD
// deleted, storing only the current height and where to-be pruned heights are
// pruned at every 10th height.
PruneEverything = NewPruningOptions(0, 0, 10)
=======
// deleted, storing only the current and previous height and where to-be pruned
// heights are pruned at every 10th height.
PruneEverything = NewPruningOptions(2, 10)
>>>>>>> 75bcf47f1 (refactor: prune everything (#11177))

// PruneNothing defines a pruning strategy where all heights are kept on disk.
PruneNothing = NewPruningOptions(0, 1, 0)
Expand Down
Loading

0 comments on commit de6bf77

Please sign in to comment.