Skip to content

Commit

Permalink
Update to tendermint v0.22.6 (#1798)
Browse files Browse the repository at this point in the history
* Update to tendermint v0.22.6

- This was cherry-picked and fixed from develop
- Updates all crypto imports for changes from v0.22.5
  • Loading branch information
ValarDragon authored and ebuchman committed Jul 25, 2018
1 parent 029da74 commit eb032a4
Show file tree
Hide file tree
Showing 42 changed files with 230 additions and 147 deletions.
39 changes: 23 additions & 16 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

[[override]]
name = "github.com/tendermint/tendermint"
version = "=0.22.2"
version = "=v0.22.6"

[[constraint]]
name = "github.com/bartekn/go-bip39"
Expand Down
54 changes: 54 additions & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## PENDING

BREAKING CHANGES
* Update to tendermint v0.22.5. This involves changing all of the cryptography imports. [Ref](https://github.com/tendermint/tendermint/pull/1966)
* [baseapp] Msgs are no longer run on CheckTx, removed `ctx.IsCheckTx()`
* [x/gov] CLI flag changed from `proposalID` to `proposal-id`
* [x/stake] Fixed the period check for the inflation calculation
* [x/stake] Inflation doesn't use rationals in calculation (performance boost)
* [x/stake] CLI flags for identity changed from `--keybase-sig` to `--identity`, effects:
* `gaiacli stake create-validator`
* `gaiacli stake edit-validator`
* [baseapp] NewBaseApp constructor now takes sdk.TxDecoder as argument instead of wire.Codec
* [x/auth] Default TxDecoder can be found in `x/auth` rather than baseapp
* \#1606 The following CLI commands have been switched to use `--from`
* `gaiacli stake create-validator --address-validator`
* `gaiacli stake edit-validator --address-validator`
* `gaiacli stake delegate --address-delegator`
* `gaiacli stake unbond begin --address-delegator`
* `gaiacli stake unbond complete --address-delegator`
* `gaiacli stake redelegate begin --address-delegator`
* `gaiacli stake redelegate complete --address-delegator`
* `gaiacli stake unrevoke [validator-address]`
* `gaiacli gov submit-proposal --proposer`
* `gaiacli gov deposit --depositer`
* `gaiacli gov vote --voter`
* [x/gov] Added tags sub-package, changed tags to use dash-case

FEATURES
* [lcd] Can now query governance proposals by ProposalStatus
* [x/mock/simulation] Randomized simulation framework
* Modules specify invariants and operations, preferably in an x/[module]/simulation package
* Modules can test random combinations of their own operations
* Applications can integrate operations and invariants from modules together for an integrated simulation
* [baseapp] Initialize validator set on ResponseInitChain
* [cosmos-sdk-cli] Added support for cosmos-sdk-cli tool under cosmos-sdk/cmd
* This allows SDK users to initialize a new project repository.
* [tests] Remotenet commands for AWS (awsnet)

IMPROVEMENTS
* [baseapp] Allow any alphanumeric character in route
* [cli] Improve error messages for all txs when the account doesn't exist
* [tools] Remove `rm -rf vendor/` from `make get_vendor_deps`
* [x/auth] Recover ErrorOutOfGas panic in order to set sdk.Result attributes correctly
* [x/stake] Add revoked to human-readable validator
* [tests] Add tests to example apps in docs
* [x/gov] Votes on a proposal can now be queried
* [x/bank] Unit tests are now table-driven
* [tests] Fixes ansible scripts to work with AWS too

BUG FIXES
* \#1666 Add intra-tx counter to the genesis validators
* \#1797 Fix off-by-one error in slashing for downtime
* \#1787 Fixed bug where Tally fails due to revoked/unbonding validator
* \#1766 Fixes bad example for keybase identity
5 changes: 3 additions & 2 deletions client/lcd/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
tmcfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/libs/cli"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
Expand Down Expand Up @@ -119,7 +120,7 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress
for i := 1; i < nValidators; i++ {
genDoc.Validators = append(genDoc.Validators,
tmtypes.GenesisValidator{
PubKey: crypto.GenPrivKeyEd25519().PubKey(),
PubKey: ed25519.GenPrivKey().PubKey(),
Power: 1,
Name: "val",
},
Expand Down Expand Up @@ -151,7 +152,7 @@ func InitializeTestLCD(t *testing.T, nValidators int, initAddrs []sdk.AccAddress

appState, err := wire.MarshalJSONIndent(cdc, genesisState)
require.NoError(t, err)
genDoc.AppStateJSON = appState
genDoc.AppState = appState

// LCD listen address
var listenAddr string
Expand Down
4 changes: 2 additions & 2 deletions cmd/gaia/app/genesis_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
)

func TestToAccount(t *testing.T) {
priv := crypto.GenPrivKeyEd25519()
priv := ed25519.GenPrivKey()
addr := sdk.AccAddress(priv.PubKey().Address())
authAcc := auth.NewBaseAccountWithAddress(addr)
genAcc := NewGenesisAccount(&authAcc)
Expand Down
7 changes: 4 additions & 3 deletions cmd/gaia/cmd/gaiadebug/hack.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"

cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tendermint/libs/db"
"github.com/tendermint/tendermint/libs/log"
Expand Down Expand Up @@ -94,9 +95,9 @@ func runHackCmd(cmd *cobra.Command, args []string) error {
}
}

func base64ToPub(b64 string) crypto.PubKeyEd25519 {
func base64ToPub(b64 string) ed25519.PubKeyEd25519 {
data, _ := base64.StdEncoding.DecodeString(b64)
var pubKey crypto.PubKeyEd25519
var pubKey ed25519.PubKeyEd25519
copy(pubKey[:], data)
return pubKey

Expand Down
5 changes: 3 additions & 2 deletions cmd/gaia/cmd/gaiadebug/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
)

func init() {
Expand Down Expand Up @@ -116,11 +117,11 @@ func runPubKeyCmd(cmd *cobra.Command, args []string) error {
}
}

var pubKey crypto.PubKeyEd25519
var pubKey ed25519.PubKeyEd25519
if pubKeyI == nil {
copy(pubKey[:], pubkeyBytes)
} else {
pubKey = pubKeyI.(crypto.PubKeyEd25519)
pubKey = pubKeyI.(ed25519.PubKeyEd25519)
pubkeyBytes = pubKey[:]
}

Expand Down
4 changes: 2 additions & 2 deletions crypto/amino.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package crypto

import (
"github.com/tendermint/go-amino"
tcrypto "github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/encoding/amino"
)

var cdc = amino.NewCodec()

func init() {
RegisterAmino(cdc)
tcrypto.RegisterAmino(cdc)
cryptoAmino.RegisterAmino(cdc)
}

// RegisterAmino registers all go-crypto related types in the given (amino) codec.
Expand Down
9 changes: 6 additions & 3 deletions crypto/encode_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
package crypto

import (
"github.com/stretchr/testify/require"
"os"
"testing"

"github.com/stretchr/testify/require"

tcrypto "github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/crypto/secp256k1"
)

type byter interface {
Expand Down Expand Up @@ -62,12 +65,12 @@ func TestKeyEncodings(t *testing.T) {
privSize, pubSize int // binary sizes with the amino overhead
}{
{
privKey: tcrypto.GenPrivKeyEd25519(),
privKey: ed25519.GenPrivKey(),
privSize: 69,
pubSize: 37,
},
{
privKey: tcrypto.GenPrivKeySecp256k1(),
privKey: secp256k1.GenPrivKey(),
privSize: 37,
pubSize: 38,
},
Expand Down
5 changes: 3 additions & 2 deletions crypto/keys/hd/fundraiser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/stretchr/testify/require"

"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/secp256k1"
)

type addrData struct {
Expand Down Expand Up @@ -57,7 +58,7 @@ func TestFundraiserCompatibility(t *testing.T) {
master, ch := ComputeMastersFromSeed(seed)
priv, err := DerivePrivateKeyForPath(master, ch, "44'/118'/0'/0/0")
require.NoError(t, err)
pub := crypto.PrivKeySecp256k1(priv).PubKey()
pub := secp256k1.PrivKeySecp256k1(priv).PubKey()

t.Log("\tNODEJS GOLANG\n")
t.Logf("SEED \t%X %X\n", seedB, seed)
Expand All @@ -70,7 +71,7 @@ func TestFundraiserCompatibility(t *testing.T) {
require.Equal(t, priv[:], privB, "Expected priv keys to match")
var pubBFixed [33]byte
copy(pubBFixed[:], pubB)
require.Equal(t, pub, crypto.PubKeySecp256k1(pubBFixed), fmt.Sprintf("Expected pub keys to match for %d", i))
require.Equal(t, pub, secp256k1.PubKeySecp256k1(pubBFixed), fmt.Sprintf("Expected pub keys to match for %d", i))

addr := pub.Address()
t.Logf("ADDR \t%X %X\n", addrB, addr)
Expand Down
6 changes: 3 additions & 3 deletions crypto/keys/hd/hdpath.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"strings"

"github.com/btcsuite/btcd/btcec"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/secp256k1"
)

// BIP44Prefix is the parts of the BIP32 HD path that are fixed by what we used during the fundraiser.
Expand Down Expand Up @@ -128,9 +128,9 @@ func derivePrivateKey(privKeyBytes [32]byte, chainCode [32]byte, index uint32, h
data = append([]byte{byte(0)}, privKeyBytes[:]...)
} else {
// this can't return an error:
pubkey := crypto.PrivKeySecp256k1(privKeyBytes).PubKey()
pubkey := secp256k1.PrivKeySecp256k1(privKeyBytes).PubKey()

public := pubkey.(crypto.PubKeySecp256k1)
public := pubkey.(secp256k1.PubKeySecp256k1)
data = public[:]
}
data = append(data, uint32ToBytes(index)...)
Expand Down
Loading

0 comments on commit eb032a4

Please sign in to comment.