Skip to content

Commit

Permalink
server: remove deprecated UpgradeOldPrivValFile (#6079)
Browse files Browse the repository at this point in the history
* server: remove deprecated UpgradeOldPrivValFile

OldFilePV was deprecated in Tendermint Core v0.28 and will be removed in
upcoming v0.34.5 release.

* remove imports

* Add changelog entries

Co-authored-by: Aleksandr Bezobchuk <aleks.bezobchuk@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
  • Loading branch information
3 people committed Apr 27, 2020
1 parent 97e1c31 commit f0b72b9
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ older clients.

### API Breaking Changes

* [\#6079](https://github.com/cosmos/cosmos-sdk/pull/6079) Remove `UpgradeOldPrivValFile` (deprecated in Tendermint Core v0.28).
* (modules) [\#5664](https://github.com/cosmos/cosmos-sdk/pull/5664) Remove amino `Codec` from simulation `StoreDecoder`, which now returns a function closure in order to unmarshal the key-value pairs.
* (x/auth) [\#6029](https://github.com/cosmos/cosmos-sdk/pull/6029) Module accounts have been moved from `x/supply` to `x/auth`.
* (x/supply) [\#6010](https://github.com/cosmos/cosmos-sdk/pull/6010) All `x/supply` types and APIs have been moved to `x/bank`.
Expand Down
2 changes: 0 additions & 2 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ func startInProcess(ctx *Context, appCreator AppCreator) (*node.Node, error) {
return nil, err
}

UpgradeOldPrivValFile(cfg)

// create & start tendermint node
tmNode, err := node.NewNode(
cfg,
Expand Down
2 changes: 0 additions & 2 deletions server/tm_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func ShowValidatorCmd(ctx *Context) *cobra.Command {
Short: "Show this node's tendermint validator info",
RunE: func(cmd *cobra.Command, args []string) error {
cfg := ctx.Config
UpgradeOldPrivValFile(cfg)

privValidator := pvm.LoadOrGenFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile())
valPubKey, err := privValidator.GetPubKey()
Expand Down Expand Up @@ -77,7 +76,6 @@ func ShowAddressCmd(ctx *Context) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {

cfg := ctx.Config
UpgradeOldPrivValFile(cfg)
privValidator := pvm.LoadOrGenFilePV(
cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile())
valConsAddr := (sdk.ConsAddress)(privValidator.GetAddress())
Expand Down
11 changes: 0 additions & 11 deletions server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/tendermint/tendermint/libs/cli"
tmflags "github.com/tendermint/tendermint/libs/cli/flags"
"github.com/tendermint/tendermint/libs/log"
pvm "github.com/tendermint/tendermint/privval"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -217,16 +216,6 @@ func TrapSignal(cleanupFunc func()) {
}()
}

// UpgradeOldPrivValFile converts old priv_validator.json file (prior to Tendermint 0.28)
// to the new priv_validator_key.json and priv_validator_state.json files.
func UpgradeOldPrivValFile(config *cfg.Config) {
if _, err := os.Stat(config.OldPrivValidatorFile()); !os.IsNotExist(err) {
if oldFilePV, err := pvm.LoadOldFilePV(config.OldPrivValidatorFile()); err == nil {
oldFilePV.Upgrade(config.PrivValidatorKeyFile(), config.PrivValidatorStateFile())
}
}
}

func skipInterface(iface net.Interface) bool {
if iface.Flags&net.FlagUp == 0 {
return true // interface down
Expand Down
3 changes: 0 additions & 3 deletions x/genutil/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import (
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/privval"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/server"
)

// ExportGenesisFile creates and writes the genesis configuration to disk. An
Expand Down Expand Up @@ -54,7 +52,6 @@ func InitializeNodeValidatorFiles(config *cfg.Config) (nodeID string, valPubKey
}

nodeID = string(nodeKey.ID())
server.UpgradeOldPrivValFile(config)

pvKeyFile := config.PrivValidatorKeyFile()
if err := tmos.EnsureDir(filepath.Dir(pvKeyFile), 0777); err != nil {
Expand Down

0 comments on commit f0b72b9

Please sign in to comment.