From c904b157eb2adabe1b1d15d63b3a013438df18e7 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Sat, 12 Feb 2022 11:15:29 -0500 Subject: [PATCH 1/6] updates --- server/config/toml.go | 2 +- server/start.go | 2 +- store/types/pruning.go | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/config/toml.go b/server/config/toml.go index 1da82593ce63..f0f4ce5c88d0 100644 --- a/server/config/toml.go +++ b/server/config/toml.go @@ -24,7 +24,7 @@ minimum-gas-prices = "{{ .BaseConfig.MinGasPrices }}" # default: the last 362880 states are kept, pruning at 10 block intervals # nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) -# everything: all saved states will be deleted, storing only the current state; pruning at 10 block intervals +# 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' pruning = "{{ .BaseConfig.Pruning }}" diff --git a/server/start.go b/server/start.go index 45d7c920ea5d..e63ae2732649 100644 --- a/server/start.go +++ b/server/start.go @@ -83,7 +83,7 @@ For '--pruning' the options are as follows: default: the last 362880 states are kept, pruning at 10 block intervals nothing: all historic states will be saved, nothing will be deleted (i.e. archiving node) -everything: all saved states will be deleted, storing only the current state; pruning at 10 block intervals +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' Node halting configurations exist in the form of two flags: '--halt-height' and '--halt-time'. During diff --git a/store/types/pruning.go b/store/types/pruning.go index 774f806fe1c2..aa5a2fb59b32 100644 --- a/store/types/pruning.go +++ b/store/types/pruning.go @@ -21,8 +21,8 @@ var ( PruneDefault = NewPruningOptions(362880, 10) // PruneEverything defines a pruning strategy where all committed heights are - // deleted, storing only the current height and where to-be pruned heights are - // pruned at every 10th height. + // deleted, storing only the current and previous height and where to-be pruned + // heights are pruned at every 10th height. PruneEverything = NewPruningOptions(0, 10) // PruneNothing defines a pruning strategy where all heights are kept on disk. From eb8079f76cda3caa4bc4592de56728ee940fa1c2 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Sat, 12 Feb 2022 12:33:27 -0500 Subject: [PATCH 2/6] updates --- store/rootmulti/store.go | 3 ++- store/types/pruning.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/store/rootmulti/store.go b/store/rootmulti/store.go index bd73c2fb774e..5a64903cd59c 100644 --- a/store/rootmulti/store.go +++ b/store/rootmulti/store.go @@ -410,6 +410,7 @@ func (rs *Store) Commit() types.CommitID { previousHeight = rs.lastCommitInfo.GetVersion() version = previousHeight + 1 } + rs.lastCommitInfo = commitStores(version, rs.stores, rs.removalMap) // remove remnants of removed stores @@ -426,7 +427,7 @@ func (rs *Store) Commit() types.CommitID { // 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) rs.pruneHeights = append(rs.pruneHeights, pruneHeight) } diff --git a/store/types/pruning.go b/store/types/pruning.go index aa5a2fb59b32..3dd05b02bd12 100644 --- a/store/types/pruning.go +++ b/store/types/pruning.go @@ -23,7 +23,7 @@ var ( // PruneEverything defines a pruning strategy where all committed heights are // deleted, storing only the current and previous height and where to-be pruned // heights are pruned at every 10th height. - PruneEverything = NewPruningOptions(0, 10) + PruneEverything = NewPruningOptions(2, 10) // PruneNothing defines a pruning strategy where all heights are kept on disk. PruneNothing = NewPruningOptions(0, 0) From b898619c24d5aea6a98aa791ba0e80af3cae6e8b Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Sat, 12 Feb 2022 12:34:29 -0500 Subject: [PATCH 3/6] cl++ --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 825f34e63ec4..77daa5e82ca2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -166,6 +166,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (store) [\#11177](https://github.com/cosmos/cosmos-sdk/pull/11177) Update the prune `nothing` strategy to store the last two heights. * (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. From 6d0fadd7e8c56da11b3ea02a3433d33f6993db2a Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 22 Feb 2022 12:07:10 -0500 Subject: [PATCH 4/6] fix tests --- store/v2/multi/store_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/v2/multi/store_test.go b/store/v2/multi/store_test.go index 49904829aee1..aa42abf7ea1c 100644 --- a/store/v2/multi/store_test.go +++ b/store/v2/multi/store_test.go @@ -400,7 +400,7 @@ func TestPruning(t *testing.T) { }{ {types.PruningOptions{2, 10}, []uint64{8, 9, 10}}, {types.PruningOptions{0, 10}, []uint64{10}}, - {types.PruneEverything, []uint64{10}}, + {types.PruneEverything, []uint64{8, 9, 10}}, {types.PruneNothing, []uint64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}, } From b614469fd25fb730ce5affecbf34eba27c32fabb Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 22 Feb 2022 12:08:32 -0500 Subject: [PATCH 5/6] fix conflicts --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22a17d0902cd..243643441aeb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -174,6 +174,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes * (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. From 22a10af138b6a1a4ad4283e933b7365ef4c9e721 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 22 Feb 2022 12:38:07 -0500 Subject: [PATCH 6/6] updsates --- server/config/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/config/config.go b/server/config/config.go index 2c16c57baf10..64262c37ac47 100644 --- a/server/config/config.go +++ b/server/config/config.go @@ -318,6 +318,11 @@ 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 }