Skip to content

Commit

Permalink
rename import name
Browse files Browse the repository at this point in the history
  • Loading branch information
taobun committed Sep 27, 2024
1 parent a1316b1 commit db78b63
Show file tree
Hide file tree
Showing 17 changed files with 86 additions and 87 deletions.
8 changes: 4 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"github.com/spf13/cast"

abci "github.com/cometbft/cometbft/abci/types"
tmjson "github.com/cometbft/cometbft/libs/json"
tmos "github.com/cometbft/cometbft/libs/os"
cmtjson "github.com/cometbft/cometbft/libs/json"
cmtos "github.com/cometbft/cometbft/libs/os"

dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/gogoproto/proto"
Expand Down Expand Up @@ -313,7 +313,7 @@ func NewBandApp(

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
tmos.Exit(fmt.Sprintf("failed to load latest version: %s", err))
cmtos.Exit(fmt.Sprintf("failed to load latest version: %s", err))
}
}

Expand Down Expand Up @@ -341,7 +341,7 @@ func (app *BandApp) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) {
// InitChainer application update at chain initialization
func (app *BandApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) {
var genesisState GenesisState
if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
if err := cmtjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
panic(err)
}
if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()); err != nil {
Expand Down
4 changes: 2 additions & 2 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"encoding/json"
"log"

tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"

storetypes "cosmossdk.io/store/types"

Expand All @@ -20,7 +20,7 @@ func (app *BandApp) ExportAppStateAndValidators(
forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string,
) (servertypes.ExportedApp, error) {
// as if they could withdraw from the start of the next block
ctx := app.NewContextLegacy(true, tmproto.Header{Height: app.LastBlockHeight()})
ctx := app.NewContextLegacy(true, cmtproto.Header{Height: app.LastBlockHeight()})

// We export at last height + 1, because that's the height at which
// Tendermint will start InitChain.
Expand Down
6 changes: 3 additions & 3 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ package band
// storetypes "cosmossdk.io/store/types"
// evidencetypes "cosmossdk.io/x/evidence/types"
// abci "github.com/cometbft/cometbft/abci/types"
// tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
// cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
// dbm "github.com/cosmos/cosmos-db"
// "github.com/cosmos/cosmos-sdk/baseapp"
// "github.com/cosmos/cosmos-sdk/client/flags"
Expand Down Expand Up @@ -236,8 +236,8 @@ package band
// }
// }()

// ctxA := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})
// ctxB := newApp.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})
// ctxA := app.NewContext(true, cmtproto.Header{Height: app.LastBlockHeight()})
// ctxB := newApp.NewContext(true, cmtproto.Header{Height: app.LastBlockHeight()})
// newApp.mm.InitGenesis(ctxB, app.AppCodec(), genesisState)
// newApp.StoreConsensusParams(ctxB, exported.ConsensusParams)

Expand Down
4 changes: 2 additions & 2 deletions benchmark/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package benchmark
// "testing"

// abci "github.com/cometbft/cometbft/abci/types"
// tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
// cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
// "github.com/cosmos/cosmos-sdk/client"
// sdk "github.com/cosmos/cosmos-sdk/types"
// "github.com/stretchr/testify/require"
Expand Down Expand Up @@ -44,7 +44,7 @@ package benchmark
// },
// TB: tb,
// }
// ba.Ctx = ba.NewUncachedContext(false, tmproto.Header{ChainID: bandtesting.ChainID})
// ba.Ctx = ba.NewUncachedContext(false, cmtproto.Header{ChainID: bandtesting.ChainID})
// ba.Querier = keeper.Querier{
// Keeper: ba.OracleKeeper,
// }
Expand Down
16 changes: 8 additions & 8 deletions benchmark/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ package benchmark

// owasm "github.com/bandprotocol/go-owasm/api"
// types "github.com/cometbft/cometbft/abci/types"
// tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
// tmtypes "github.com/cometbft/cometbft/types"
// cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
// cmttypes "github.com/cometbft/cometbft/types"
// "github.com/cosmos/cosmos-sdk/client"
// sdk "github.com/cosmos/cosmos-sdk/types"
// banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
Expand Down Expand Up @@ -205,19 +205,19 @@ package benchmark
// return owasmVM, compiledCode, req
// }

// func GetConsensusParams(maxGas int64) tmproto.ConsensusParams {
// return tmproto.ConsensusParams{
// Block: &tmproto.BlockParams{
// func GetConsensusParams(maxGas int64) cmtproto.ConsensusParams {
// return cmtproto.ConsensusParams{
// Block: &cmtproto.BlockParams{
// MaxBytes: 200000,
// MaxGas: maxGas,
// },
// Evidence: &tmproto.EvidenceParams{
// Evidence: &cmtproto.EvidenceParams{
// MaxAgeNumBlocks: 302400,
// MaxAgeDuration: 504 * time.Hour,
// },
// Validator: &tmproto.ValidatorParams{
// Validator: &cmtproto.ValidatorParams{
// PubKeyTypes: []string{
// tmtypes.ABCIPubKeyTypeSecp256k1,
// cmttypes.ABCIPubKeyTypeSecp256k1,
// },
// },
// }
Expand Down
10 changes: 5 additions & 5 deletions client/grpc/oracle/proof/signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package proof
// "github.com/cometbft/cometbft/crypto/secp256k1"
// "github.com/cometbft/cometbft/crypto/tmhash"
// "github.com/cometbft/cometbft/libs/protoio"
// tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
// cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
// "github.com/cometbft/cometbft/types"
// "github.com/ethereum/go-ethereum/common"
// "github.com/ethereum/go-ethereum/crypto"
Expand Down Expand Up @@ -48,10 +48,10 @@ package proof
// return nil, 0, fmt.Errorf("no match address found")
// }

// func GetPrefix(t tmproto.SignedMsgType, height int64, round int64) ([]byte, error) {
// func GetPrefix(t cmtproto.SignedMsgType, height int64, round int64) ([]byte, error) {
// fmt.Println(t, height, round)
// prefix, err := protoio.MarshalDelimited(
// &tmproto.CanonicalVote{
// &cmtproto.CanonicalVote{
// Type: t,
// Height: height,
// Round: round,
Expand All @@ -70,7 +70,7 @@ package proof
// addrs := []string{}
// mapAddrs := map[string]TMSignature{}

// prefix, err := GetPrefix(tmproto.SignedMsgType(info.Commit.Type()), info.Commit.Height, int64(info.Commit.Round))
// prefix, err := GetPrefix(cmtproto.SignedMsgType(info.Commit.Type()), info.Commit.Height, int64(info.Commit.Round))
// if err != nil {
// return nil, CommonEncodedVotePart{}, err
// }
Expand All @@ -82,7 +82,7 @@ package proof
// prefix = append(prefix, []byte{34, 72, 10, 32}...)

// suffix, err := protoio.MarshalDelimited(
// &tmproto.CanonicalPartSetHeader{
// &cmtproto.CanonicalPartSetHeader{
// Total: info.Commit.BlockID.PartSetHeader.Total,
// Hash: info.Commit.BlockID.PartSetHeader.Hash,
// },
Expand Down
6 changes: 3 additions & 3 deletions client/grpc/oracle/proof/signature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ package proof
// "testing"

// "github.com/cometbft/cometbft/crypto/tmhash"
// tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
// cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
// "github.com/cometbft/cometbft/types"
// "github.com/ethereum/go-ethereum/common"
// "github.com/ethereum/go-ethereum/crypto"
// "github.com/stretchr/testify/require"
// )

// func TestGetPrefix(t *testing.T) {
// prefix, err := GetPrefix(tmproto.SignedMsgType(2), 25000, 0)
// prefix, err := GetPrefix(cmtproto.SignedMsgType(2), 25000, 0)
// require.NoError(t, err)
// require.Equal(t, "080211a861000000000000", hex.EncodeToString(prefix))

// prefix, err = GetPrefix(tmproto.SignedMsgType(2), 25000, 1)
// prefix, err = GetPrefix(cmtproto.SignedMsgType(2), 25000, 1)
// require.NoError(t, err)
// require.Equal(t, "080211a861000000000000190100000000000000", hex.EncodeToString(prefix))
// }
Expand Down
17 changes: 8 additions & 9 deletions cmd/bandd/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ import (
"github.com/spf13/cobra"

cfg "github.com/cometbft/cometbft/config"
"github.com/cometbft/cometbft/crypto/secp256k1"
tmsecp256k1 "github.com/cometbft/cometbft/crypto/secp256k1"
cmtsecp256k1 "github.com/cometbft/cometbft/crypto/secp256k1"
cmtos "github.com/cometbft/cometbft/libs/os"
"github.com/cometbft/cometbft/p2p"
"github.com/cometbft/cometbft/privval"
tmtypes "github.com/cometbft/cometbft/types"
cmttypes "github.com/cometbft/cometbft/types"

"github.com/cosmos/go-bip39"

Expand Down Expand Up @@ -169,14 +168,14 @@ func InitCmd(defaultNodeHome string) *cobra.Command {
appGenesis.AppState = appState
appGenesis.InitialHeight = initHeight

consensusParams := tmtypes.DefaultConsensusParams()
consensusParams.Block = tmtypes.BlockParams{
consensusParams := cmttypes.DefaultConsensusParams()
consensusParams.Block = cmttypes.BlockParams{
MaxBytes: 3000000,
MaxGas: 50000000,
}
consensusParams.Validator = tmtypes.ValidatorParams{
consensusParams.Validator = cmttypes.ValidatorParams{
PubKeyTypes: []string{
tmtypes.ABCIPubKeyTypeSecp256k1,
cmttypes.ABCIPubKeyTypeSecp256k1,
},
}

Expand Down Expand Up @@ -236,7 +235,7 @@ func InitializeNodeValidatorFilesFromMnemonic(
if len(mnemonic) == 0 {
filePV = LoadOrGenFilePV(pvKeyFile, pvStateFile)
} else {
privKey := tmsecp256k1.GenPrivKeySecp256k1([]byte(mnemonic))
privKey := cmtsecp256k1.GenPrivKeySecp256k1([]byte(mnemonic))
filePV = privval.NewFilePV(privKey, pvKeyFile, pvStateFile)
filePV.Save()
}
Expand Down Expand Up @@ -270,5 +269,5 @@ func LoadOrGenFilePV(keyFilePath, stateFilePath string) *privval.FilePV {
// GenFilePV generates a new validator with randomly generated private key
// and sets the filePaths, but does not call Save().
func GenFilePV(keyFilePath, stateFilePath string) *privval.FilePV {
return privval.NewFilePV(secp256k1.GenPrivKey(), keyFilePath, stateFilePath)
return privval.NewFilePV(cmtsecp256k1.GenPrivKey(), keyFilePath, stateFilePath)
}
8 changes: 4 additions & 4 deletions cmd/bandd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"

tmcfg "github.com/cometbft/cometbft/config"
cmtcfg "github.com/cometbft/cometbft/config"
tmcli "github.com/cometbft/cometbft/libs/cli"

dbm "github.com/cosmos/cosmos-db"
Expand Down Expand Up @@ -159,9 +159,9 @@ func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context)
}

// initCometConfig helps to override default CometBFT Config values.
// return tmcfg.DefaultConfig if no custom configuration is required for the application.
func initCometConfig() *tmcfg.Config {
cfg := tmcfg.DefaultConfig()
// return cmtcfg.DefaultConfig if no custom configuration is required for the application.
func initCometConfig() *cmtcfg.Config {
cfg := cmtcfg.DefaultConfig()

// these values put a higher strain on node memory
// cfg.P2P.MaxNumInboundPeers = 100
Expand Down
14 changes: 7 additions & 7 deletions testing/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"golang.org/x/exp/rand"

abci "github.com/cometbft/cometbft/abci/types"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmtypes "github.com/cometbft/cometbft/types"
cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
cmttypes "github.com/cometbft/cometbft/types"

cosmosdb "github.com/cosmos/cosmos-db"
ibctesting "github.com/cosmos/ibc-go/v8/testing"
Expand Down Expand Up @@ -85,19 +85,19 @@ const (
)

// DefaultConsensusParams defines the default Tendermint consensus params used in TestingApp.
var DefaultConsensusParams = &tmproto.ConsensusParams{
Block: &tmproto.BlockParams{
var DefaultConsensusParams = &cmtproto.ConsensusParams{
Block: &cmtproto.BlockParams{
MaxBytes: 200000,
MaxGas: -1,
},
Evidence: &tmproto.EvidenceParams{
Evidence: &cmtproto.EvidenceParams{
MaxAgeNumBlocks: 302400,
MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration
// MaxBytes: 10000,
},
Validator: &tmproto.ValidatorParams{
Validator: &cmtproto.ValidatorParams{
PubKeyTypes: []string{
tmtypes.ABCIPubKeyTypeSecp256k1,
cmttypes.ABCIPubKeyTypeSecp256k1,
},
},
}
Expand Down
22 changes: 11 additions & 11 deletions testing/test_helpers_old.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ package testing
// snapshottypes "cosmossdk.io/store/snapshots/types"
// owasm "github.com/bandprotocol/go-owasm/api"
// abci "github.com/cometbft/cometbft/abci/types"
// tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
// tmtypes "github.com/cometbft/cometbft/types"
// cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
// cmttypes "github.com/cometbft/cometbft/types"
// dbm "github.com/cosmos/cosmos-db"
// "github.com/cosmos/cosmos-sdk/baseapp"
// "github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -96,19 +96,19 @@ package testing
// )

// // DefaultConsensusParams defines the default Tendermint consensus params used in TestingApp.
// var DefaultConsensusParams = &tmproto.ConsensusParams{
// Block: &tmproto.BlockParams{
// var DefaultConsensusParams = &cmtproto.ConsensusParams{
// Block: &cmtproto.BlockParams{
// MaxBytes: 200000,
// MaxGas: -1,
// },
// Evidence: &tmproto.EvidenceParams{
// Evidence: &cmtproto.EvidenceParams{
// MaxAgeNumBlocks: 302400,
// MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration
// // MaxBytes: 10000,
// },
// Validator: &tmproto.ValidatorParams{
// Validator: &cmtproto.ValidatorParams{
// PubKeyTypes: []string{
// tmtypes.ABCIPubKeyTypeSecp256k1,
// cmttypes.ABCIPubKeyTypeSecp256k1,
// },
// },
// }
Expand Down Expand Up @@ -198,7 +198,7 @@ package testing

// isCheckTx := false
// app := setupWithGenesis(t, Validators, acc, ChainID, balances...)
// ctx := app.NewContextLegacy(isCheckTx, tmproto.Header{Height: app.LastBlockHeight()})
// ctx := app.NewContextLegacy(isCheckTx, cmtproto.Header{Height: app.LastBlockHeight()})
// if autoActivate {
// err := app.OracleKeeper.Activate(ctx, Validators[0].ValAddress)
// require.NoError(t, err)
Expand Down Expand Up @@ -302,7 +302,7 @@ package testing
// // account. A Nop logger is set in TestingApp.
// func SetupWithGenesisValSet(
// t *testing.T,
// valSet *tmtypes.ValidatorSet,
// valSet *cmttypes.ValidatorSet,
// genAccs []authtypes.GenesisAccount,
// chainID string,
// balances ...banktypes.Balance,
Expand Down Expand Up @@ -398,7 +398,7 @@ package testing

// // commit genesis changes
// app.Commit()
// ctx := app.NewContextLegacy(false, tmproto.Header{
// ctx := app.NewContextLegacy(false, cmtproto.Header{
// ChainID: chainID,
// Height: app.LastBlockHeight() + 1,
// AppHash: app.LastCommitID().Hash,
Expand Down Expand Up @@ -647,7 +647,7 @@ package testing
// // SignAndDeliver signs and delivers a transaction. No simulation occurs as the
// // ibc testing package causes checkState and deliverState to diverge in block time.
// func SignAndDeliver(
// t *testing.T, txCfg client.TxConfig, app *baseapp.BaseApp, header tmproto.Header, msgs []sdk.Msg,
// t *testing.T, txCfg client.TxConfig, app *baseapp.BaseApp, header cmtproto.Header, msgs []sdk.Msg,
// chainID string, accNums, accSeqs []uint64, priv ...cryptotypes.PrivKey,
// ) (sdk.GasInfo, *sdk.Result, error) {
// tx, err := GenTx(
Expand Down
Loading

0 comments on commit db78b63

Please sign in to comment.