Skip to content

Commit

Permalink
chores: upgrade cosmos-consensus to v0.16.3 (cosmos#88)
Browse files Browse the repository at this point in the history
* chores: upgrade cosmos-consensus to v0.16.2

fixed moved packages and renamed functions

* chores: bump CI docker go version

* chores: bump consensus to v0.16.3
  • Loading branch information
daeMOn63 committed May 4, 2021
1 parent 67e824e commit 8a1a30d
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 68 deletions.
2 changes: 1 addition & 1 deletion ci.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.14-buster
FROM golang:1.15-buster

WORKDIR /workspace/mcl

Expand Down
5 changes: 3 additions & 2 deletions client/context/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/tendermint/tendermint/libs/cli"
tmlite "github.com/tendermint/tendermint/lite"
rpcclient "github.com/tendermint/tendermint/rpc/client"
rpcclienthttp "github.com/tendermint/tendermint/rpc/client/http"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -65,7 +66,7 @@ func NewCLIContextWithInputAndFrom(input io.Reader, from string) CLIContext {
if !genOnly {
nodeURI = viper.GetString(flags.FlagNode)
if nodeURI != "" {
rpc, err = rpcclient.NewHTTP(nodeURI, "/websocket")
rpc, err = rpcclienthttp.New(nodeURI, "/websocket")
if err != nil {
fmt.Printf("failted to get client: %v\n", err)
os.Exit(1)
Expand Down Expand Up @@ -157,7 +158,7 @@ func (ctx CLIContext) WithTrustNode(trustNode bool) CLIContext {
// WithNodeURI returns a copy of the context with an updated node URI.
func (ctx CLIContext) WithNodeURI(nodeURI string) CLIContext {
ctx.NodeURI = nodeURI
client, err := rpcclient.NewHTTP(nodeURI, "/websocket")
client, err := rpcclienthttp.New(nodeURI, "/websocket")
if err != nil {
panic(err)
}
Expand Down
4 changes: 2 additions & 2 deletions client/context/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/tendermint/tendermint/libs/log"
tmlite "github.com/tendermint/tendermint/lite"
tmliteproxy "github.com/tendermint/tendermint/lite/proxy"
rpcclient "github.com/tendermint/tendermint/rpc/client"
rpcclienthttp "github.com/tendermint/tendermint/rpc/client/http"
)

const (
Expand Down Expand Up @@ -43,7 +43,7 @@ func CreateVerifier(ctx CLIContext, cacheSize int) (tmlite.Verifier, error) {
// create an RPC client based off of the RPC URI if no RPC client exists
client := ctx.Client
if client == nil {
client, err = rpcclient.NewHTTP(ctx.NodeURI, "/websocket")
client, err = rpcclienthttp.New(ctx.NodeURI, "/websocket")
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions client/lcd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/tendermint/libs/log"
rpcserver "github.com/tendermint/tendermint/rpc/lib/server"
rpcserver "github.com/tendermint/tendermint/rpc/jsonrpc/server"

"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client/flags"
Expand Down Expand Up @@ -79,7 +79,7 @@ func (rs *RestServer) Start(listenAddr string, maxOpen int, readTimeout, writeTi
)(h)
}

return rpcserver.StartHTTPServer(rs.listener, h, rs.log, cfg)
return rpcserver.Serve(rs.listener, h, rs.log, cfg)
}

// ServeCommand will start the application REST service as a blocking process. It
Expand Down
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require (
github.com/99designs/keyring v1.1.6
github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d
github.com/bgentry/speakeasy v0.1.0
github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d
github.com/btcsuite/btcd v0.20.1-beta
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d
github.com/cosmos/ledger-cosmos-go v0.11.1
github.com/gogo/protobuf v1.3.1
Expand All @@ -17,22 +17,22 @@ require (
github.com/pkg/errors v0.9.1
github.com/rakyll/statik v0.1.6
github.com/spf13/afero v1.2.1 // indirect
github.com/spf13/cobra v0.0.6
github.com/spf13/cobra v1.0.0
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.6.2
github.com/spf13/viper v1.6.3
github.com/stretchr/testify v1.5.1
github.com/tendermint/btcd v0.1.1
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15
github.com/tendermint/go-amino v0.15.1
github.com/tendermint/iavl v0.13.2
github.com/tendermint/tendermint v0.33.3
github.com/tendermint/tm-db v0.5.0
github.com/tendermint/tendermint v0.33.9
github.com/tendermint/tm-db v0.5.1
gopkg.in/yaml.v2 v2.2.8
)

go 1.13
go 1.15

replace github.com/keybase/go-keychain => github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4

replace github.com/tendermint/tendermint => github.com/fetchai/cosmos-consensus v0.16.1
replace github.com/tendermint/tendermint => github.com/fetchai/cosmos-consensus v0.16.3
75 changes: 49 additions & 26 deletions go.sum

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions server/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,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
9 changes: 5 additions & 4 deletions server/tm_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package server

import (
"fmt"

"github.com/cosmos/cosmos-sdk/client/attestation"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -45,10 +46,12 @@ func ShowValidatorCmd(ctx *Context) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {

cfg := ctx.Config
UpgradeOldPrivValFile(cfg)
privValidator := pvm.LoadOrGenFilePV(
cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile())
valPubKey := privValidator.GetPubKey()
valPubKey, err := privValidator.GetPubKey()
if err != nil {
return err
}

if viper.GetString(cli.OutputFlag) == "json" {
return printlnJSON(valPubKey)
Expand Down Expand Up @@ -76,7 +79,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 Expand Up @@ -157,7 +159,6 @@ func AttestationCmd(ctx *Context) *cobra.Command {
RunE: func(cmd *cobra.Command, args []string) error {

cfg := ctx.Config
UpgradeOldPrivValFile(cfg)
privValidator := pvm.LoadOrGenFilePV(
cfg.PrivValidatorKeyFile(), cfg.PrivValidatorStateFile())

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 @@ -218,16 +217,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
13 changes: 6 additions & 7 deletions tests/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ import (

"github.com/stretchr/testify/require"

tmclient "github.com/tendermint/tendermint/rpc/client"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
rpcclient "github.com/tendermint/tendermint/rpc/lib/client"

"github.com/cosmos/cosmos-sdk/codec"
rpchttp "github.com/tendermint/tendermint/rpc/client/http"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
tmjsonrpc "github.com/tendermint/tendermint/rpc/jsonrpc/client"
)

// Wait for the next tendermint block from the Tendermint RPC
Expand All @@ -29,7 +28,7 @@ func WaitForNextHeightTM(port string) {
func WaitForNextNBlocksTM(n int64, port string) {
// get the latest block and wait for n more
url := fmt.Sprintf("http://localhost:%v", port)
cl, err := tmclient.NewHTTP(url, "/websocket")
cl, err := rpchttp.New(url, "/websocket")
if err != nil {
panic(fmt.Sprintf("failed to create Tendermint HTTP client: %s", err))
}
Expand All @@ -56,7 +55,7 @@ func WaitForHeightTM(height int64, port string) {
}

func waitForHeightTM(height int64, url string) {
cl, err := tmclient.NewHTTP(url, "/websocket")
cl, err := rpchttp.New(url, "/websocket")
if err != nil {
panic(fmt.Sprintf("failed to create Tendermint HTTP client: %s", err))
}
Expand Down Expand Up @@ -186,7 +185,7 @@ func WaitForStart(url string) {
// Wait for the RPC server to respond to /status
func WaitForRPC(laddr string) {
fmt.Println("LADDR", laddr)
client, err := rpcclient.NewJSONRPCClient(laddr)
client, err := tmjsonrpc.New(laddr)
if err != nil {
panic(fmt.Sprintf("failed to create Tendermint RPC client: %s", err))
}
Expand Down
8 changes: 4 additions & 4 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 @@ -56,7 +54,6 @@ func InitializeNodeValidatorFiles(config *cfg.Config,
}

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

pvKeyFile := config.PrivValidatorKeyFile()
if err := tmos.EnsureDir(filepath.Dir(pvKeyFile), 0777); err != nil {
Expand All @@ -68,7 +65,10 @@ func InitializeNodeValidatorFiles(config *cfg.Config,
return nodeID, valPubKey, nil
}

valPubKey = privval.LoadOrGenFilePV(pvKeyFile, pvStateFile).GetPubKey()
valPubKey, err = privval.LoadOrGenFilePV(pvKeyFile, pvStateFile).GetPubKey()
if err != nil {
return nodeID, valPubKey, err
}

return nodeID, valPubKey, nil
}

0 comments on commit 8a1a30d

Please sign in to comment.