new library orders

This commit is contained in:
rigel rozanski 2017-07-19 04:51:36 -04:00
parent 8617841296
commit ac1ecc10c4
30 changed files with 55 additions and 43 deletions

View File

@ -7,10 +7,12 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/basecoin/modules/coin"
eyescli "github.com/tendermint/merkleeyes/client"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
"github.com/tendermint/basecoin/modules/coin"
)
const genesisFilepath = "./testdata/genesis.json"

View File

@ -15,19 +15,19 @@ import (
"github.com/spf13/pflag"
"github.com/spf13/viper"
"github.com/tendermint/light-client/certifiers"
"github.com/tendermint/light-client/certifiers/files"
"github.com/tendermint/tmlibs/cli"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tendermint/types"
"github.com/tendermint/light-client/certifiers"
"github.com/tendermint/light-client/certifiers/files"
)
var (
dirPerm = os.FileMode(0700)
)
//nolint
const (
SeedFlag = "seed"
HashFlag = "valhash"

View File

@ -8,12 +8,11 @@ import (
wire "github.com/tendermint/go-wire"
"github.com/tendermint/go-wire/data"
lc "github.com/tendermint/light-client"
"github.com/tendermint/light-client/proofs"
"github.com/tendermint/tendermint/rpc/client"
lc "github.com/tendermint/light-client"
"github.com/tendermint/basecoin/client/commands"
"github.com/tendermint/light-client/proofs"
)
// GetAndParseAppProof does most of the work of the query commands, but is quite

View File

@ -4,24 +4,25 @@ import (
"github.com/spf13/cobra"
"github.com/tendermint/go-wire/data"
"github.com/tendermint/light-client/proofs"
"github.com/tendermint/basecoin/client/commands"
"github.com/tendermint/light-client/proofs"
)
var KeyCmd = &cobra.Command{
// KeyQueryCmd - CLI command to query a state by key with proof
var KeyQueryCmd = &cobra.Command{
Use: "key [key]",
Short: "Handle proofs for state of abci app",
Long: `This will look up a given key in the abci app, verify the proof,
and output it as hex.
If you want json output, use an app-specific command that knows key and value structure.`,
RunE: commands.RequireInit(doKeyQuery),
RunE: commands.RequireInit(keyQueryCmd),
}
// Note: we cannot yse GetAndParseAppProof here, as we don't use go-wire to
// parse the object, but rather return the raw bytes
func doKeyQuery(cmd *cobra.Command, args []string) error {
func keyQueryCmd(cmd *cobra.Command, args []string) error {
// parse cli
height := GetHeight()
key, err := ParseHexKey(args, "key")

View File

@ -3,13 +3,16 @@ package proofs
import (
"github.com/spf13/cobra"
"github.com/tendermint/basecoin/client/commands"
"github.com/tendermint/light-client/proofs"
"github.com/tendermint/basecoin/client/commands"
)
//nolint TODO add description
var TxPresenters = proofs.NewPresenters()
var TxCmd = &cobra.Command{
// TxQueryCmd - CLI command to query a transaction with proof
var TxQueryCmd = &cobra.Command{
Use: "tx [txhash]",
Short: "Handle proofs of commited txs",
Long: `Proofs allows you to validate abci state with merkle proofs.
@ -18,10 +21,10 @@ These proofs tie the data to a checkpoint, which is managed by "seeds".
Here we can validate these proofs and import/export them to prove specific
data to other peers as needed.
`,
RunE: commands.RequireInit(doTxQuery),
RunE: commands.RequireInit(txQueryCmd),
}
func doTxQuery(cmd *cobra.Command, args []string) error {
func txQueryCmd(cmd *cobra.Command, args []string) error {
// parse cli
height := GetHeight()
bkey, err := ParseHexKey(args, "txhash")

View File

@ -7,14 +7,13 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
certclient "github.com/tendermint/light-client/certifiers/client"
"github.com/tendermint/tendermint/rpc/client"
"github.com/tendermint/tendermint/rpc/core"
rpc "github.com/tendermint/tendermint/rpc/lib/server"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
certclient "github.com/tendermint/light-client/certifiers/client"
"github.com/tendermint/basecoin/client/commands"
)

View File

@ -2,6 +2,7 @@ package rpc
import (
"github.com/spf13/cobra"
"github.com/tendermint/basecoin/client/commands"
)

View File

@ -6,9 +6,9 @@ import (
"github.com/spf13/cobra"
"github.com/tendermint/go-wire/data"
certclient "github.com/tendermint/light-client/certifiers/client"
"github.com/tendermint/tendermint/rpc/client"
certclient "github.com/tendermint/light-client/certifiers/client"
"github.com/tendermint/basecoin/client/commands"
)

View File

@ -3,6 +3,7 @@ package rpc
import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/basecoin/client/commands"
)

View File

@ -4,6 +4,7 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/basecoin/client/commands"
)

View File

@ -6,7 +6,9 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/light-client/certifiers"
"github.com/tendermint/basecoin/client/commands"
)

View File

@ -7,7 +7,9 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/light-client/certifiers"
"github.com/tendermint/basecoin/client/commands"
)

View File

@ -4,7 +4,9 @@ import (
"fmt"
"github.com/spf13/cobra"
"github.com/tendermint/light-client/certifiers"
"github.com/tendermint/basecoin/client/commands"
)

View File

@ -2,6 +2,7 @@ package txs
import (
"github.com/pkg/errors"
wire "github.com/tendermint/go-wire"
"github.com/tendermint/light-client/proofs"
ctypes "github.com/tendermint/tendermint/rpc/core/types"

View File

@ -9,6 +9,7 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/tendermint/basecoin"
)

View File

@ -8,8 +8,6 @@ import (
"path"
"strings"
//"github.com/pkg/errors"
"github.com/spf13/viper"
"github.com/tendermint/go-crypto"

View File

@ -3,9 +3,10 @@ package main
import (
"os"
"github.com/tendermint/tmlibs/cli"
"github.com/tendermint/basecoin/app"
"github.com/tendermint/basecoin/cmd/basecoin/commands"
"github.com/tendermint/tmlibs/cli"
)
func main() {

View File

@ -5,6 +5,7 @@ import (
"fmt"
abci "github.com/tendermint/abci/types"
"github.com/tendermint/basecoin/errors"
)

View File

@ -6,7 +6,6 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/basecoin/stack"
crypto "github.com/tendermint/go-crypto"
keys "github.com/tendermint/go-crypto/keys"
"github.com/tendermint/go-crypto/keys/cryptostore"
@ -14,6 +13,7 @@ import (
wire "github.com/tendermint/go-wire"
"github.com/tendermint/basecoin"
"github.com/tendermint/basecoin/stack"
)
func checkSignBytes(t *testing.T, bytes []byte, expected string) {

View File

@ -6,9 +6,8 @@ import (
"github.com/spf13/pflag"
"github.com/spf13/viper"
"github.com/tendermint/basecoin/client/commands"
"github.com/tendermint/basecoin"
"github.com/tendermint/basecoin/client/commands"
txcmd "github.com/tendermint/basecoin/client/commands/txs"
"github.com/tendermint/basecoin/modules/base"
)

View File

@ -4,9 +4,8 @@ package base
import (
"fmt"
pkgerrors "github.com/pkg/errors"
abci "github.com/tendermint/abci/types"
"github.com/tendermint/basecoin/errors"
)
@ -25,13 +24,11 @@ func IsNoChainErr(err error) bool {
return errors.IsSameError(errNoChain, err)
}
func ErrWrongChain(chain string) errors.TMError {
msg := pkgerrors.Wrap(errWrongChain, chain)
return errors.WithCode(msg, unauthorized)
return errors.WithMessage(chain, errWrongChain, unauthorized)
}
func IsWrongChainErr(err error) bool {
return errors.IsSameError(errWrongChain, err)
}
func ErrExpired() errors.TMError {
return errors.WithCode(errExpired, unauthorized)
}

View File

@ -7,10 +7,10 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/basecoin/stack"
"github.com/tendermint/go-wire/data"
"github.com/tendermint/basecoin"
"github.com/tendermint/basecoin/stack"
)
func TestEncoding(t *testing.T) {

View File

@ -4,10 +4,10 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
lcmd "github.com/tendermint/basecoin/client/commands"
proofcmd "github.com/tendermint/basecoin/client/commands/proofs"
lc "github.com/tendermint/light-client"
lcmd "github.com/tendermint/basecoin/client/commands"
proofcmd "github.com/tendermint/basecoin/client/commands/proofs"
"github.com/tendermint/basecoin/modules/auth"
"github.com/tendermint/basecoin/modules/coin"
"github.com/tendermint/basecoin/stack"

View File

@ -4,9 +4,8 @@ package coin
import (
"fmt"
pkgerrors "github.com/pkg/errors"
abci "github.com/tendermint/abci/types"
"github.com/tendermint/basecoin/errors"
)
@ -83,8 +82,7 @@ func IsNoOutputsErr(err error) bool {
}
func ErrUnknownKey(mod string) errors.TMError {
w := pkgerrors.Wrap(errUnknownKey, mod)
return errors.WithCode(w, unknownRequest)
return errors.WithMessage(mod, errUnknownKey, unknownRequest)
}
func IsUnknownKeyErr(err error) bool {
return errors.IsSameError(errUnknownKey, err)

View File

@ -1,11 +1,11 @@
package coin
import (
"github.com/tendermint/basecoin/modules/auth"
crypto "github.com/tendermint/go-crypto"
"github.com/tendermint/go-wire/data"
"github.com/tendermint/basecoin"
"github.com/tendermint/basecoin/modules/auth"
)
// AccountWithKey is a helper for tests, that includes and account

View File

@ -6,11 +6,11 @@ import (
"github.com/pkg/errors"
"github.com/spf13/cobra"
lc "github.com/tendermint/light-client"
"github.com/tendermint/basecoin"
lcmd "github.com/tendermint/basecoin/client/commands"
proofcmd "github.com/tendermint/basecoin/client/commands/proofs"
lc "github.com/tendermint/light-client"
"github.com/tendermint/basecoin/modules/nonce"
"github.com/tendermint/basecoin/stack"
)

View File

@ -5,6 +5,7 @@ import (
"fmt"
abci "github.com/tendermint/abci/types"
"github.com/tendermint/basecoin/errors"
)

View File

@ -4,6 +4,7 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/tendermint/basecoin"
"github.com/tendermint/basecoin/modules/roles"
"github.com/tendermint/basecoin/stack"

View File

@ -3,10 +3,11 @@ package roles
import (
"fmt"
wire "github.com/tendermint/go-wire"
"github.com/tendermint/basecoin"
"github.com/tendermint/basecoin/errors"
"github.com/tendermint/basecoin/state"
wire "github.com/tendermint/go-wire"
)
// NewPerm creates a role permission with the given label

View File

@ -6,11 +6,11 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/go-wire/data"
"github.com/tendermint/tmlibs/log"
"github.com/tendermint/basecoin"
"github.com/tendermint/basecoin/state"
"github.com/tendermint/go-wire/data"
)
// writerMid is a middleware that writes the given bytes on CheckTx and DeliverTx