Merge PR #5527: Bump Tendermint Version to v0.33.0

* Bump Tendermint version to v0.33.0

* Deprecate old cmn package with new packages

* Update update DB APIs

* More DB updates

* Bump IAVL to v0.13.0

* Handle error returned by iavl.NewMutableTree

* Fix some IAVL stuffs

* Update IAVL

* More updates

* Passing tests

* Fix unit tests

Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com>
This commit is contained in:
Alexander Bezobchuk 2020-01-16 16:46:51 -05:00 committed by Jack Zampolin
parent c92a7389ff
commit c1991e31bd
88 changed files with 577 additions and 344 deletions

View File

@ -59,14 +59,18 @@ func NewCLIContextWithInputAndFrom(input io.Reader, from string) CLIContext {
genOnly := viper.GetBool(flags.FlagGenerateOnly)
fromAddress, fromName, err := GetFromFields(input, from, genOnly)
if err != nil {
fmt.Printf("failed to get from fields: %v", err)
fmt.Printf("failed to get from fields: %v\n", err)
os.Exit(1)
}
if !genOnly {
nodeURI = viper.GetString(flags.FlagNode)
if nodeURI != "" {
rpc = rpcclient.NewHTTP(nodeURI, "/websocket")
rpc, err = rpcclient.NewHTTP(nodeURI, "/websocket")
if err != nil {
fmt.Printf("failted to get client: %v\n", err)
os.Exit(1)
}
}
}
@ -154,7 +158,11 @@ 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
ctx.Client = rpcclient.NewHTTP(nodeURI, "/websocket")
client, err := rpcclient.NewHTTP(nodeURI, "/websocket")
if err != nil {
panic(err)
}
ctx.Client = client
return ctx
}

View File

