Skip to content

Commit

Permalink
Merge branch 'master' into bez/9590-x-bank-denom-reverse-idx
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez authored Jul 6, 2021
2 parents b2bc4f6 + bfa18c7 commit e2073ac
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (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

## [v0.43.0-rc0](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.43.0-rc0) - 2021-06-25

Expand Down
4 changes: 2 additions & 2 deletions x/auth/ante/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ func (sud SetUpContextDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate
switch rType := r.(type) {
case sdk.ErrorOutOfGas:
log := fmt.Sprintf(
"out of gas in location: %v; gasWanted: %d, gasUsed: %d",
rType.Descriptor, gasTx.GetGas(), newCtx.GasMeter().GasConsumed())
"insufficient gas, gasOffered: %d, gasRequired: %d, code location: %v",
gasTx.GetGas(), newCtx.GasMeter().GasConsumed(), rType.Descriptor)

err = sdkerrors.Wrap(sdkerrors.ErrOutOfGas, log)
default:
Expand Down
3 changes: 2 additions & 1 deletion x/genutil/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func InitializeNodeValidatorFiles(config *cfg.Config) (nodeID string, valPubKey
return InitializeNodeValidatorFilesFromMnemonic(config, "")
}

// InitializeNodeValidatorFiles creates private validator and p2p configuration files using the given mnemonic.
// InitializeNodeValidatorFilesFromMnemonic creates private validator and p2p configuration files using the given mnemonic.
// If no valid mnemonic is given, a random one will be used instead.
func InitializeNodeValidatorFilesFromMnemonic(config *cfg.Config, mnemonic string) (nodeID string, valPubKey cryptotypes.PubKey, err error) {
if len(mnemonic) > 0 && !bip39.IsMnemonicValid(mnemonic) {
Expand Down Expand Up @@ -84,6 +84,7 @@ func InitializeNodeValidatorFilesFromMnemonic(config *cfg.Config, mnemonic strin
} else {
privKey := tmed25519.GenPrivKeyFromSecret([]byte(mnemonic))
filePV = privval.NewFilePV(privKey, pvKeyFile, pvStateFile)
filePV.Save()
}

tmValPubKey, err := filePV.GetPubKey()
Expand Down
9 changes: 9 additions & 0 deletions x/genutil/utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package genutil

import (
"encoding/json"
tmed25519 "github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/privval"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -57,6 +59,13 @@ func TestInitializeNodeValidatorFilesFromMnemonic(t *testing.T) {
require.Error(t, err)
} else {
require.NoError(t, err)

if tt.mnemonic != "" {
actualPVFile := privval.LoadFilePV(cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile())
expectedPrivateKey := tmed25519.GenPrivKeyFromSecret([]byte(tt.mnemonic))
expectedFile := privval.NewFilePV(expectedPrivateKey, cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile())
require.Equal(t, expectedFile, actualPVFile)
}
}
})
}
Expand Down

0 comments on commit e2073ac

Please sign in to comment.