Skip to content

Commit

Permalink
chore: bump TM to v0.35.0 release candidate (cosmos#10210)
Browse files Browse the repository at this point in the history
Integrate Tendermint v0.35.0, including changes to build and test
plumbing necessary to make everything build. This change does not
update any SDK APIs to make use of new features.

Co-authored-by: marbar3778 <[email protected]>
Co-authored-by: tycho garen <[email protected]>
Co-authored-by: M. J. Fromberger <[email protected]>
Co-authored-by: Amaury <[email protected]>
Co-authored-by: Callum Waters <[email protected]>
  • Loading branch information
6 people authored Nov 16, 2021
1 parent 36f10c0 commit 4ccbcb9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
14 changes: 8 additions & 6 deletions app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package simapp

import (
"encoding/json"
"os"
"testing"

"github.com/golang/mock/gomock"
Expand Down Expand Up @@ -39,8 +38,9 @@ import (
func TestSimAppExportAndBlockedAddrs(t *testing.T) {
encCfg := MakeTestEncodingConfig()
db := dbm.NewMemDB()
logger, _ := log.NewDefaultLogger("plain", "info", false)
app := NewSimappWithCustomOptions(t, false, SetupOptions{
Logger: log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
Logger: logger,
DB: db,
InvCheckPeriod: 0,
EncConfig: encCfg,
Expand All @@ -59,8 +59,9 @@ func TestSimAppExportAndBlockedAddrs(t *testing.T) {

app.Commit()

logger2, _ := log.NewDefaultLogger("plain", "info", false)
// Making a new app object with the db, so that initchain hasn't been called
app2 := NewSimApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, EmptyAppOptions{})
app2 := NewSimApp(logger2, db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, EmptyAppOptions{})
_, err := app2.ExportAppStateAndValidators(false, []string{})
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
}
Expand All @@ -73,7 +74,7 @@ func TestGetMaccPerms(t *testing.T) {
func TestRunMigrations(t *testing.T) {
db := dbm.NewMemDB()
encCfg := MakeTestEncodingConfig()
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
logger, _ := log.NewDefaultLogger("plain", "info", false)
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, EmptyAppOptions{})

// Create a new baseapp and configurator for the purpose of this test.
Expand Down Expand Up @@ -202,7 +203,7 @@ func TestRunMigrations(t *testing.T) {
func TestInitGenesisOnMigration(t *testing.T) {
db := dbm.NewMemDB()
encCfg := MakeTestEncodingConfig()
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
logger, _ := log.NewDefaultLogger("plain", "info", false)
app := NewSimApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, EmptyAppOptions{})
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})

Expand Down Expand Up @@ -246,8 +247,9 @@ func TestInitGenesisOnMigration(t *testing.T) {
func TestUpgradeStateOnGenesis(t *testing.T) {
encCfg := MakeTestEncodingConfig()
db := dbm.NewMemDB()
logger, _ := log.NewDefaultLogger("plain", "info", false)
app := NewSimappWithCustomOptions(t, false, SetupOptions{
Logger: log.NewTMLogger(log.NewSyncWriter(os.Stdout)),
Logger: logger,
DB: db,
InvCheckPeriod: 0,
EncConfig: encCfg,
Expand Down
15 changes: 7 additions & 8 deletions simd/cmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"bufio"
"encoding/json"
"fmt"
"io/ioutil"
"net"
"os"
"path/filepath"
Expand All @@ -14,8 +15,8 @@ import (
tmconfig "github.com/tendermint/tendermint/config"
tmos "github.com/tendermint/tendermint/libs/os"
tmrand "github.com/tendermint/tendermint/libs/rand"
tmtime "github.com/tendermint/tendermint/libs/time"
"github.com/tendermint/tendermint/types"
tmtime "github.com/tendermint/tendermint/types/time"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
Expand Down Expand Up @@ -199,11 +200,9 @@ func initTestnetFiles(
genBalIterator banktypes.GenesisBalancesIterator,
args initArgs,
) error {

if args.chainID == "" {
args.chainID = "chain-" + tmrand.NewRand().Str(6)
args.chainID = "chain-" + tmrand.Str(6)
}

nodeIDs := make([]string, args.numValidators)
valPubKeys := make([]cryptotypes.PubKey, args.numValidators)

Expand All @@ -229,15 +228,15 @@ func initTestnetFiles(
gentxsDir := filepath.Join(args.outputDir, "gentxs")

nodeConfig.SetRoot(nodeDir)
nodeConfig.Moniker = nodeDirName
nodeConfig.RPC.ListenAddress = "tcp://0.0.0.0:26657"
nodeConfig.Mode = tmconfig.ModeValidator

if err := os.MkdirAll(filepath.Join(nodeDir, "config"), nodeDirPerm); err != nil {
_ = os.RemoveAll(args.outputDir)
return err
}

nodeConfig.Moniker = nodeDirName

ip, err := getIP(i, args.startingIPAddress)
if err != nil {
_ = os.RemoveAll(args.outputDir)
Expand Down Expand Up @@ -332,7 +331,7 @@ func initTestnetFiles(
return err
}

srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config/app.toml"), simappConfig)
srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), simappConfig)
}

if err := initGenFiles(clientCtx, mbm, args.chainID, genAccounts, genBalances, genFiles, args.numValidators); err != nil {
Expand Down Expand Up @@ -480,7 +479,7 @@ func writeFile(name string, dir string, contents []byte) error {
return err
}

err = tmos.WriteFile(file, contents, 0644)
err = ioutil.WriteFile(file, contents, 0644) // nolint: gosec
if err != nil {
return err
}
Expand Down
13 changes: 7 additions & 6 deletions test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package simapp

import (
"bytes"
"context"
"encoding/hex"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -38,8 +39,8 @@ import (

// DefaultConsensusParams defines the default Tendermint consensus params used in
// SimApp testing.
var DefaultConsensusParams = &abci.ConsensusParams{
Block: &abci.BlockParams{
var DefaultConsensusParams = &tmproto.ConsensusParams{
Block: &tmproto.BlockParams{
MaxBytes: 200000,
MaxGas: 2000000,
},
Expand Down Expand Up @@ -81,7 +82,7 @@ func NewSimappWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptio
t.Helper()

privVal := mock.NewPV()
pubKey, err := privVal.GetPubKey()
pubKey, err := privVal.GetPubKey(context.TODO())
require.NoError(t, err)
// create validator set with single validator
validator := tmtypes.NewValidator(pubKey, 1)
Expand Down Expand Up @@ -122,7 +123,7 @@ func Setup(t *testing.T, isCheckTx bool) *SimApp {
t.Helper()

privVal := mock.NewPV()
pubKey, err := privVal.GetPubKey()
pubKey, err := privVal.GetPubKey(context.TODO())
require.NoError(t, err)

// create validator set with single validator
Expand Down Expand Up @@ -245,7 +246,7 @@ func SetupWithGenesisAccounts(t *testing.T, genAccs []authtypes.GenesisAccount,
t.Helper()

privVal := mock.NewPV()
pubKey, err := privVal.GetPubKey()
pubKey, err := privVal.GetPubKey(context.TODO())
require.NoError(t, err)

// create validator set with single validator
Expand All @@ -261,7 +262,7 @@ func GenesisStateWithSingleValidator(t *testing.T, app *SimApp) GenesisState {
t.Helper()

privVal := mock.NewPV()
pubKey, err := privVal.GetPubKey()
pubKey, err := privVal.GetPubKey(context.TODO())
require.NoError(t, err)

// create validator set with single validator
Expand Down

0 comments on commit 4ccbcb9

Please sign in to comment.