@ -8,7 +8,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/merkle"
cmn "github.com/tendermint/tendermint/libs/common"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmliteErr "github.com/tendermint/tendermint/lite/errors"
tmliteProxy "github.com/tendermint/tendermint/lite/proxy"
rpcclient "github.com/tendermint/tendermint/rpc/client"
@ -45,7 +45,7 @@ func (ctx CLIContext) QueryWithData(path string, data []byte) ([]byte, int64, er
// QueryStore performs a query to a Tendermint node with the provided key and
// store name. It returns the result and height of the query upon success
// or an error if the query fails.
func (ctx CLIContext) QueryStore(key cmn.HexBytes, storeName string) ([]byte, int64, error) {
func (ctx CLIContext) QueryStore(key tmbytes.HexBytes, storeName string) ([]byte, int64, error) {
return ctx.queryStore(key, storeName, "key")
}
@ -77,7 +77,7 @@ func (ctx CLIContext) GetFromName() string {
// or an error if the query fails. In addition, it will verify the returned
// proof if TrustNode is disabled. If proof verification fails or the query
// height is invalid, an error will be returned.
func (ctx CLIContext) query(path string, key cmn.HexBytes) (res []byte, height int64, err error) {
func (ctx CLIContext) query(path string, key tmbytes.HexBytes) (res []byte, height int64, err error) {
node, err := ctx.GetNode()
if err != nil {
return res, height, err
@ -167,7 +167,7 @@ func (ctx CLIContext) verifyProof(queryPath string, resp abci.ResponseQuery) err
// queryStore performs a query to a Tendermint node with the provided a store
// name and path. It returns the result and height of the query upon success
// or an error if the query fails.
func (ctx CLIContext) queryStore(key cmn.HexBytes, storeName, endPath string) ([]byte, int64, error) {
func (ctx CLIContext) queryStore(key tmbytes.HexBytes, storeName, endPath string) ([]byte, int64, error) {
path := fmt.Sprintf("/store/%s/%s", storeName, endPath)
return ctx.query(path, key)
}

View File

@ -38,10 +38,15 @@ func CreateVerifier(ctx CLIContext, cacheSize int) (tmlite.Verifier, error) {
return nil, errors.New("must provide a valid RPC client or RPC URI to create verifier")
}
var err error
// create an RPC client based off of the RPC URI if no RPC client exists
client := ctx.Client
if client == nil {
client = rpcclient.NewHTTP(ctx.NodeURI, "/websocket")
client, err = rpcclient.NewHTTP(ctx.NodeURI, "/websocket")
if err != nil {
return nil, err
}
}
return tmliteproxy.NewVerifier(

View File

@ -4,8 +4,9 @@ import (
"io/ioutil"
"testing"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/client/context"
)
func TestCreateVerifier(t *testing.T) {

View File

@ -61,6 +61,8 @@ const (
FlagOutputDocument = "output-document" // inspired by wget -O
FlagSkipConfirmation = "yes"
FlagKeyringBackend = "keyring-backend"
FlagPage = "page"
FlagLimit = "limit"
)
// LineBreak can be included in a command list to provide a blank line

View File

@ -53,13 +53,11 @@ func getBlock(cliCtx context.CLIContext, height *int64) ([]byte, error) {
return nil, err
}
err = tmliteProxy.ValidateBlockMeta(res.BlockMeta, check)
if err != nil {
if err := tmliteProxy.ValidateHeader(&res.Block.Header, check); err != nil {
return nil, err
}
err = tmliteProxy.ValidateBlock(res.Block, check)
if err != nil {
if err = tmliteProxy.ValidateBlock(res.Block, check); err != nil {
return nil, err
}
}

View File

@ -45,7 +45,7 @@ func ValidatorCommand(cdc *codec.Codec) *cobra.Command {
cliCtx := context.NewCLIContext().WithCodec(cdc)
result, err := GetValidators(cliCtx, height)
result, err := GetValidators(cliCtx, height, viper.GetInt(flags.FlagPage), viper.GetInt(flags.FlagLimit))
if err != nil {
return err
}
@ -60,6 +60,9 @@ func ValidatorCommand(cdc *codec.Codec) *cobra.Command {
viper.BindPFlag(flags.FlagTrustNode, cmd.Flags().Lookup(flags.FlagTrustNode))
cmd.Flags().Bool(flags.FlagIndentResponse, false, "indent JSON response")
viper.BindPFlag(flags.FlagIndentResponse, cmd.Flags().Lookup(flags.FlagIndentResponse))
cmd.Flags().Int(flags.FlagPage, 0, "Query a specific page of paginated results")
viper.BindPFlag(flags.FlagPage, cmd.Flags().Lookup(flags.FlagPage))
cmd.Flags().Int(flags.FlagLimit, 100, "Query number of results returned per page")
return cmd
}
@ -114,14 +117,14 @@ func bech32ValidatorOutput(validator *tmtypes.Validator) (ValidatorOutput, error
}
// GetValidators from client
func GetValidators(cliCtx context.CLIContext, height *int64) (ResultValidatorsOutput, error) {
func GetValidators(cliCtx context.CLIContext, height *int64, page, limit int) (ResultValidatorsOutput, error) {
// get the node
node, err := cliCtx.GetNode()
if err != nil {
return ResultValidatorsOutput{}, err
}
validatorsRes, err := node.Validators(height)
validatorsRes, err := node.Validators(height, page, limit)
if err != nil {
return ResultValidatorsOutput{}, err
}
@ -159,6 +162,18 @@ func ValidatorSetRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
page, err := strconv.ParseInt(vars["page"], 10, 64)
if err != nil {
rest.WriteErrorResponse(w, http.StatusBadRequest, "failed to parse page")
return
}
limit, err := strconv.ParseInt(vars["limit"], 10, 64)
if err != nil {
rest.WriteErrorResponse(w, http.StatusBadRequest, "failed to parse limit")
return
}
height, err := strconv.ParseInt(vars["height"], 10, 64)
if err != nil {
rest.WriteErrorResponse(w, http.StatusBadRequest, "failed to parse block height; assumed format is '/validatorsets/{height}'")
@ -175,7 +190,7 @@ func ValidatorSetRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return
}
output, err := GetValidators(cliCtx, &height)
output, err := GetValidators(cliCtx, &height, int(page), int(limit))
if err != nil {
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
@ -187,7 +202,21 @@ func ValidatorSetRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
// Latest Validator Set REST handler
func LatestValidatorSetRequestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
output, err := GetValidators(cliCtx, nil)
vars := mux.Vars(r)
page, err := strconv.ParseInt(vars["page"], 10, 64)
if err != nil {
rest.WriteErrorResponse(w, http.StatusBadRequest, "failed to parse page")
return
}
limit, err := strconv.ParseInt(vars["limit"], 10, 64)
if err != nil {
rest.WriteErrorResponse(w, http.StatusBadRequest, "failed to parse limit")
return
}
output, err := GetValidators(cliCtx, nil, int(page), int(limit))
if err != nil {
rest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return

View File

@ -54,9 +54,11 @@ func ExamplePrintRegisteredTypes() {
//| ---- | ---- | ------ | ----- | ------ |
//| PrivKeyLedgerSecp256k1 | tendermint/PrivKeyLedgerSecp256k1 | 0x10CAB393 | variable | |
//| PubKeyEd25519 | tendermint/PubKeyEd25519 | 0x1624DE64 | 0x20 | |
//| PubKeySr25519 | tendermint/PubKeySr25519 | 0x0DFB1005 | 0x20 | |
//| PubKeySecp256k1 | tendermint/PubKeySecp256k1 | 0xEB5AE987 | 0x21 | |
//| PubKeyMultisigThreshold | tendermint/PubKeyMultisigThreshold | 0x22C1F7E2 | variable | |
//| PrivKeyEd25519 | tendermint/PrivKeyEd25519 | 0xA3288910 | 0x40 | |
//| PrivKeySr25519 | tendermint/PrivKeySr25519 | 0x2F82D78B | 0x20 | |
//| PrivKeySecp256k1 | tendermint/PrivKeySecp256k1 | 0xE1B0F79B | 0x20 | |
}

View File

@ -131,7 +131,11 @@ func (kb dbKeybase) CreateMulti(name string, pub tmcrypto.PubKey) (Info, error)
func (kb dbKeybase) List() ([]Info, error) {
var res []Info
iter := kb.db.Iterator(nil, nil)
iter, err := kb.db.Iterator(nil, nil)
if err != nil {
return nil, err
}
defer iter.Close()
for ; iter.Valid(); iter.Next() {
@ -153,7 +157,11 @@ func (kb dbKeybase) List() ([]Info, error) {
// Get returns the public information about one key.
func (kb dbKeybase) Get(name string) (Info, error) {
bs := kb.db.Get(infoKey(name))
bs, err := kb.db.Get(infoKey(name))
if err != nil {
return nil, err
}
if len(bs) == 0 {
return nil, keyerror.NewErrKeyNotFound(name)
}
@ -164,12 +172,20 @@ func (kb dbKeybase) Get(name string) (Info, error) {
// GetByAddress returns Info based on a provided AccAddress. An error is returned
// if the address does not exist.
func (kb dbKeybase) GetByAddress(address types.AccAddress) (Info, error) {
ik := kb.db.Get(addrKey(address))
ik, err := kb.db.Get(addrKey(address))
if err != nil {
return nil, err
}
if len(ik) == 0 {
return nil, fmt.Errorf("key with address %s not found", address)
}
bs := kb.db.Get(ik)
bs, err := kb.db.Get(ik)
if err != nil {
return nil, err
}
return unmarshalInfo(bs)
}
@ -242,7 +258,11 @@ func (kb dbKeybase) ExportPrivateKeyObject(name string, passphrase string) (tmcr
}
func (kb dbKeybase) Export(name string) (armor string, err error) {
bz := kb.db.Get(infoKey(name))
bz, err := kb.db.Get(infoKey(name))
if err != nil {
return "", err
}
if bz == nil {
return "", fmt.Errorf("no key to export with name %s", name)
}
@ -253,7 +273,11 @@ func (kb dbKeybase) Export(name string) (armor string, err error) {
// ExportPubKey returns public keys in ASCII armored format. It retrieves a Info
// object by its name and return the public key in a portable format.
func (kb dbKeybase) ExportPubKey(name string) (armor string, err error) {
bz := kb.db.Get(infoKey(name))
bz, err := kb.db.Get(infoKey(name))
if err != nil {
return "", err
}
if bz == nil {
return "", fmt.Errorf("no key to export with name %s", name)
}
@ -302,9 +326,13 @@ func (kb dbKeybase) ImportPrivKey(name string, armor string, passphrase string)
}
func (kb dbKeybase) Import(name string, armor string) (err error) {
bz := kb.db.Get(infoKey(name))
bz, err := kb.db.Get(infoKey(name))
if err != nil {
return err
}
if len(bz) > 0 {
return errors.New("Cannot overwrite data for name " + name)
return errors.New("cannot overwrite data for name " + name)
}
infoBytes, err := mintkey.UnarmorInfoBytes(armor)
@ -320,9 +348,13 @@ func (kb dbKeybase) Import(name string, armor string) (err error) {
// a public key only, i.e. it will not be possible to sign with it as it lacks the
// secret key.
func (kb dbKeybase) ImportPubKey(name string, armor string) (err error) {
bz := kb.db.Get(infoKey(name))
bz, err := kb.db.Get(infoKey(name))
if err != nil {
return err
}
if len(bz) > 0 {
return errors.New("Cannot overwrite data for name " + name)
return errors.New("cannot overwrite data for name " + name)
}
pubBytes, algo, err := mintkey.UnarmorPubKeyBytes(armor)

View File

@ -4,7 +4,7 @@ import (
"fmt"
"github.com/tendermint/tendermint/crypto"
cmn "github.com/tendermint/tendermint/libs/common"
tmos "github.com/tendermint/tendermint/libs/os"
sdk "github.com/cosmos/cosmos-sdk/types"
)
@ -20,7 +20,7 @@ type lazyKeybase struct {
// New creates a new instance of a lazy keybase.
func New(name, dir string, opts ...KeybaseOption) Keybase {
if err := cmn.EnsureDir(dir, 0700); err != nil {
if err := tmos.EnsureDir(dir, 0700); err != nil {
panic(fmt.Sprintf("failed to create Keybase directory: %s", err))
}

View File

@ -11,7 +11,7 @@ import (
cryptoAmino "github.com/tendermint/tendermint/crypto/encoding/amino"
"github.com/tendermint/tendermint/crypto/xsalsa20symmetric"
cmn "github.com/tendermint/tendermint/libs/common"
tmos "github.com/tendermint/tendermint/libs/os"
"github.com/cosmos/cosmos-sdk/crypto/keys/keyerror"
)
@ -134,7 +134,7 @@ func encryptPrivKey(privKey crypto.PrivKey, passphrase string) (saltBytes []byte
saltBytes = crypto.CRandBytes(16)
key, err := bcrypt.GenerateFromPassword(saltBytes, []byte(passphrase), BcryptSecurityParameter)
if err != nil {
cmn.Exit("Error generating bcrypt key from passphrase: " + err.Error())
tmos.Exit("Error generating bcrypt key from passphrase: " + err.Error())
}
key = crypto.Sha256(key) // get 32 bytes
privKeyBytes := privKey.Bytes()
@ -171,7 +171,7 @@ func UnarmorDecryptPrivKey(armorStr string, passphrase string) (privKey crypto.P
func decryptPrivKey(saltBytes []byte, encBytes []byte, passphrase string) (privKey crypto.PrivKey, err error) {
key, err := bcrypt.GenerateFromPassword(saltBytes, []byte(passphrase), BcryptSecurityParameter)
if err != nil {
cmn.Exit("error generating bcrypt key from passphrase: " + err.Error())
tmos.Exit("error generating bcrypt key from passphrase: " + err.Error())
}
key = crypto.Sha256(key) // Get 32 bytes
privKeyBytes, err := xsalsa20symmetric.DecryptSymmetric(encBytes, key)

8
go.mod
View File

@ -5,7 +5,7 @@ require (
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/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8
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
github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129
@ -24,9 +24,9 @@ require (
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.12.4
github.com/tendermint/tendermint v0.32.9
github.com/tendermint/tm-db v0.2.0
github.com/tendermint/iavl v0.13.0
github.com/tendermint/tendermint v0.33.0
github.com/tendermint/tm-db v0.4.0
gopkg.in/yaml.v2 v2.2.7
)

68
go.sum
View File

@ -5,6 +5,8 @@ github.com/99designs/keyring v1.1.3 h1:mEV3iyZWjkxQ7R8ia8GcG97vCX5zQQ7n4o8R2Bylw
github.com/99designs/keyring v1.1.3/go.mod h1:657DQuMrBZRtuL/voxVyiyb6zpMehlm5vLB9Qwrv904=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200102211924-4bcbc698314f h1:4O1om+UVU+Hfcihr1timk8YNXHxzZWgCo7ofnrZRApw=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200102211924-4bcbc698314f/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE=
github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g=
@ -40,8 +42,8 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI=
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4=
github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY=
github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI=
@ -57,9 +59,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a h1:mq+R6XEM6lJX5VlLyZIrUSP8tSuJp82xTK89hvBwJbU=
github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/etcd-io/bbolt v1.3.2/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
github.com/etcd-io/bbolt v1.3.3 h1:gSJmxrs37LgTqR/oyJBWok6k6SvXEUerFTbltIhXkBM=
github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHjkjCrw=
github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ=
@ -68,13 +69,11 @@ github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojt
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg=
github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870 h1:E2s37DuLxFhQDg5gKsWoLBOB0n+ZW8s599zru8FJ2/Y=
github.com/facebookgo/subset v0.0.0-20150612182917-8dac2c3c4870/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0=
github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-kit/kit v0.6.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.8.0 h1:Wz+5lgoB0kkuqLEc6NVmwRknTKP6dTGbSqvhZtBI/j0=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk=
@ -83,6 +82,8 @@ github.com/go-logfmt/logfmt v0.3.0 h1:8HUsc87TaSWLKwrnumgC8/YconD2fJQsRJAsWaPg2i
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4=
github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0=
@ -105,6 +106,7 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
@ -113,7 +115,6 @@ github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGa
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
@ -122,6 +123,10 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgf
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f h1:8N8XWLZelZNibkhM1FuF+3Ad3YIbgirjdMiVA0eUkaM=
github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s=
github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc=
github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o=
github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk=
github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
@ -160,6 +165,8 @@ github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGe
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/matttproud/golang_protobuf_extensions v1.0.1 h1:4hp9jkHxhMHkqkrB3Ix0jegS5sx/RkqARlsWZ6pIwiU=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643 h1:hLDRPB66XQT/8+wG9WsDpiCvZf1yKO7sz7scAjSlBa0=
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE=
@ -177,8 +184,6 @@ github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.0 h1:J8lpUdobwIeCI7OiSxHqEwJUKvJwicL5+3v1oe2Yb4k=
github.com/pkg/errors v0.9.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
@ -191,7 +196,6 @@ github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90 h1:S/YWwWx
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181020173914-7e9e6cabbd39/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.4.0 h1:7etb9YClo3a6HjLzfl6rIQaU+FDfi0VSX39io3aQ+DM=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
@ -204,8 +208,6 @@ github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6
github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk=
github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rs/cors v1.6.0 h1:G9tHG9lebljV9mfp9SNPDL36nCDxmo3zTlAf1YgvzmI=
github.com/rs/cors v1.6.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g=
@ -232,11 +234,8 @@ github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg=
github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.0.0/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM=
github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M=
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/spf13/viper v1.5.0 h1:GpsTwfsQ27oS/Aha/6d1oD7tpKIqWnOA6tgOX9HHkt4=
github.com/spf13/viper v1.5.0/go.mod h1:AkYRkVJF8TkSG/xet6PzXX+l39KhhXa2pdqVSxnTcn4=
github.com/spf13/viper v1.6.1 h1:VPZzIkznI1YhVMRi6vNFLHSwhnhReBfgTxIPccpfdZk=
github.com/spf13/viper v1.6.1/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@ -247,12 +246,12 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stumble/gorocksdb v0.0.3 h1:9UU+QA1pqFYJuf9+5p7z1IqdE5k0mma4UAeu2wmX8kA=
github.com/stumble/gorocksdb v0.0.3/go.mod h1:v6IHdFBXk5DJ1K4FZ0xi+eY737quiiBxYtSWXadLybY=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7bnBzGhf7BbIv9loSFQcieWWYIjLqcAw=
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA=
github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d h1:gZZadD8H+fF+n9CmNhYL1Y0dJB+kLOmKd7FbPJLeGHs=
github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA=
github.com/tecbot/gorocksdb v0.0.0-20191017175515-d217d93fd4c5 h1:gVwAW5OwaZlDB5/CfqcGFM9p9C+KxvQKyNOltQ8orj0=
github.com/tecbot/gorocksdb v0.0.0-20191017175515-d217d93fd4c5/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8=
github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s=
github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U=
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI=
@ -260,17 +259,12 @@ github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM
github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso=
github.com/tendermint/go-amino v0.15.1 h1:D2uk35eT4iTsvJd9jWIetzthE5C0/k2QmMFkCN+4JgQ=
github.com/tendermint/go-amino v0.15.1/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME=
github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8=
github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o=
github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU=
github.com/tendermint/tendermint v0.32.8 h1:eOaLJGRi5x/Rb23fiVsxq9c5fZ/6O5QplExlGjNPDVI=
github.com/tendermint/tendermint v0.32.8/go.mod h1:5/B1XZjNYtVBso8o1l/Eg4A0Mhu42lDcmftoQl95j/E=
github.com/tendermint/tendermint v0.32.9 h1:++dR46xpBq/yfQx2c5KyrZmb15p2jw9Q5iEtTB82d8s=
github.com/tendermint/tendermint v0.32.9/go.mod h1:5/B1XZjNYtVBso8o1l/Eg4A0Mhu42lDcmftoQl95j/E=
github.com/tendermint/tm-db v0.1.1 h1:G3Xezy3sOk9+ekhjZ/kjArYIs1SmwV+1OUgNkj7RgV0=
github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw=
github.com/tendermint/tm-db v0.2.0 h1:rJxgdqn6fIiVJZy4zLpY1qVlyD0TU6vhkT4kEf71TQQ=
github.com/tendermint/tm-db v0.2.0/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw=
github.com/tendermint/iavl v0.13.0 h1:r2sINvNFlJsLlLhGoqlqPlREWYkuK26BvMfkBt+XQnA=
github.com/tendermint/iavl v0.13.0/go.mod h1:7nSUPdrsHEZ2nNZa+9gaIrcJciWd1jCQZXtcyARU82k=
github.com/tendermint/tendermint v0.33.0 h1:TW1g9sQs3YSqKM8o1+opL3/VmBy4Ke/VKV9MxYpqNbI=
github.com/tendermint/tendermint v0.33.0/go.mod h1:s5UoymnPIY+GcA3mMte4P9gpMP8vS7UH7HBXikT1pHI=
github.com/tendermint/tm-db v0.4.0 h1:iPbCcLbf4nwDFhS39Zo1lpdS1X/cT9CkTlUx17FHQgA=
github.com/tendermint/tm-db v0.4.0/go.mod h1:+Cwhgowrf7NBGXmsqFMbwEtbo80XmyrlY5Jsk95JubQ=
github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U=
github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc=
github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0=
@ -287,12 +281,11 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a h1:YX8ljsm6wXlHZO+aRz9Exqr0evNhKRNe5K/gi+zKh4U=
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413 h1:ULYEB3JvPRE/IfO+9uO7vKV/xzVTO7XPAwm8xbf4w2g=
golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
@ -341,18 +334,13 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20180831171423-11092d34479b/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2 h1:67iHsV9djwGdZpdZNbLuQj6FOzCaZe3w+vhLjn5AcFA=
google.golang.org/genproto v0.0.0-20181029155118-b69ba1387ce2/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/grpc v1.13.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.22.0 h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw=
google.golang.org/grpc v1.22.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1 h1:wdKvqQk7IttEw92GoRyKG2IDrUIpgpj6H6m81yfeMW0=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View File

@ -5,7 +5,7 @@ import (
"text/template"
"github.com/spf13/viper"
cmn "github.com/tendermint/tendermint/libs/common"
tmos "github.com/tendermint/tendermint/libs/os"
)
const defaultConfigTemplate = `# This is a TOML config file.
@ -68,5 +68,5 @@ func WriteConfigFile(configFilePath string, config *Config) {
panic(err)
}
cmn.MustWriteFile(configFilePath, buffer.Bytes(), 0644)
tmos.MustWriteFile(configFilePath, buffer.Bytes(), 0644)
}

View File

@ -11,7 +11,7 @@ import (
"github.com/spf13/viper"
"github.com/tendermint/tendermint/abci/server"
tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
cmn "github.com/tendermint/tendermint/libs/common"
tmos "github.com/tendermint/tendermint/libs/os"
"github.com/tendermint/tendermint/node"
"github.com/tendermint/tendermint/p2p"
pvm "github.com/tendermint/tendermint/privval"
@ -114,14 +114,14 @@ func startStandAlone(ctx *Context, appCreator AppCreator) error {
err = svr.Start()
if err != nil {
cmn.Exit(err.Error())
tmos.Exit(err.Error())
}
cmn.TrapSignal(ctx.Logger, func() {
tmos.TrapSignal(ctx.Logger, func() {
// cleanup
err = svr.Stop()
if err != nil {
cmn.Exit(err.Error())
tmos.Exit(err.Error())
}
})

View File

@ -91,7 +91,7 @@ func interceptLoadConfig() (conf *cfg.Config, err error) {
conf.ProfListenAddress = "localhost:6060"
conf.P2P.RecvRate = 5120000
conf.P2P.SendRate = 5120000
conf.TxIndex.IndexAllTags = true
conf.TxIndex.IndexAllKeys = true
conf.Consensus.TimeoutCommit = 5 * time.Second
cfg.WriteConfigFile(configFilePath, conf)
// Fall through, just so that its parsed into memory.

View File

@ -5,8 +5,8 @@ import (
"os"
abci "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"
bam "github.com/cosmos/cosmos-sdk/baseapp"
@ -289,7 +289,7 @@ func NewSimApp(
if loadLatest {
err := app.LoadLatestVersion(app.keys[bam.MainStoreKey])
if err != nil {
cmn.Exit(err.Error())
tmos.Exit(err.Error())
}
}

View File

@ -5,8 +5,9 @@ import (
"os"
"testing"
"github.com/cosmos/cosmos-sdk/x/simulation"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/x/simulation"
)
// Profile with:

View File

@ -5,7 +5,7 @@ import (
"fmt"
"io/ioutil"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
@ -109,7 +109,7 @@ func PrintStats(db dbm.DB) {
// GetSimulationLog unmarshals the KVPair's Value to the corresponding type based on the
// each's module store key and the prefix bytes of the KVPair's key.
func GetSimulationLog(storeName string, sdr sdk.StoreDecoderRegistry, cdc *codec.Codec, kvAs, kvBs []cmn.KVPair) (log string) {
func GetSimulationLog(storeName string, sdr sdk.StoreDecoderRegistry, cdc *codec.Codec, kvAs, kvBs []tmkv.Pair) (log string) {
for i := 0; i < len(kvAs); i++ {
if len(kvAs[i].Value) == 0 && len(kvBs[i].Value) == 0 {

View File

@ -5,40 +5,37 @@ import (
"testing"
"github.com/stretchr/testify/require"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/auth"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth"
)
func TestGetSimulationLog(t *testing.T) {
cdc := MakeCodec()
decoders := make(sdk.StoreDecoderRegistry)
decoders[auth.StoreKey] = func(cdc *codec.Codec, kvAs, kvBs cmn.KVPair) string { return "10" }
decoders[auth.StoreKey] = func(cdc *codec.Codec, kvAs, kvBs tmkv.Pair) string { return "10" }
tests := []struct {
store string
kvPairs []cmn.KVPair
kvPairs []tmkv.Pair
expectedLog string
}{
{
"Empty",
[]cmn.KVPair{{}},
[]tmkv.Pair{{}},
"",
},
{
auth.StoreKey,
[]cmn.KVPair{{Key: auth.GlobalAccountNumberKey, Value: cdc.MustMarshalBinaryLengthPrefixed(uint64(10))}},
[]tmkv.Pair{{Key: auth.GlobalAccountNumberKey, Value: cdc.MustMarshalBinaryLengthPrefixed(uint64(10))}},
"10",
},
{
"OtherStore",
[]cmn.KVPair{{Key: []byte("key"), Value: []byte("value")}},
[]tmkv.Pair{{Key: []byte("key"), Value: []byte("value")}},
fmt.Sprintf("store A %X => %X\nstore B %X => %X\n", []byte("key"), []byte("value"), []byte("key"), []byte("value")),
},
}

View File

@ -18,7 +18,9 @@ func TestGetOrSetStoreCache(t *testing.T) {
mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize)
sKey := types.NewKVStoreKey("test")
store := iavlstore.UnsafeNewStore(iavl.NewMutableTree(db, 100), 10, 10)
tree, err := iavl.NewMutableTree(db, 100)
require.NoError(t, err)
store := iavlstore.UnsafeNewStore(tree, 10, 10)
store2 := mngr.GetStoreCache(sKey, store)
require.NotNil(t, store2)
@ -30,7 +32,9 @@ func TestUnwrap(t *testing.T) {
mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize)
sKey := types.NewKVStoreKey("test")
store := iavlstore.UnsafeNewStore(iavl.NewMutableTree(db, 100), 10, 10)
tree, err := iavl.NewMutableTree(db, 100)
require.NoError(t, err)
store := iavlstore.UnsafeNewStore(tree, 10, 10)
_ = mngr.GetStoreCache(sKey, store)
require.Equal(t, store, mngr.Unwrap(sKey))
@ -42,7 +46,9 @@ func TestStoreCache(t *testing.T) {
mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize)
sKey := types.NewKVStoreKey("test")
store := iavlstore.UnsafeNewStore(iavl.NewMutableTree(db, 100), 10, 10)
tree, err := iavl.NewMutableTree(db, 100)
require.NoError(t, err)
store := iavlstore.UnsafeNewStore(tree, 10, 10)
kvStore := mngr.GetStoreCache(sKey, store)
for i := uint(0); i < cache.DefaultCommitKVStoreCacheSize*2; i++ {

View File

@ -2,8 +2,9 @@ package cachekv
import (
"container/list"
"errors"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
dbm "github.com/tendermint/tm-db"
)
@ -12,15 +13,15 @@ import (
// Implements Iterator.
type memIterator struct {
start, end []byte
items []*cmn.KVPair
items []*tmkv.Pair
ascending bool
}
func newMemIterator(start, end []byte, items *list.List, ascending bool) *memIterator {
itemsInDomain := make([]*cmn.KVPair, 0)
itemsInDomain := make([]*tmkv.Pair, 0)
var entered bool
for e := items.Front(); e != nil; e = e.Next() {
item := e.Value.(*cmn.KVPair)
item := e.Value.(*tmkv.Pair)
if !dbm.IsKeyInDomain(item.Key, start, end) {
if entered {
break
@ -48,8 +49,8 @@ func (mi *memIterator) Valid() bool {
}
func (mi *memIterator) assertValid() {
if !mi.Valid() {
panic("memIterator is invalid")
if err := mi.Error(); err != nil {
panic(err)
}
}
@ -83,3 +84,13 @@ func (mi *memIterator) Close() {
mi.end = nil
mi.items = nil
}
// Error returns an error if the memIterator is invalid defined by the Valid
// method.
func (mi *memIterator) Error() error {
if !mi.Valid() {
return errors.New("invalid memIterator")
}
return nil
}

View File

@ -2,6 +2,7 @@ package cachekv
import (
"bytes"
"errors"
"github.com/cosmos/cosmos-sdk/store/types"
)
@ -149,6 +150,24 @@ func (iter *cacheMergeIterator) Close() {
iter.cache.Close()
}
// Error returns an error if the cacheMergeIterator is invalid defined by the
// Valid method.
func (iter *cacheMergeIterator) Error() error {
if !iter.Valid() {
return errors.New("invalid cacheMergeIterator")
}
return nil
}
// If not valid, panics.
// NOTE: May have side-effect of iterating over cache.
func (iter *cacheMergeIterator) assertValid() {
if err := iter.Error(); err != nil {
panic(err)
}
}
// Like bytes.Compare but opposite if not ascending.
func (iter *cacheMergeIterator) compare(a, b []byte) int {
if iter.ascending {
@ -176,7 +195,6 @@ func (iter *cacheMergeIterator) skipCacheDeletes(until []byte) {
// Returns whether the iterator is valid.
func (iter *cacheMergeIterator) skipUntilExistsOrInvalid() bool {
for {
// If parent is invalid, fast-forward cache.
if !iter.parent.Valid() {
iter.skipCacheDeletes(nil)
@ -224,11 +242,3 @@ func (iter *cacheMergeIterator) skipUntilExistsOrInvalid() bool {
}
}
}
// If not valid, panics.
// NOTE: May have side-effect of iterating over cache.
func (iter *cacheMergeIterator) assertValid() {
if !iter.Valid() {
panic("iterator is invalid")
}
}

View File

@ -7,12 +7,11 @@ import (
"sort"
"sync"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/store/tracekv"
"github.com/cosmos/cosmos-sdk/store/types"
)
// If value is nil but deleted is false, it means the parent doesn't have the
@ -175,12 +174,12 @@ func (store *Store) iterator(start, end []byte, ascending bool) types.Iterator {
// Constructs a slice of dirty items, to use w/ memIterator.
func (store *Store) dirtyItems(start, end []byte) {
unsorted := make([]*cmn.KVPair, 0)
unsorted := make([]*tmkv.Pair, 0)
for key := range store.unsortedCache {
cacheValue := store.cache[key]
if dbm.IsKeyInDomain([]byte(key), start, end) {
unsorted = append(unsorted, &cmn.KVPair{Key: []byte(key), Value: cacheValue.value})
unsorted = append(unsorted, &tmkv.Pair{Key: []byte(key), Value: cacheValue.value})
delete(store.unsortedCache, key)
}
}
@ -191,7 +190,7 @@ func (store *Store) dirtyItems(start, end []byte) {
for e := store.sortedCache.Front(); e != nil && len(unsorted) != 0; {
uitem := unsorted[0]
sitem := e.Value.(*cmn.KVPair)
sitem := e.Value.(*tmkv.Pair)
comp := bytes.Compare(uitem.Key, sitem.Key)
switch comp {
case -1:

View File

@ -5,7 +5,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
cmn "github.com/tendermint/tendermint/libs/common"
tmrand "github.com/tendermint/tendermint/libs/rand"
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/store/cachekv"
@ -318,7 +318,7 @@ const (
)
func randInt(n int) int {
return cmn.RandInt() % n
return tmrand.NewRand().Int() % n
}
// useful for replaying a error case if we find one
@ -387,7 +387,8 @@ func assertIterateDomain(t *testing.T, st types.KVStore, expectedN int) {
func assertIterateDomainCheck(t *testing.T, st types.KVStore, mem dbm.DB, r []keyRange) {
// iterate over each and check they match the other
itr := st.Iterator(nil, nil)
itr2 := mem.Iterator(nil, nil) // ground truth
itr2, err := mem.Iterator(nil, nil) // ground truth
require.NoError(t, err)
krc := newKeyRangeCounter(r)
i := 0
@ -417,7 +418,8 @@ func assertIterateDomainCheck(t *testing.T, st types.KVStore, mem dbm.DB, r []ke
func assertIterateDomainCompare(t *testing.T, st types.KVStore, mem dbm.DB) {
// iterate over each and check they match the other
itr := st.Iterator(nil, nil)
itr2 := mem.Iterator(nil, nil) // ground truth
itr2, err := mem.Iterator(nil, nil) // ground truth
require.NoError(t, err)
checkIterators(t, itr, itr2)
checkIterators(t, itr2, itr)
}

View File

@ -15,6 +15,60 @@ type Store struct {
dbm.DB
}
// Get wraps the underlying DB's Get method panicing on error.
func (dsa Store) Get(key []byte) []byte {
v, err := dsa.DB.Get(key)
if err != nil {
panic(err)
}
return v
}
// Has wraps the underlying DB's Has method panicing on error.
func (dsa Store) Has(key []byte) bool {
ok, err := dsa.DB.Has(key)
if err != nil {
panic(err)
}
return ok
}
// Set wraps the underlying DB's Set method panicing on error.
func (dsa Store) Set(key, value []byte) {
if err := dsa.DB.Set(key, value); err != nil {
panic(err)
}
}
// Delete wraps the underlying DB's Delete method panicing on error.
func (dsa Store) Delete(key []byte) {
if err := dsa.DB.Delete(key); err != nil {
panic(err)
}
}
// Iterator wraps the underlying DB's Iterator method panicing on error.
func (dsa Store) Iterator(start, end []byte) types.Iterator {
iter, err := dsa.DB.Iterator(start, end)
if err != nil {
panic(err)
}
return iter
}
// ReverseIterator wraps the underlying DB's ReverseIterator method panicing on error.
func (dsa Store) ReverseIterator(start, end []byte) types.Iterator {
iter, err := dsa.DB.ReverseIterator(start, end)
if err != nil {
panic(err)
}
return iter
}
// GetStoreType returns the type of the store.
func (Store) GetStoreType() types.StoreType {
return types.StoreTypeDB

View File

@ -3,28 +3,28 @@ package store
import (
"bytes"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/store/types"
)
// Gets the first item.
func First(st KVStore, start, end []byte) (kv cmn.KVPair, ok bool) {
func First(st KVStore, start, end []byte) (kv tmkv.Pair, ok bool) {
iter := st.Iterator(start, end)
if !iter.Valid() {
return kv, false
}
defer iter.Close()
return cmn.KVPair{Key: iter.Key(), Value: iter.Value()}, true
return tmkv.Pair{Key: iter.Key(), Value: iter.Value()}, true
}
// Gets the last item. `end` is exclusive.
func Last(st KVStore, start, end []byte) (kv cmn.KVPair, ok bool) {
func Last(st KVStore, start, end []byte) (kv tmkv.Pair, ok bool) {
iter := st.ReverseIterator(end, start)
if !iter.Valid() {
if v := st.Get(start); v != nil {
return cmn.KVPair{Key: types.Cp(start), Value: types.Cp(v)}, true
return tmkv.Pair{Key: types.Cp(start), Value: types.Cp(v)}, true
}
return kv, false
}
@ -38,5 +38,5 @@ func Last(st KVStore, start, end []byte) (kv cmn.KVPair, ok bool) {
}
}
return cmn.KVPair{Key: iter.Key(), Value: iter.Value()}, true
return tmkv.Pair{Key: iter.Key(), Value: iter.Value()}, true
}

View File

@ -160,6 +160,11 @@ func (gi *gasIterator) Close() {
gi.parent.Close()
}
// Error delegates the Error call to the parent iterator.
func (gi *gasIterator) Error() error {
return gi.parent.Error()
}
// consumeSeekGas consumes a flat gas cost for seeking and a variable gas cost
// based on the current value's length.
func (gi *gasIterator) consumeSeekGas() {

View File

@ -4,17 +4,17 @@ import (
"io"
"sync"
"github.com/cosmos/cosmos-sdk/store/cachekv"
"github.com/cosmos/cosmos-sdk/store/tracekv"
"github.com/cosmos/cosmos-sdk/store/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/pkg/errors"
"github.com/tendermint/iavl"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/merkle"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/store/cachekv"
"github.com/cosmos/cosmos-sdk/store/tracekv"
"github.com/cosmos/cosmos-sdk/store/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const (
@ -49,9 +49,11 @@ type Store struct {
// store's version (id) from the provided DB. An error is returned if the version
// fails to load.
func LoadStore(db dbm.DB, id types.CommitID, pruning types.PruningOptions, lazyLoading bool) (types.CommitKVStore, error) {
tree := iavl.NewMutableTree(db, defaultIAVLCacheSize)
tree, err := iavl.NewMutableTree(db, defaultIAVLCacheSize)
if err != nil {
return nil, err
}
var err error
if lazyLoading {
_, err = tree.LazyLoadVersion(id.Version)
} else {
@ -250,7 +252,7 @@ func (st *Store) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
res.Key = key
if !st.VersionExists(res.Height) {
res.Log = cmn.ErrorWrap(iavl.ErrVersionDoesNotExist, "").Error()
res.Log = iavl.ErrVersionDoesNotExist.Error()
break
}
@ -269,11 +271,11 @@ func (st *Store) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
if value != nil {
// value was found
res.Value = value
res.Proof = &merkle.Proof{Ops: []merkle.ProofOp{iavl.NewIAVLValueOp(key, proof).ProofOp()}}
res.Proof = &merkle.Proof{Ops: []merkle.ProofOp{iavl.NewValueOp(key, proof).ProofOp()}}
} else {
// value wasn't found
res.Value = nil
res.Proof = &merkle.Proof{Ops: []merkle.ProofOp{iavl.NewIAVLAbsenceOp(key, proof).ProofOp()}}
res.Proof = &merkle.Proof{Ops: []merkle.ProofOp{iavl.NewAbsenceOp(key, proof).ProofOp()}}
}
} else {
_, res.Value = tree.GetVersioned(key, res.Height)
@ -314,7 +316,7 @@ type iavlIterator struct {
tree *iavl.ImmutableTree
// Channel to push iteration values.
iterCh chan cmn.KVPair
iterCh chan tmkv.Pair
// Close this to release goroutine.
quitCh chan struct{}
@ -340,7 +342,7 @@ func newIAVLIterator(tree *iavl.ImmutableTree, start, end []byte, ascending bool
start: types.Cp(start),
end: types.Cp(end),
ascending: ascending,
iterCh: make(chan cmn.KVPair), // Set capacity > 0?
iterCh: make(chan tmkv.Pair), // Set capacity > 0?
quitCh: make(chan struct{}),
initCh: make(chan struct{}),
}
@ -357,7 +359,7 @@ func (iter *iavlIterator) iterateRoutine() {
select {
case <-iter.quitCh:
return true // done with iteration.
case iter.iterCh <- cmn.KVPair{Key: key, Value: value}:
case iter.iterCh <- tmkv.Pair{Key: key, Value: value}:
return false // yay.
}
},
@ -427,6 +429,11 @@ func (iter *iavlIterator) Close() {
}
}
// Error performs a no-op.
func (iter *iavlIterator) Error() error {
return nil
}
//----------------------------------------
func (iter *iavlIterator) setNext(key, value []byte) {

View File

@ -1,14 +1,13 @@
package iavl
import (
crand "crypto/rand"
"fmt"
"testing"
"github.com/stretchr/testify/require"
"github.com/tendermint/iavl"
abci "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/store/types"
@ -28,19 +27,31 @@ var (
nMoreData = 0
)
func randBytes(numBytes int) []byte {
b := make([]byte, numBytes)
_, _ = crand.Read(b)
return b
}
// make a tree with data from above and save it
func newAlohaTree(t *testing.T, db dbm.DB) (*iavl.MutableTree, types.CommitID) {
tree := iavl.NewMutableTree(db, cacheSize)
tree, err := iavl.NewMutableTree(db, cacheSize)
require.NoError(t, err)
for k, v := range treeData {
tree.Set([]byte(k), []byte(v))
}
for i := 0; i < nMoreData; i++ {
key := cmn.RandBytes(12)
value := cmn.RandBytes(50)
key := randBytes(12)
value := randBytes(50)
tree.Set(key, value)
}
hash, ver, err := tree.SaveVersion()
require.Nil(t, err)
return tree, types.CommitID{Version: ver, Hash: hash}
}
@ -204,7 +215,10 @@ func TestIAVLIterator(t *testing.T) {
func TestIAVLReverseIterator(t *testing.T) {
db := dbm.NewMemDB()
tree := iavl.NewMutableTree(db, cacheSize)
tree, err := iavl.NewMutableTree(db, cacheSize)
require.NoError(t, err)
iavlStore := UnsafeNewStore(tree, numRecent, storeEvery)
iavlStore.Set([]byte{0x00}, []byte("0"))
@ -235,7 +249,9 @@ func TestIAVLReverseIterator(t *testing.T) {
func TestIAVLPrefixIterator(t *testing.T) {
db := dbm.NewMemDB()
tree := iavl.NewMutableTree(db, cacheSize)
tree, err := iavl.NewMutableTree(db, cacheSize)
require.NoError(t, err)
iavlStore := UnsafeNewStore(tree, numRecent, storeEvery)
iavlStore.Set([]byte("test1"), []byte("test1"))
@ -297,7 +313,9 @@ func TestIAVLPrefixIterator(t *testing.T) {
func TestIAVLReversePrefixIterator(t *testing.T) {
db := dbm.NewMemDB()
tree := iavl.NewMutableTree(db, cacheSize)
tree, err := iavl.NewMutableTree(db, cacheSize)
require.NoError(t, err)
iavlStore := UnsafeNewStore(tree, numRecent, storeEvery)
iavlStore.Set([]byte("test1"), []byte("test1"))
@ -416,59 +434,75 @@ type pruneState struct {
func testPruning(t *testing.T, numRecent int64, storeEvery int64, states []pruneState) {
db := dbm.NewMemDB()
tree := iavl.NewMutableTree(db, cacheSize)
tree, err := iavl.NewMutableTree(db, cacheSize)
require.NoError(t, err)
iavlStore := UnsafeNewStore(tree, numRecent, storeEvery)
for step, state := range states {
for _, ver := range state.stored {
require.True(t, iavlStore.VersionExists(ver),
"Missing version %d with latest version %d. Should save last %d and every %d",
ver, step, numRecent, storeEvery)
}
for _, ver := range state.deleted {
require.False(t, iavlStore.VersionExists(ver),
"Unpruned version %d with latest version %d. Should prune all but last %d and every %d",
ver, step, numRecent, storeEvery)
}
nextVersion(iavlStore)
}
}
func TestIAVLNoPrune(t *testing.T) {
db := dbm.NewMemDB()
tree := iavl.NewMutableTree(db, cacheSize)
tree, err := iavl.NewMutableTree(db, cacheSize)
require.NoError(t, err)
iavlStore := UnsafeNewStore(tree, numRecent, int64(1))
nextVersion(iavlStore)
for i := 1; i < 100; i++ {
for j := 1; j <= i; j++ {
require.True(t, iavlStore.VersionExists(int64(j)),
"Missing version %d with latest version %d. Should be storing all versions",
j, i)
}
nextVersion(iavlStore)
}
}
func TestIAVLPruneEverything(t *testing.T) {
db := dbm.NewMemDB()
tree := iavl.NewMutableTree(db, cacheSize)
tree, err := iavl.NewMutableTree(db, cacheSize)
require.NoError(t, err)
iavlStore := UnsafeNewStore(tree, int64(0), int64(0))
nextVersion(iavlStore)
for i := 1; i < 100; i++ {
for j := 1; j < i; j++ {
require.False(t, iavlStore.VersionExists(int64(j)),
"Unpruned version %d with latest version %d. Should prune all old versions",
j, i)
}
require.True(t, iavlStore.VersionExists(int64(i)),
"Missing current version on step %d, should not prune current state tree",
i)
nextVersion(iavlStore)
}
}
func TestIAVLStoreQuery(t *testing.T) {
db := dbm.NewMemDB()
tree := iavl.NewMutableTree(db, cacheSize)
tree, err := iavl.NewMutableTree(db, cacheSize)
require.NoError(t, err)
iavlStore := UnsafeNewStore(tree, numRecent, storeEvery)
k1, v1 := []byte("key1"), []byte("val1")
@ -559,17 +593,22 @@ func TestIAVLStoreQuery(t *testing.T) {
func BenchmarkIAVLIteratorNext(b *testing.B) {
db := dbm.NewMemDB()
treeSize := 1000
tree := iavl.NewMutableTree(db, cacheSize)
tree, err := iavl.NewMutableTree(db, cacheSize)
require.NoError(b, err)
for i := 0; i < treeSize; i++ {
key := cmn.RandBytes(4)
value := cmn.RandBytes(50)
key := randBytes(4)
value := randBytes(50)
tree.Set(key, value)
}
iavlStore := UnsafeNewStore(tree, numRecent, storeEvery)
iterators := make([]types.Iterator, b.N/treeSize)
for i := 0; i < len(iterators); i++ {
iterators[i] = iavlStore.Iterator([]byte{0}, []byte{255, 255, 255, 255, 255})
}
b.ResetTimer()
for i := 0; i < len(iterators); i++ {
iter := iterators[i]

View File

@ -2,6 +2,7 @@ package prefix
import (
"bytes"
"errors"
"io"
"github.com/cosmos/cosmos-sdk/store/cachekv"
@ -176,6 +177,16 @@ func (iter *prefixIterator) Close() {
iter.iter.Close()
}
// Error returns an error if the prefixIterator is invalid defined by the Valid
// method.
func (iter *prefixIterator) Error() error {
if !iter.Valid() {
return errors.New("invalid prefixIterator")
}
return nil
}
// copied from github.com/tendermint/tendermint/libs/db/prefix_db.go
func stripPrefix(key []byte, prefix []byte) []byte {
if len(key) < len(prefix) || !bytes.Equal(key[:len(prefix)], prefix) {

View File

@ -88,7 +88,8 @@ func testPrefixStore(t *testing.T, baseStore types.KVStore, prefix []byte) {
func TestIAVLStorePrefix(t *testing.T) {
db := dbm.NewMemDB()
tree := tiavl.NewMutableTree(db, cacheSize)
tree, err := tiavl.NewMutableTree(db, cacheSize)
require.NoError(t, err)
iavlStore := iavl.UnsafeNewStore(tree, numRecent, storeEvery)
testPrefixStore(t, iavlStore, []byte("test"))

View File

@ -2,11 +2,11 @@ package rootmulti
import (
"bytes"
"errors"
"fmt"
"github.com/tendermint/iavl"
"github.com/tendermint/tendermint/crypto/merkle"
cmn "github.com/tendermint/tendermint/libs/common"
)
// MultiStoreProof defines a collection of store proofs in a multi-store
@ -63,7 +63,7 @@ func NewMultiStoreProofOp(key []byte, proof *MultiStoreProof) MultiStoreProofOp
// given proof operation.
func MultiStoreProofOpDecoder(pop merkle.ProofOp) (merkle.ProofOperator, error) {
if pop.Type != ProofOpMultiStore {
return nil, cmn.NewError("unexpected ProofOp.Type; got %v, want %v", pop.Type, ProofOpMultiStore)
return nil, fmt.Errorf("unexpected ProofOp.Type; got %v, want %v", pop.Type, ProofOpMultiStore)
}
// XXX: a bit strange as we'll discard this, but it works
@ -71,7 +71,7 @@ func MultiStoreProofOpDecoder(pop merkle.ProofOp) (merkle.ProofOperator, error)
err := cdc.UnmarshalBinaryLengthPrefixed(pop.Data, &op)
if err != nil {
return nil, cmn.ErrorWrap(err, "decoding ProofOp.Data into MultiStoreProofOp")
return nil, fmt.Errorf("decoding ProofOp.Data into MultiStoreProofOp: %w", err)
}
return NewMultiStoreProofOp(pop.Key, op.Proof), nil
@ -103,7 +103,7 @@ func (op MultiStoreProofOp) GetKey() []byte {
// error otherwise.
func (op MultiStoreProofOp) Run(args [][]byte) ([][]byte, error) {
if len(args) != 1 {
return nil, cmn.NewError("Value size is not 1")
return nil, errors.New("value size is not 1")
}
value := args[0]
@ -115,11 +115,11 @@ func (op MultiStoreProofOp) Run(args [][]byte) ([][]byte, error) {
return [][]byte{root}, nil
}
return nil, cmn.NewError("hash mismatch for substore %v: %X vs %X", si.Name, si.Core.CommitID.Hash, value)
return nil, fmt.Errorf("hash mismatch for substore %v: %X vs %X", si.Name, si.Core.CommitID.Hash, value)
}
}
return nil, cmn.NewError("key %v not found in multistore proof", op.key)
return nil, fmt.Errorf("key %v not found in multistore proof", op.key)
}
//-----------------------------------------------------------------------------
@ -129,8 +129,8 @@ func (op MultiStoreProofOp) Run(args [][]byte) ([][]byte, error) {
func DefaultProofRuntime() (prt *merkle.ProofRuntime) {
prt = merkle.NewProofRuntime()
prt.RegisterOpDecoder(merkle.ProofOpSimpleValue, merkle.SimpleValueOpDecoder)
prt.RegisterOpDecoder(iavl.ProofOpIAVLValue, iavl.IAVLValueOpDecoder)
prt.RegisterOpDecoder(iavl.ProofOpIAVLAbsence, iavl.IAVLAbsenceOpDecoder)
prt.RegisterOpDecoder(iavl.ProofOpIAVLValue, iavl.ValueOpDecoder)
prt.RegisterOpDecoder(iavl.ProofOpIAVLAbsence, iavl.AbsenceOpDecoder)
prt.RegisterOpDecoder(ProofOpMultiStore, MultiStoreProofOpDecoder)
return
}

View File

@ -592,12 +592,14 @@ func (si storeInfo) Hash() []byte {
func getLatestVersion(db dbm.DB) int64 {
var latest int64
latestBytes := db.Get([]byte(latestVersionKey))
if latestBytes == nil {
latestBytes, err := db.Get([]byte(latestVersionKey))
if err != nil {
panic(err)
} else if latestBytes == nil {
return 0
}
err := cdc.UnmarshalBinaryLengthPrefixed(latestBytes, &latest)
err = cdc.UnmarshalBinaryLengthPrefixed(latestBytes, &latest)
if err != nil {
panic(err)
}
@ -643,14 +645,16 @@ func getCommitInfo(db dbm.DB, ver int64) (commitInfo, error) {
// Get from DB.
cInfoKey := fmt.Sprintf(commitInfoKeyFmt, ver)
cInfoBytes := db.Get([]byte(cInfoKey))
if cInfoBytes == nil {
return commitInfo{}, fmt.Errorf("failed to get Store: no data")
cInfoBytes, err := db.Get([]byte(cInfoKey))
if err != nil {
return commitInfo{}, fmt.Errorf("failed to get commit info: %v", err)
} else if cInfoBytes == nil {
return commitInfo{}, fmt.Errorf("failed to get commit info: no data")
}
var cInfo commitInfo
err := cdc.UnmarshalBinaryLengthPrefixed(cInfoBytes, &cInfo)
err = cdc.UnmarshalBinaryLengthPrefixed(cInfoBytes, &cInfo)
if err != nil {
return commitInfo{}, fmt.Errorf("failed to get Store: %v", err)
}

View File

@ -149,6 +149,11 @@ func (ti *traceIterator) Close() {
ti.parent.Close()
}
// Error delegates the Error call to the parent iterator.
func (ti *traceIterator) Error() error {
return ti.parent.Error()
}
// GetStoreType implements the KVStore interface. It returns the underlying
// KVStore type.
func (tkv *Store) GetStoreType() types.StoreType {

View File

@ -5,7 +5,7 @@ import (
"io"
abci "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
dbm "github.com/tendermint/tm-db"
)
@ -325,7 +325,7 @@ func (key *TransientStoreKey) String() string {
//----------------------------------------
// key-value result for iterator queries
type KVPair cmn.KVPair
type KVPair tmkv.Pair
//----------------------------------------

View File

@ -3,7 +3,7 @@ package types
import (
"bytes"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
)
// Iterator over all the keys with a certain prefix in ascending order
@ -18,7 +18,7 @@ func KVStoreReversePrefixIterator(kvs KVStore, prefix []byte) Iterator {
// DiffKVStores compares two KVstores and returns all the key/value pairs
// that differ from one another. It also skips value comparison for a set of provided prefixes
func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvAs, kvBs []cmn.KVPair) {
func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvAs, kvBs []tmkv.Pair) {
iterA := a.Iterator(nil, nil)
iterB := b.Iterator(nil, nil)
@ -26,13 +26,13 @@ func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvAs, kvBs []c
if !iterA.Valid() && !iterB.Valid() {
break
}
var kvA, kvB cmn.KVPair
var kvA, kvB tmkv.Pair
if iterA.Valid() {
kvA = cmn.KVPair{Key: iterA.Key(), Value: iterA.Value()}
kvA = tmkv.Pair{Key: iterA.Key(), Value: iterA.Value()}
iterA.Next()
}
if iterB.Valid() {
kvB = cmn.KVPair{Key: iterB.Key(), Value: iterB.Value()}
kvB = tmkv.Pair{Key: iterB.Key(), Value: iterB.Value()}
iterB.Next()
}
if !bytes.Equal(kvA.Key, kvB.Key) {

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -e
PKGS=$(go list ./... | grep -v '/simulation')
PKGS=$(go list ./... | grep -v '/simapp')
set -e
echo "mode: atomic" > coverage.txt

View File

@ -27,12 +27,16 @@ func WaitForNextHeightTM(port string) {
// Wait for N tendermint blocks to pass using the Tendermint RPC
// on localhost
func WaitForNextNBlocksTM(n int64, port string) {
// get the latest block and wait for n more
url := fmt.Sprintf("http://localhost:%v", port)
cl := tmclient.NewHTTP(url, "/websocket")
resBlock, err := cl.Block(nil)
cl, err := tmclient.NewHTTP(url, "/websocket")
if err != nil {
panic(fmt.Sprintf("failed to create Tendermint HTTP client: %s", err))
}
var height int64
resBlock, err := cl.Block(nil)
if err != nil || resBlock.Block == nil {
// wait for the first block to exist
WaitForHeightTM(1, port)
@ -40,6 +44,7 @@ func WaitForNextNBlocksTM(n int64, port string) {
} else {
height = resBlock.Block.Height + n
}
waitForHeightTM(height, url)
}
@ -51,7 +56,11 @@ func WaitForHeightTM(height int64, port string) {
}
func waitForHeightTM(height int64, url string) {
cl := tmclient.NewHTTP(url, "/websocket")
cl, err := tmclient.NewHTTP(url, "/websocket")
if err != nil {
panic(fmt.Sprintf("failed to create Tendermint HTTP client: %s", err))
}
for {
// get url, try a few times
var resBlock *ctypes.ResultBlock
@ -177,7 +186,11 @@ func WaitForStart(url string) {
// Wait for the RPC server to respond to /status
func WaitForRPC(laddr string) {
fmt.Println("LADDR", laddr)
client := rpcclient.NewJSONRPCClient(laddr)
client, err := rpcclient.NewJSONRPCClient(laddr)
if err != nil {
panic(fmt.Sprintf("failed to create Tendermint RPC client: %s", err))
}
ctypes.RegisterAmino(client.Codec())
result := new(ctypes.ResultStatus)
for {

View File

@ -6,7 +6,7 @@ import (
"strings"
abci "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
)
// ----------------------------------------------------------------------------
@ -86,8 +86,8 @@ func (a Attribute) String() string {
}
// ToKVPair converts an Attribute object into a Tendermint key/value pair.
func (a Attribute) ToKVPair() cmn.KVPair {
return cmn.KVPair{Key: toBytes(a.Key), Value: toBytes(a.Value)}
func (a Attribute) ToKVPair() tmkv.Pair {
return tmkv.Pair{Key: toBytes(a.Key), Value: toBytes(a.Value)}
}
// AppendAttributes adds one or more attributes to an Event.

View File

@ -3,8 +3,9 @@ package types
import (
"testing"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/codec"
)
func TestParseABCILog(t *testing.T) {

View File

@ -1,7 +1,7 @@
package types
import (
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store/types"
@ -28,7 +28,7 @@ type (
// StoreDecoderRegistry defines each of the modules store decoders. Used for ImportExport
// simulation.
type StoreDecoderRegistry map[string]func(cdc *codec.Codec, kvA, kvB cmn.KVPair) string
type StoreDecoderRegistry map[string]func(cdc *codec.Codec, kvA, kvB tmkv.Pair) string
// Iterator over all the keys with a certain prefix in ascending order
func KVStorePrefixIterator(kvs KVStore, prefix []byte) Iterator {
@ -54,7 +54,7 @@ func KVStoreReversePrefixIteratorPaginated(kvs KVStore, prefix []byte, page, lim
// DiffKVStores compares two KVstores and returns all the key/value pairs
// that differ from one another. It also skips value comparison for a set of provided prefixes
func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvAs, kvBs []cmn.KVPair) {
func DiffKVStores(a KVStore, b KVStore, prefixesToSkip [][]byte) (kvAs, kvBs []tmkv.Pair) {
return types.DiffKVStores(a, b, prefixesToSkip)
}

View File

@ -22,8 +22,6 @@ import (
const (
flagEvents = "events"
flagPage = "page"
flagLimit = "limit"
eventFormat = "{eventType}.{eventAttribute}={value}"
)
@ -116,8 +114,8 @@ $ %s query txs --%s 'message.sender=cosmos1...&message.action=withdraw_delegator
tmEvents = append(tmEvents, event)
}
page := viper.GetInt(flagPage)
limit := viper.GetInt(flagLimit)
page := viper.GetInt(flags.FlagPage)
limit := viper.GetInt(flags.FlagLimit)
cliCtx := context.NewCLIContext().WithCodec(cdc)
txs, err := utils.QueryTxsByEvents(cliCtx, tmEvents, page, limit)
@ -148,8 +146,8 @@ $ %s query txs --%s 'message.sender=cosmos1...&message.action=withdraw_delegator
viper.BindPFlag(flags.FlagTrustNode, cmd.Flags().Lookup(flags.FlagTrustNode))
cmd.Flags().String(flagEvents, "", fmt.Sprintf("list of transaction events in the form of %s", eventFormat))
cmd.Flags().Uint32(flagPage, rest.DefaultPage, "Query a specific page of paginated results")
cmd.Flags().Uint32(flagLimit, rest.DefaultLimit, "Query number of transactions results per page returned")
cmd.Flags().Uint32(flags.FlagPage, rest.DefaultPage, "Query a specific page of paginated results")
cmd.Flags().Uint32(flags.FlagLimit, rest.DefaultLimit, "Query number of transactions results per page returned")
cmd.MarkFlagRequired(flagEvents)
return cmd

View File

@ -4,7 +4,7 @@ import (
"bytes"
"fmt"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/auth/exported"
@ -12,7 +12,7 @@ import (
)
// DecodeStore unmarshals the KVPair's Value to the corresponding auth type
func DecodeStore(cdc *codec.Codec, kvA, kvB cmn.KVPair) string {
func DecodeStore(cdc *codec.Codec, kvA, kvB tmkv.Pair) string {
switch {
case bytes.Equal(kvA.Key[:1], types.AddressStoreKeyPrefix):
var accA, accB exported.Account

View File

@ -7,7 +7,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto/ed25519"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -32,10 +32,10 @@ func TestDecodeStore(t *testing.T) {
acc := types.NewBaseAccountWithAddress(delAddr1)
globalAccNumber := uint64(10)
kvPairs := cmn.KVPairs{
cmn.KVPair{Key: types.AddressStoreKey(delAddr1), Value: cdc.MustMarshalBinaryBare(acc)},
cmn.KVPair{Key: types.GlobalAccountNumberKey, Value: cdc.MustMarshalBinaryLengthPrefixed(globalAccNumber)},
cmn.KVPair{Key: []byte{0x99}, Value: []byte{0x99}},
kvPairs := tmkv.Pairs{
tmkv.Pair{Key: types.AddressStoreKey(delAddr1), Value: cdc.MustMarshalBinaryBare(acc)},
tmkv.Pair{Key: types.GlobalAccountNumberKey, Value: cdc.MustMarshalBinaryLengthPrefixed(globalAccNumber)},
tmkv.Pair{Key: []byte{0x99}, Value: []byte{0x99}},
}
tests := []struct {
name string

View File

@ -3,9 +3,10 @@ package bank_test
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/supply"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto"

View File

@ -4,12 +4,9 @@ import (
"testing"
"time"
"github.com/cosmos/cosmos-sdk/x/supply"
"github.com/tendermint/tendermint/libs/common"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
tmkv "github.com/tendermint/tendermint/libs/kv"
tmtime "github.com/tendermint/tendermint/types/time"
"github.com/cosmos/cosmos-sdk/simapp"
@ -18,6 +15,7 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
keep "github.com/cosmos/cosmos-sdk/x/bank/internal/keeper"
"github.com/cosmos/cosmos-sdk/x/bank/internal/types"
"github.com/cosmos/cosmos-sdk/x/supply"
)
func TestKeeper(t *testing.T) {
@ -168,21 +166,21 @@ func TestMsgSendEvents(t *testing.T) {
require.Equal(t, 2, len(events))
event1 := sdk.Event{
Type: types.EventTypeTransfer,
Attributes: []common.KVPair{},
Attributes: []tmkv.Pair{},
}
event1.Attributes = append(
event1.Attributes,
common.KVPair{Key: []byte(types.AttributeKeyRecipient), Value: []byte(addr2.String())})
tmkv.Pair{Key: []byte(types.AttributeKeyRecipient), Value: []byte(addr2.String())})
event1.Attributes = append(
event1.Attributes,
common.KVPair{Key: []byte(sdk.AttributeKeyAmount), Value: []byte(newCoins.String())})
tmkv.Pair{Key: []byte(sdk.AttributeKeyAmount), Value: []byte(newCoins.String())})
event2 := sdk.Event{
Type: sdk.EventTypeMessage,
Attributes: []common.KVPair{},
Attributes: []tmkv.Pair{},
}
event2.Attributes = append(
event2.Attributes,
common.KVPair{Key: []byte(types.AttributeKeySender), Value: []byte(addr.String())})
tmkv.Pair{Key: []byte(types.AttributeKeySender), Value: []byte(addr.String())})
require.Equal(t, event1, events[0])
require.Equal(t, event2, events[1])

View File

@ -4,16 +4,15 @@ import (
"bytes"
"fmt"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/distribution/types"
)
// DecodeStore unmarshals the KVPair's Value to the corresponding distribution type
func DecodeStore(cdc *codec.Codec, kvA, kvB cmn.KVPair) string {
func DecodeStore(cdc *codec.Codec, kvA, kvB tmkv.Pair) string {
switch {
case bytes.Equal(kvA.Key[:1], types.FeePoolKey):
var feePoolA, feePoolB types.FeePool

View File

@ -7,11 +7,10 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto/ed25519"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/distribution/keeper"
"github.com/cosmos/cosmos-sdk/x/distribution/types"
)
@ -43,17 +42,17 @@ func TestDecodeDistributionStore(t *testing.T) {
currentRewards := types.NewValidatorCurrentRewards(decCoins, 5)
slashEvent := types.NewValidatorSlashEvent(10, sdk.OneDec())
kvPairs := cmn.KVPairs{
cmn.KVPair{Key: types.FeePoolKey, Value: cdc.MustMarshalBinaryLengthPrefixed(feePool)},
cmn.KVPair{Key: types.ProposerKey, Value: consAddr1.Bytes()},
cmn.KVPair{Key: keeper.GetValidatorOutstandingRewardsKey(valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(outstanding)},
cmn.KVPair{Key: keeper.GetDelegatorWithdrawAddrKey(delAddr1), Value: delAddr1.Bytes()},
cmn.KVPair{Key: keeper.GetDelegatorStartingInfoKey(valAddr1, delAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(info)},
cmn.KVPair{Key: keeper.GetValidatorHistoricalRewardsKey(valAddr1, 100), Value: cdc.MustMarshalBinaryLengthPrefixed(historicalRewards)},
cmn.KVPair{Key: keeper.GetValidatorCurrentRewardsKey(valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(currentRewards)},
cmn.KVPair{Key: keeper.GetValidatorAccumulatedCommissionKey(valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(commission)},
cmn.KVPair{Key: keeper.GetValidatorSlashEventKeyPrefix(valAddr1, 13), Value: cdc.MustMarshalBinaryLengthPrefixed(slashEvent)},
cmn.KVPair{Key: []byte{0x99}, Value: []byte{0x99}},
kvPairs := tmkv.Pairs{
tmkv.Pair{Key: types.FeePoolKey, Value: cdc.MustMarshalBinaryLengthPrefixed(feePool)},
tmkv.Pair{Key: types.ProposerKey, Value: consAddr1.Bytes()},
tmkv.Pair{Key: types.GetValidatorOutstandingRewardsKey(valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(outstanding)},
tmkv.Pair{Key: types.GetDelegatorWithdrawAddrKey(delAddr1), Value: delAddr1.Bytes()},
tmkv.Pair{Key: types.GetDelegatorStartingInfoKey(valAddr1, delAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(info)},
tmkv.Pair{Key: types.GetValidatorHistoricalRewardsKey(valAddr1, 100), Value: cdc.MustMarshalBinaryLengthPrefixed(historicalRewards)},
tmkv.Pair{Key: types.GetValidatorCurrentRewardsKey(valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(currentRewards)},
tmkv.Pair{Key: types.GetValidatorAccumulatedCommissionKey(valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(commission)},
tmkv.Pair{Key: types.GetValidatorSlashEventKeyPrefix(valAddr1, 13), Value: cdc.MustMarshalBinaryLengthPrefixed(slashEvent)},
tmkv.Pair{Key: []byte{0x99}, Value: []byte{0x99}},
}
tests := []struct {

View File

@ -3,9 +3,10 @@ package types
import (
"fmt"
"gopkg.in/yaml.v2"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/params"
"gopkg.in/yaml.v2"
)
const (

View File

@ -17,11 +17,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/evidence/internal/types"
)
const (
flagPage = "page"
flagLimit = "limit"
)
// GetQueryCmd returns the CLI command with all evidence module query commands
// mounted.
func GetQueryCmd(queryRoute string, cdc *codec.Codec) *cobra.Command {
@ -44,8 +39,8 @@ $ %s query %s --page=2 --limit=50
RunE: QueryEvidenceCmd(cdc),
}
cmd.Flags().Int(flagPage, 1, "pagination page of evidence to to query for")
cmd.Flags().Int(flagLimit, 100, "pagination limit of evidence to query for")
cmd.Flags().Int(flags.FlagPage, 1, "pagination page of evidence to to query for")
cmd.Flags().Int(flags.FlagLimit, 100, "pagination limit of evidence to query for")
cmd.AddCommand(flags.GetCommands(QueryParamsCmd(cdc))...)
@ -126,7 +121,7 @@ func queryEvidence(cdc *codec.Codec, cliCtx context.CLIContext, hash string) err
}
func queryAllEvidence(cdc *codec.Codec, cliCtx context.CLIContext) error {
params := types.NewQueryAllEvidenceParams(viper.GetInt(flagPage), viper.GetInt(flagLimit))
params := types.NewQueryAllEvidenceParams(viper.GetInt(flags.FlagPage), viper.GetInt(flags.FlagLimit))
bz, err := cdc.MarshalJSON(params)
if err != nil {
return fmt.Errorf("failed to marshal query params: %w", err)

View File

@ -3,7 +3,7 @@ package exported
import (
sdk "github.com/cosmos/cosmos-sdk/types"
cmn "github.com/tendermint/tendermint/libs/common"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
)
// Evidence defines the contract which concrete evidence types of misbehavior
@ -12,7 +12,7 @@ type Evidence interface {
Route() string
Type() string
String() string
Hash() cmn.HexBytes
Hash() tmbytes.HexBytes
ValidateBasic() error
// The consensus address of the malicious validator at time of infraction

View File

@ -3,7 +3,7 @@ package keeper
import (
"fmt"
cmn "github.com/tendermint/tendermint/libs/common"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
"github.com/tendermint/tendermint/libs/log"
"github.com/cosmos/cosmos-sdk/codec"
@ -116,7 +116,7 @@ func (k Keeper) SetEvidence(ctx sdk.Context, evidence exported.Evidence) {
// GetEvidence retrieves Evidence by hash if it exists. If no Evidence exists for
// the given hash, (nil, false) is returned.
func (k Keeper) GetEvidence(ctx sdk.Context, hash cmn.HexBytes) (evidence exported.Evidence, found bool) {
func (k Keeper) GetEvidence(ctx sdk.Context, hash tmbytes.HexBytes) (evidence exported.Evidence, found bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefixEvidence)
bz := store.Get(hash)

View File

@ -4,7 +4,7 @@ import (
"testing"
"github.com/stretchr/testify/require"
cmn "github.com/tendermint/tendermint/libs/common"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -21,7 +21,7 @@ func (te testEvidence) Type() string { return "" }
func (te testEvidence) String() string { return "" }
func (te testEvidence) ValidateBasic() error { return nil }
func (te testEvidence) GetConsensusAddress() sdk.ConsAddress { return nil }
func (te testEvidence) Hash() cmn.HexBytes { return nil }
func (te testEvidence) Hash() tmbytes.HexBytes { return nil }
func (te testEvidence) GetHeight() int64 { return 0 }
func (te testEvidence) GetValidatorPower() int64 { return 0 }
func (te testEvidence) GetTotalPower() int64 { return 0 }

View File

@ -9,7 +9,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/tmhash"
cmn "github.com/tendermint/tendermint/libs/common"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
"gopkg.in/yaml.v2"
)
@ -42,7 +42,7 @@ func (e Equivocation) String() string {
}
// Hash returns the hash of an Equivocation object.
func (e Equivocation) Hash() cmn.HexBytes {
func (e Equivocation) Hash() tmbytes.HexBytes {
return tmhash.Sum(ModuleCdc.MustMarshalBinaryBare(e))
}

View File

@ -4,9 +4,10 @@ import (
"testing"
"time"
"github.com/stretchr/testify/require"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/evidence/internal/types"
"github.com/stretchr/testify/require"
)
func TestEquivocation_Valid(t *testing.T) {

View File

@ -19,7 +19,7 @@ import (
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/tmhash"
cmn "github.com/tendermint/tendermint/libs/common"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
)
var (
@ -38,7 +38,7 @@ type (
Height int64
Round int64
Timestamp time.Time
ValidatorAddress cmn.HexBytes
ValidatorAddress tmbytes.HexBytes
Signature []byte
}
@ -96,7 +96,7 @@ func (e TestEquivocationEvidence) ValidateBasic() error {
return nil
}
func (e TestEquivocationEvidence) Hash() cmn.HexBytes {
func (e TestEquivocationEvidence) Hash() tmbytes.HexBytes {
return tmhash.Sum(TestingCdc.MustMarshalBinaryBare(e))
}

View File

@ -11,14 +11,12 @@ import (
"path/filepath"
"github.com/pkg/errors"
"github.com/spf13/cobra"
flag "github.com/spf13/pflag"
"github.com/spf13/viper"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/libs/common"
tmos "github.com/tendermint/tendermint/libs/os"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/client/context"
@ -29,9 +27,8 @@ import (
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth/client/utils"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/client/utils"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/genutil/types"
)
@ -199,7 +196,7 @@ func GenTxCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager, sm
func makeOutputFilepath(rootDir, nodeID string) (string, error) {
writePath := filepath.Join(rootDir, "config", "gentx")
if err := common.EnsureDir(writePath, 0700); err != nil {
if err := tmos.EnsureDir(writePath, 0700); err != nil {
return "", err
}
return filepath.Join(writePath, fmt.Sprintf("gentx-%v.json", nodeID)), nil

View File

@ -11,7 +11,8 @@ import (
"github.com/spf13/viper"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/libs/common"
tmos "github.com/tendermint/tendermint/libs/os"
tmrand "github.com/tendermint/tendermint/libs/rand"
"github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/client/flags"
@ -72,7 +73,7 @@ func InitCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager,
chainID := viper.GetString(flags.FlagChainID)
if chainID == "" {
chainID = fmt.Sprintf("test-chain-%v", common.RandStr(6))
chainID = fmt.Sprintf("test-chain-%v", tmrand.Str(6))
}
nodeID, _, err := genutil.InitializeNodeValidatorFiles(config)
@ -83,7 +84,7 @@ func InitCmd(ctx *server.Context, cdc *codec.Codec, mbm module.BasicManager,
config.Moniker = args[0]
genFile := config.GenesisFile()
if !viper.GetBool(flagOverwrite) && common.FileExists(genFile) {
if !viper.GetBool(flagOverwrite) && tmos.FileExists(genFile) {
return fmt.Errorf("genesis.json file already exists: %v", genFile)
}
appState, err := codec.MarshalJSONIndent(cdc, mbm.DefaultGenesis())

View File

@ -5,7 +5,7 @@ import (
"errors"
"fmt"
"github.com/tendermint/tendermint/libs/common"
tmos "github.com/tendermint/tendermint/libs/os"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/codec"
@ -80,7 +80,7 @@ func GenesisStateFromGenDoc(cdc *codec.Codec, genDoc tmtypes.GenesisDoc,
func GenesisStateFromGenFile(cdc *codec.Codec, genFile string,
) (genesisState map[string]json.RawMessage, genDoc *tmtypes.GenesisDoc, err error) {
if !common.FileExists(genFile) {
if !tmos.FileExists(genFile) {
return genesisState, genDoc,
fmt.Errorf("%s does not exist, run `init` first", genFile)
}

View File

@ -7,7 +7,7 @@ import (
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/libs/common"
tmos "github.com/tendermint/tendermint/libs/os"
"github.com/tendermint/tendermint/p2p"
"github.com/tendermint/tendermint/privval"
tmtypes "github.com/tendermint/tendermint/types"
@ -59,12 +59,12 @@ func InitializeNodeValidatorFiles(config *cfg.Config,
server.UpgradeOldPrivValFile(config)
pvKeyFile := config.PrivValidatorKeyFile()
if err := common.EnsureDir(filepath.Dir(pvKeyFile), 0777); err != nil {
if err := tmos.EnsureDir(filepath.Dir(pvKeyFile), 0777); err != nil {
return nodeID, valPubKey, nil
}
pvStateFile := config.PrivValidatorStateFile()
if err := common.EnsureDir(filepath.Dir(pvStateFile), 0777); err != nil {
if err := tmos.EnsureDir(filepath.Dir(pvStateFile), 0777); err != nil {
return nodeID, valPubKey, nil
}

View File

@ -103,8 +103,8 @@ $ %s query gov proposals --page=2 --limit=100
bechDepositorAddr := viper.GetString(flagDepositor)
bechVoterAddr := viper.GetString(flagVoter)
strProposalStatus := viper.GetString(flagStatus)
page := viper.GetInt(flagPage)
limit := viper.GetInt(flagNumLimit)
page := viper.GetInt(flags.FlagPage)
limit := viper.GetInt(flags.FlagLimit)
var depositorAddr sdk.AccAddress
var voterAddr sdk.AccAddress
@ -162,8 +162,8 @@ $ %s query gov proposals --page=2 --limit=100
},
}
cmd.Flags().Int(flagPage, 1, "pagination page of proposals to to query for")
cmd.Flags().Int(flagNumLimit, 100, "pagination limit of proposals to query for")
cmd.Flags().Int(flags.FlagPage, 1, "pagination page of proposals to to query for")
cmd.Flags().Int(flags.FlagLimit, 100, "pagination limit of proposals to query for")
cmd.Flags().String(flagDepositor, "", "(optional) filter by proposals deposited on by depositor")
cmd.Flags().String(flagVoter, "", "(optional) filter by proposals voted on by voted")
cmd.Flags().String(flagStatus, "", "(optional) filter proposals by proposal status, status: deposit_period/voting_period/passed/rejected")
@ -265,8 +265,9 @@ $ %[1]s query gov votes 1 --page=2 --limit=100
if err != nil {
return fmt.Errorf("proposal-id %s not a valid int, please input a valid proposal-id", args[0])
}
page := viper.GetInt(flagPage)
limit := viper.GetInt(flagNumLimit)
page := viper.GetInt(flags.FlagPage)
limit := viper.GetInt(flags.FlagLimit)
params := types.NewQueryProposalVotesParams(proposalID, page, limit)
bz, err := cdc.MarshalJSON(params)
@ -299,8 +300,8 @@ $ %[1]s query gov votes 1 --page=2 --limit=100
return cliCtx.PrintOutput(votes)
},
}
cmd.Flags().Int(flagPage, 1, "pagination page of votes to to query for")
cmd.Flags().Int(flagNumLimit, 100, "pagination limit of votes to query for")
cmd.Flags().Int(flags.FlagPage, 1, "pagination page of votes to to query for")
cmd.Flags().Int(flags.FlagLimit, 100, "pagination limit of votes to query for")
return cmd
}

View File

@ -29,8 +29,6 @@ const (
flagVoter = "voter"
flagDepositor = "depositor"
flagStatus = "status"
flagNumLimit = "limit"
flagPage = "page"
FlagProposal = "proposal"
)

View File

@ -3,16 +3,17 @@ package utils
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/rpc/client/mock"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
tmtypes "github.com/tendermint/tendermint/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/rpc/client/mock"
ctypes "github.com/tendermint/tendermint/rpc/core/types"
tmtypes "github.com/tendermint/tendermint/types"
)
type TxSearchMock struct {

View File

@ -3,9 +3,10 @@ package gov
import (
"testing"
keep "github.com/cosmos/cosmos-sdk/x/gov/keeper"
"github.com/stretchr/testify/require"
keep "github.com/cosmos/cosmos-sdk/x/gov/keeper"
abci "github.com/tendermint/tendermint/abci/types"
)

View File

@ -3,8 +3,9 @@ package keeper
import (
"testing"
"github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/x/gov/types"
)
func TestIncrementProposalNumber(t *testing.T) {

View File

@ -6,10 +6,11 @@ import (
"testing"
"time"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/stretchr/testify/require"
)
func TestGetSetProposal(t *testing.T) {

View File

@ -5,14 +5,14 @@ import (
"encoding/binary"
"fmt"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/gov/types"
)
// DecodeStore unmarshals the KVPair's Value to the corresponding gov type
func DecodeStore(cdc *codec.Codec, kvA, kvB cmn.KVPair) string {
func DecodeStore(cdc *codec.Codec, kvA, kvB tmkv.Pair) string {
switch {
case bytes.Equal(kvA.Key[:1], types.ProposalsKeyPrefix):
var proposalA, proposalB types.Proposal

View File

@ -9,7 +9,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto/ed25519"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -41,12 +41,12 @@ func TestDecodeStore(t *testing.T) {
deposit := types.NewDeposit(1, delAddr1, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.OneInt())))
vote := types.NewVote(1, delAddr1, types.OptionYes)
kvPairs := cmn.KVPairs{
cmn.KVPair{Key: types.ProposalKey(1), Value: cdc.MustMarshalBinaryLengthPrefixed(proposal)},
cmn.KVPair{Key: types.InactiveProposalQueueKey(1, endTime), Value: proposalIDBz},
cmn.KVPair{Key: types.DepositKey(1, delAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(deposit)},
cmn.KVPair{Key: types.VoteKey(1, delAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(vote)},
cmn.KVPair{Key: []byte{0x99}, Value: []byte{0x99}},
kvPairs := tmkv.Pairs{
tmkv.Pair{Key: types.ProposalKey(1), Value: cdc.MustMarshalBinaryLengthPrefixed(proposal)},
tmkv.Pair{Key: types.InactiveProposalQueueKey(1, endTime), Value: proposalIDBz},
tmkv.Pair{Key: types.DepositKey(1, delAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(deposit)},
tmkv.Pair{Key: types.VoteKey(1, delAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(vote)},
tmkv.Pair{Key: []byte{0x99}, Value: []byte{0x99}},
}
tests := []struct {

View File

@ -4,14 +4,14 @@ import (
"bytes"
"fmt"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/mint/internal/types"
)
// DecodeStore unmarshals the KVPair's Value to the corresponding mint type
func DecodeStore(cdc *codec.Codec, kvA, kvB cmn.KVPair) string {
func DecodeStore(cdc *codec.Codec, kvA, kvB tmkv.Pair) string {
switch {
case bytes.Equal(kvA.Key, types.MinterKey):
var minterA, minterB types.Minter

View File

@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -23,9 +23,9 @@ func TestDecodeStore(t *testing.T) {
cdc := makeTestCodec()
minter := types.NewMinter(sdk.OneDec(), sdk.NewDec(15))
kvPairs := cmn.KVPairs{
cmn.KVPair{Key: types.MinterKey, Value: cdc.MustMarshalBinaryLengthPrefixed(minter)},
cmn.KVPair{Key: []byte{0x99}, Value: []byte{0x99}},
kvPairs := tmkv.Pairs{
tmkv.Pair{Key: types.MinterKey, Value: cdc.MustMarshalBinaryLengthPrefixed(minter)},
tmkv.Pair{Key: []byte{0x99}, Value: []byte{0x99}},
}
tests := []struct {
name string

View File

@ -5,14 +5,15 @@ import (
"testing"
"time"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/params/subspace"
"github.com/stretchr/testify/suite"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/store"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/params/subspace"
)
type SubspaceTestSuite struct {

View File

@ -4,8 +4,9 @@ import (
"testing"
"time"
"github.com/cosmos/cosmos-sdk/x/params/subspace"
"github.com/stretchr/testify/require"
"github.com/cosmos/cosmos-sdk/x/params/subspace"
)
func TestKeyTable(t *testing.T) {

View File

@ -8,7 +8,7 @@ import (
"time"
abci "github.com/tendermint/tendermint/abci/types"
cmn "github.com/tendermint/tendermint/libs/common"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmtypes "github.com/tendermint/tendermint/types"
)
@ -61,7 +61,7 @@ func (vals mockValidators) getKeys() []string {
//_________________________________________________________________________________
// randomProposer picks a random proposer from the current validator set
func (vals mockValidators) randomProposer(r *rand.Rand) cmn.HexBytes {
func (vals mockValidators) randomProposer(r *rand.Rand) tmbytes.HexBytes {
keys := vals.getKeys()
if len(keys) == 0 {
return nil

View File

@ -5,7 +5,7 @@ import (
"fmt"
"github.com/tendermint/tendermint/crypto"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -13,7 +13,7 @@ import (
)
// DecodeStore unmarshals the KVPair's Value to the corresponding slashing type
func DecodeStore(cdc *codec.Codec, kvA, kvB cmn.KVPair) string {
func DecodeStore(cdc *codec.Codec, kvA, kvB tmkv.Pair) string {
switch {
case bytes.Equal(kvA.Key[:1], types.ValidatorSigningInfoKey):
var infoA, infoB types.ValidatorSigningInfo

View File

@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto/ed25519"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -38,11 +38,11 @@ func TestDecodeStore(t *testing.T) {
bechPK := sdk.MustBech32ifyPubKey(sdk.Bech32PubKeyTypeAccPub, delPk1)
missed := true
kvPairs := cmn.KVPairs{
cmn.KVPair{Key: types.GetValidatorSigningInfoKey(consAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(info)},
cmn.KVPair{Key: types.GetValidatorMissedBlockBitArrayKey(consAddr1, 6), Value: cdc.MustMarshalBinaryLengthPrefixed(missed)},
cmn.KVPair{Key: types.GetAddrPubkeyRelationKey(delAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(delPk1)},
cmn.KVPair{Key: []byte{0x99}, Value: []byte{0x99}},
kvPairs := tmkv.Pairs{
tmkv.Pair{Key: types.GetValidatorSigningInfoKey(consAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(info)},
tmkv.Pair{Key: types.GetValidatorMissedBlockBitArrayKey(consAddr1, 6), Value: cdc.MustMarshalBinaryLengthPrefixed(missed)},
tmkv.Pair{Key: types.GetAddrPubkeyRelationKey(delAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(delPk1)},
tmkv.Pair{Key: []byte{0x99}, Value: []byte{0x99}},
}
tests := []struct {

View File

@ -1,9 +1,10 @@
package staking
import (
abci "github.com/tendermint/tendermint/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/staking/keeper"
abci "github.com/tendermint/tendermint/abci/types"
)
// BeginBlocker will persist the current header and validator set as a historical entry

View File

@ -3,7 +3,7 @@ package staking
import (
"time"
"github.com/tendermint/tendermint/libs/common"
tmstrings "github.com/tendermint/tendermint/libs/strings"
tmtypes "github.com/tendermint/tendermint/types"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -61,7 +61,7 @@ func handleMsgCreateValidator(ctx sdk.Context, msg types.MsgCreateValidator, k k
if ctx.ConsensusParams() != nil {
tmPubKey := tmtypes.TM2PB.PubKey(msg.PubKey)
if !common.StringInSlice(tmPubKey.Type, ctx.ConsensusParams().Validator.PubKeyTypes) {
if !tmstrings.StringInSlice(tmPubKey.Type, ctx.ConsensusParams().Validator.PubKeyTypes) {
return nil, sdkerrors.Wrapf(
ErrValidatorPubKeyTypeNotSupported,
"got: %s, valid: %s", tmPubKey.Type, ctx.ConsensusParams().Validator.PubKeyTypes,

View File

@ -4,9 +4,10 @@ import (
"sort"
"testing"
abci "github.com/tendermint/tendermint/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/staking/types"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/stretchr/testify/require"
)

View File

@ -4,7 +4,7 @@ import (
"bytes"
"fmt"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -12,7 +12,7 @@ import (
)
// DecodeStore unmarshals the KVPair's Value to the corresponding staking type
func DecodeStore(cdc *codec.Codec, kvA, kvB cmn.KVPair) string {
func DecodeStore(cdc *codec.Codec, kvA, kvB tmkv.Pair) string {
switch {
case bytes.Equal(kvA.Key[:1], types.LastTotalPowerKey):
var powerA, powerB sdk.Int

View File

@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/crypto/ed25519"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -39,14 +39,14 @@ func TestDecodeStore(t *testing.T) {
ubd := types.NewUnbondingDelegation(delAddr1, valAddr1, 15, bondTime, sdk.OneInt())
red := types.NewRedelegation(delAddr1, valAddr1, valAddr1, 12, bondTime, sdk.OneInt(), sdk.OneDec())
kvPairs := cmn.KVPairs{
cmn.KVPair{Key: types.LastTotalPowerKey, Value: cdc.MustMarshalBinaryLengthPrefixed(sdk.OneInt())},
cmn.KVPair{Key: types.GetValidatorKey(valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(val)},
cmn.KVPair{Key: types.LastValidatorPowerKey, Value: valAddr1.Bytes()},
cmn.KVPair{Key: types.GetDelegationKey(delAddr1, valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(del)},
cmn.KVPair{Key: types.GetUBDKey(delAddr1, valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(ubd)},
cmn.KVPair{Key: types.GetREDKey(delAddr1, valAddr1, valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(red)},
cmn.KVPair{Key: []byte{0x99}, Value: []byte{0x99}},
kvPairs := tmkv.Pairs{
tmkv.Pair{Key: types.LastTotalPowerKey, Value: cdc.MustMarshalBinaryLengthPrefixed(sdk.OneInt())},
tmkv.Pair{Key: types.GetValidatorKey(valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(val)},
tmkv.Pair{Key: types.LastValidatorPowerKey, Value: valAddr1.Bytes()},
tmkv.Pair{Key: types.GetDelegationKey(delAddr1, valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(del)},
tmkv.Pair{Key: types.GetUBDKey(delAddr1, valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(ubd)},
tmkv.Pair{Key: types.GetREDKey(delAddr1, valAddr1, valAddr1), Value: cdc.MustMarshalBinaryLengthPrefixed(red)},
tmkv.Pair{Key: []byte{0x99}, Value: []byte{0x99}},
}
tests := []struct {

View File

@ -4,7 +4,7 @@ import (
"bytes"
"fmt"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/x/supply/internal/keeper"
@ -12,7 +12,7 @@ import (
)
// DecodeStore unmarshals the KVPair's Value to the corresponding supply type
func DecodeStore(cdc *codec.Codec, kvA, kvB cmn.KVPair) string {
func DecodeStore(cdc *codec.Codec, kvA, kvB tmkv.Pair) string {
switch {
case bytes.Equal(kvA.Key[:1], keeper.SupplyKey):
var supplyA, supplyB types.Supply

View File

@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
cmn "github.com/tendermint/tendermint/libs/common"
tmkv "github.com/tendermint/tendermint/libs/kv"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
@ -26,9 +26,9 @@ func TestDecodeStore(t *testing.T) {
totalSupply := types.NewSupply(sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 1000)))
kvPairs := cmn.KVPairs{
cmn.KVPair{Key: keeper.SupplyKey, Value: cdc.MustMarshalBinaryLengthPrefixed(totalSupply)},
cmn.KVPair{Key: []byte{0x99}, Value: []byte{0x99}},
kvPairs := tmkv.Pairs{
tmkv.Pair{Key: keeper.SupplyKey, Value: cdc.MustMarshalBinaryLengthPrefixed(totalSupply)},
tmkv.Pair{Key: []byte{0x99}, Value: []byte{0x99}},
}
tests := []struct {

View File

@ -2,6 +2,7 @@ package upgrade
import (
"fmt"
abci "github.com/tendermint/tendermint/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"

View File

@ -4,10 +4,11 @@ import (
"encoding/binary"
"fmt"
"github.com/spf13/cobra"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/codec"
upgrade "github.com/cosmos/cosmos-sdk/x/upgrade/internal/types"
"github.com/spf13/cobra"
)
// GetPlanCmd returns the query upgrade plan command

View File

@ -3,10 +3,11 @@ package keeper
import (
"encoding/binary"
abci "github.com/tendermint/tendermint/abci/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/upgrade/internal/types"
abci "github.com/tendermint/tendermint/abci/types"
)
// NewQuerier creates a querier for upgrade cli and REST endpoints

View File

@ -7,9 +7,10 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
sdk "github.com/cosmos/cosmos-sdk/types"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
sdk "github.com/cosmos/cosmos-sdk/types"
)
func mustParseTime(s string) time.Time {

View File

@ -6,6 +6,8 @@ import (
"github.com/gorilla/mux"
"github.com/spf13/cobra"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
@ -13,7 +15,6 @@ import (
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/upgrade/client/cli"
"github.com/cosmos/cosmos-sdk/x/upgrade/client/rest"
abci "github.com/tendermint/tendermint/abci/types"
)
// module codec