refactor: rename commands to match consensus engine name (#14956)

This commit is contained in:
Julien Robert
2023-02-08 20:09:28 +00:00
committed by GitHub
parent 0c35d7a8f9
commit c17c3caab8
82 changed files with 384 additions and 331 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ func NewPV() PV {
// GetPubKey implements PrivValidator interface
func (pv PV) GetPubKey() (crypto.PubKey, error) {
return cryptocodec.ToTmPubKeyInterface(pv.PrivKey.PubKey())
return cryptocodec.ToCmtPubKeyInterface(pv.PrivKey.PubKey())
}
// SignVote implements PrivValidator interface
+4 -4
View File
@@ -1,5 +1,5 @@
/*
Package network implements and exposes a fully operational in-process Tendermint
Package network implements and exposes a fully operational in-process CometBFT
test network that consists of at least one or potentially many validators. This
test network can be used primarily for integration tests or unit test suites.
@@ -10,11 +10,11 @@ number of validators as well as account funds and even custom genesis state.
When creating a test network, a series of Validator objects are returned. Each
Validator object has useful information such as their address and public key. A
Validator will also provide its RPC, P2P, and API addresses that can be useful
for integration testing. In addition, a Tendermint local RPC client is also provided
which can be handy for making direct RPC calls to Tendermint.
for integration testing. In addition, a CometBFT local RPC client is also provided
which can be handy for making direct RPC calls to CometBFT.
Note, due to limitations in concurrency and the design of the RPC layer in
Tendermint, only the first Validator object will have an RPC and API client
CometBFT, only the first Validator object will have an RPC and API client
exposed. Due to this exact same limitation, only a single test network can exist
at a time. A caller must be certain it calls Cleanup after it no longer needs
the network.
+5 -5
View File
@@ -30,7 +30,7 @@ import (
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
"github.com/cosmos/cosmos-sdk/client/grpc/cmtservice"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
@@ -631,14 +631,14 @@ func (n *Network) LatestHeight() (int64, error) {
var latestHeight int64
val := n.Validators[0]
queryClient := tmservice.NewServiceClient(val.ClientCtx)
queryClient := cmtservice.NewServiceClient(val.ClientCtx)
for {
select {
case <-timeout.C:
return latestHeight, errors.New("timeout exceeded waiting for block")
case <-ticker.C:
res, err := queryClient.GetLatestBlock(context.Background(), &tmservice.GetLatestBlockRequest{})
res, err := queryClient.GetLatestBlock(context.Background(), &cmtservice.GetLatestBlockRequest{})
if err == nil && res != nil {
return res.SdkBlock.Header.Height, nil
}
@@ -668,7 +668,7 @@ func (n *Network) WaitForHeightWithTimeout(h int64, t time.Duration) (int64, err
var latestHeight int64
val := n.Validators[0]
queryClient := tmservice.NewServiceClient(val.ClientCtx)
queryClient := cmtservice.NewServiceClient(val.ClientCtx)
for {
select {
@@ -676,7 +676,7 @@ func (n *Network) WaitForHeightWithTimeout(h int64, t time.Duration) (int64, err
return latestHeight, errors.New("timeout exceeded waiting for block")
case <-ticker.C:
res, err := queryClient.GetLatestBlock(context.Background(), &tmservice.GetLatestBlockRequest{})
res, err := queryClient.GetLatestBlock(context.Background(), &cmtservice.GetLatestBlockRequest{})
if err == nil && res != nil {
latestHeight = res.GetSdkBlock().Header.Height
if latestHeight >= h {
+1 -1
View File
@@ -198,7 +198,7 @@ func writeFile(name string, dir string, contents []byte) error {
return nil
}
// Get a free address for a test tendermint server
// Get a free address for a test CometBFT server
// protocol is either tcp, http, etc
func FreeTCPAddr() (addr, port string, closeFn func() error, err error) {
l, err := net.Listen("tcp", "localhost:0")
+2 -2
View File
@@ -30,7 +30,7 @@ import (
const DefaultGenTxGas = 10000000
// DefaultConsensusParams defines the default Tendermint consensus params used in
// DefaultConsensusParams defines the default CometBFT consensus params used in
// SimApp testing.
var DefaultConsensusParams = &cmtproto.ConsensusParams{
Block: &cmtproto.BlockParams{
@@ -199,7 +199,7 @@ func GenesisStateWithValSet(
bondAmt := sdk.DefaultPowerReduction
for _, val := range valSet.Validators {
pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey)
pk, err := cryptocodec.FromCmtPubKeyInterface(val.PubKey)
if err != nil {
return nil, fmt.Errorf("failed to convert pubkey: %w", err)
}