diff --git a/client/ws_client.go b/client/ws_client.go index 2f562927f6a99bb19852570f46b185f0e3da6c7b..f2542c1a477eacb27d12f4e8f0f563c8e530b891 100644 --- a/client/ws_client.go +++ b/client/ws_client.go @@ -3,8 +3,9 @@ package client import ( "fmt" - "github.com/gorilla/websocket" "net/http" + + "github.com/gorilla/websocket" ) // A websocket client subscribes and unsubscribes to events diff --git a/consensus/consensus.go b/consensus/consensus.go index 369210beeb285994dd42fffdd32305e055316713..fb0fdab34cdcdf0677cfe3b05d1c138e93549a5a 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -33,6 +33,7 @@ func LoadConsensusEngineInPipe(moduleConfig *config.ModuleConfig, if err != nil { return fmt.Errorf("Failed to load Tendermint node: %v", err) } + if err := pipe.SetConsensusEngine(tendermintNode); err != nil { return fmt.Errorf("Failed to hand Tendermint node to pipe: %v", err) } diff --git a/definitions/do.go b/definitions/do.go index 0ad4e10880c0f21c72338f1a5ca466a966231e30..273dc34800250c750b842fd4e23576c3ef124912 100644 --- a/definitions/do.go +++ b/definitions/do.go @@ -48,7 +48,7 @@ type Do struct { // Zip bool // Tarball bool DisableRpc bool - Config *viper.Viper + Config *viper.Viper // Accounts []*Account // Result string } diff --git a/files/files_test.go b/files/files_test.go index 2d9cdc23ed1646f3acb242904015df3ba1418945..16943df7f53d6f5e899e89b26c224d68aa71705c 100644 --- a/files/files_test.go +++ b/files/files_test.go @@ -2,10 +2,11 @@ package files import ( "bytes" - "github.com/stretchr/testify/assert" "os" "path" "testing" + + "github.com/stretchr/testify/assert" ) var tempFolder = os.TempDir() diff --git a/manager/eris-mint/eris-mint.go b/manager/eris-mint/eris-mint.go index fb86908318454066ad3ba61f10d7e2cd2b49ed50..e5ba93082c4e2da52ff7c3875b5de1e65bd7418a 100644 --- a/manager/eris-mint/eris-mint.go +++ b/manager/eris-mint/eris-mint.go @@ -161,8 +161,6 @@ func (app *ErisMint) CheckTx(txBytes []byte) (res tmsp.Result) { return tmsp.NewError(tmsp.CodeType_EncodingError, fmt.Sprintf("Encoding error: %v", err)) } - log.Info("CheckTx", "tx", *tx) - // TODO: make errors tmsp aware err = sm.ExecTx(app.checkCache, *tx, false, nil) if err != nil { diff --git a/manager/eris-mint/evm/native.go b/manager/eris-mint/evm/native.go index 55b18a167bdcf68e7642679437f06703ca72b6b8..860f99bd252a9037168765f2d6aa207cb1df806e 100644 --- a/manager/eris-mint/evm/native.go +++ b/manager/eris-mint/evm/native.go @@ -2,6 +2,7 @@ package vm import ( "crypto/sha256" + "golang.org/x/crypto/ripemd160" . "github.com/tendermint/go-common" diff --git a/manager/eris-mint/evm/opcodes.go b/manager/eris-mint/evm/opcodes.go index 87e09bfdd75bc0c78f86010928f497da0abede1a..63e6b297958f105ca45ae85e7dee3055fa52868d 100644 --- a/manager/eris-mint/evm/opcodes.go +++ b/manager/eris-mint/evm/opcodes.go @@ -2,6 +2,7 @@ package vm import ( "fmt" + "gopkg.in/fatih/set.v0" ) diff --git a/manager/eris-mint/evm/stack.go b/manager/eris-mint/evm/stack.go index 979aba2e3ceb1a8d3f61bf4d7935094619579ed8..3f3d727f1fb8e78eb63226ecd952e2f9981ff3f9 100644 --- a/manager/eris-mint/evm/stack.go +++ b/manager/eris-mint/evm/stack.go @@ -2,6 +2,7 @@ package vm import ( "fmt" + . "github.com/tendermint/go-common" ) diff --git a/permission/types/permissions.go b/permission/types/permissions.go index cca221f86a3feb63610e4a02f468bce616439eec..5cdcdaf8ca1e8ba4f5a2e605ed90f3521c757740 100644 --- a/permission/types/permissions.go +++ b/permission/types/permissions.go @@ -2,6 +2,7 @@ package types import ( "fmt" + . "github.com/tendermint/go-common" ) diff --git a/rpc/rpc_test.go b/rpc/rpc_test.go index bfafa4c2f9861f01192de0ad9b9aba05897d304d..f728d822bd1251f9147aaeac9e199672b7092d25 100644 --- a/rpc/rpc_test.go +++ b/rpc/rpc_test.go @@ -1,8 +1,9 @@ package rpc import ( - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) // ... diff --git a/rpc/tendermint/test/common.go b/rpc/tendermint/test/common.go index d9ef3230b0310592654f06e9030056f04e2ee2a3..77be9cb188017e127a36c53b5b6e940e0813c56d 100644 --- a/rpc/tendermint/test/common.go +++ b/rpc/tendermint/test/common.go @@ -8,6 +8,7 @@ import ( // Needs to be in a _test.go file to be picked up func TestWrapper(runner func() int) int { ffs := fixtures.NewFileFixtures("Eris-DB") + defer ffs.RemoveAll() err := initGlobalVariables(ffs) diff --git a/rpc/tendermint/test/genesis.go b/rpc/tendermint/test/genesis.go index 61cf2e6b1d9d588b3ffe428cdaaa6b10c8518fb9..3136a9339323cbfd1f5508daae335de335c9ef10 100644 --- a/rpc/tendermint/test/genesis.go +++ b/rpc/tendermint/test/genesis.go @@ -38,12 +38,3 @@ var defaultGenesis = `{ } ] }` - -var defaultPrivValidator = `{ - "address": "1D7A91CB32F758A02EBB9BE1FB6F8DEE56F90D42", - "pub_key": [1,"06FBAC4E285285D1D91FCBC7E91C780ADA11516F67462340B3980CE2B94940E8"], - "priv_key": [1,"C453604BD6480D5538B4C6FD2E3E314B5BCE518D75ADE4DA3DA85AB8ADFD819606FBAC4E285285D1D91FCBC7E91C780ADA11516F67462340B3980CE2B94940E8"], - "last_height":0, - "last_round":0, - "last_step":0 -}` diff --git a/rpc/tendermint/test/shared.go b/rpc/tendermint/test/shared.go index 13ab2570589fec8a1aee96b39e8c0b6c009fdfd7..475e029b3d18bcc5811f1c77e8d412ce670e18bd 100644 --- a/rpc/tendermint/test/shared.go +++ b/rpc/tendermint/test/shared.go @@ -17,10 +17,11 @@ import ( "github.com/tendermint/go-crypto" rpcclient "github.com/tendermint/go-rpc/client" + "path" + "github.com/spf13/viper" tm_common "github.com/tendermint/go-common" "github.com/tendermint/tendermint/types" - "path" ) // global variables for use across all tests diff --git a/server/server_test.go b/server/server_test.go index 05d954b705fe5daf9980c7bd84d9b98dbb5c20b6..61569515529d3d9d650f018f2757cc0fc371cbe4 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -2,8 +2,9 @@ package server import ( //"fmt" - "github.com/stretchr/testify/assert" "testing" + + "github.com/stretchr/testify/assert" ) // Unit tests for server components goes here. Full-on client-server tests diff --git a/test/fixtures/file_fixtures.go b/test/fixtures/file_fixtures.go index 5935e54c20d7b9c4203f4a22680ff23ce6ee3a62..0e188762085e0bb14d3d011fcb0fb5ad442773ed 100644 --- a/test/fixtures/file_fixtures.go +++ b/test/fixtures/file_fixtures.go @@ -1,9 +1,10 @@ package fixtures import ( - "github.com/docker/docker/pkg/ioutils" "os" "path" + + "github.com/docker/docker/pkg/ioutils" ) // FileFixtures writes files to a temporary location for use in testing. @@ -25,6 +26,12 @@ func NewFileFixtures(identifyingPrefix string) *FileFixtures { } } +// Returns the root temporary directory that this FileFixtures will populate and +// clear on RemoveAll() +func (ffs *FileFixtures) TempDir() string { + return ffs.tempDir +} + // Add a file relative to the FileFixtures tempDir using name for the relative // part of the path. func (ffs *FileFixtures) AddFile(name, content string) string { diff --git a/test/mock/pipe.go b/test/mock/pipe.go index 413e6e1a37f51b9b54b929cb950cfd339f240bcf..4cec005042cda0373c528bcf53314d4c145c8881 100644 --- a/test/mock/pipe.go +++ b/test/mock/pipe.go @@ -2,11 +2,11 @@ package mock import ( "fmt" - - account "github.com/eris-ltd/eris-db/account" - core_types "github.com/eris-ltd/eris-db/core/types" - definitions "github.com/eris-ltd/eris-db/definitions" - event "github.com/eris-ltd/eris-db/event" + + account "github.com/eris-ltd/eris-db/account" + core_types "github.com/eris-ltd/eris-db/core/types" + definitions "github.com/eris-ltd/eris-db/definitions" + event "github.com/eris-ltd/eris-db/event" manager_types "github.com/eris-ltd/eris-db/manager/types" td "github.com/eris-ltd/eris-db/test/testdata/testdata" diff --git a/test/server/http_burst_test.go b/test/server/http_burst_test.go index c2a1e89d501c6c0f5bfeb7fc3f03597d2f07330d..bb49275b7d82c5ee10a35fb162a79852e95833eb 100644 --- a/test/server/http_burst_test.go +++ b/test/server/http_burst_test.go @@ -2,10 +2,11 @@ package server import ( // "fmt" - "github.com/stretchr/testify/assert" "net/http" "testing" "time" + + "github.com/stretchr/testify/assert" ) const ( diff --git a/test/server/ws_burst_test.go b/test/server/ws_burst_test.go index aef23a19a0a5e521212e8dc9aab01dc5afa16ddb..cb9e7af4f2037fdc52f4893f464c3436b406cff9 100644 --- a/test/server/ws_burst_test.go +++ b/test/server/ws_burst_test.go @@ -1,11 +1,12 @@ package server import ( + "testing" + "time" + "github.com/eris-ltd/eris-db/client" "github.com/eris-ltd/eris-db/server" "github.com/stretchr/testify/assert" - "testing" - "time" ) const CONNS uint16 = 100 diff --git a/test/testdata/helpers.go b/test/testdata/helpers.go index 2b2b2edbbe2bd7b4dd9d36c34d2e37bf5c228e55..127440f7eb185dcd360d13b9dc183c8983dc72ad 100644 --- a/test/testdata/helpers.go +++ b/test/testdata/helpers.go @@ -2,14 +2,16 @@ package testdata import ( "fmt" - "github.com/eris-ltd/eris-db/files" - "github.com/eris-ltd/eris-db/server" "os" "path" - . "github.com/tendermint/go-common" + "github.com/eris-ltd/eris-db/files" + "github.com/eris-ltd/eris-db/server" + stypes "github.com/eris-ltd/eris-db/manager/eris-mint/state/types" + . "github.com/tendermint/go-common" "github.com/tendermint/go-wire" + "github.com/tendermint/tendermint/types" ) const TendermintConfigDefault = `# This is a TOML config file. diff --git a/test/testdata/testdata/testdata.go b/test/testdata/testdata/testdata.go index 34c7c895bf9e32d94d066fdedbca54c2b21c6ddb..56894ecb5a55601ba90f8d542e458dfce66f7442 100644 --- a/test/testdata/testdata/testdata.go +++ b/test/testdata/testdata/testdata.go @@ -1,11 +1,11 @@ package testdata import ( - account "github.com/eris-ltd/eris-db/account" - core_types "github.com/eris-ltd/eris-db/core/types" - event "github.com/eris-ltd/eris-db/event" - rpc_v0 "github.com/eris-ltd/eris-db/rpc/v0" - stypes "github.com/eris-ltd/eris-db/manager/eris-mint/state/types" + account "github.com/eris-ltd/eris-db/account" + core_types "github.com/eris-ltd/eris-db/core/types" + event "github.com/eris-ltd/eris-db/event" + stypes "github.com/eris-ltd/eris-db/manager/eris-mint/state/types" + rpc_v0 "github.com/eris-ltd/eris-db/rpc/v0" transaction "github.com/eris-ltd/eris-db/txs" mintTypes "github.com/tendermint/tendermint/types" @@ -512,22 +512,22 @@ type ( GetAccountData struct { Input *rpc_v0.AddressParam `json:"input"` - Output *account.Account `json:"output"` + Output *account.Account `json:"output"` } GetAccountsData struct { - Input *rpc_v0.AccountsParam `json:"input"` - Output *core_types.AccountList `json:"output"` + Input *rpc_v0.AccountsParam `json:"input"` + Output *core_types.AccountList `json:"output"` } GetStorageData struct { Input *rpc_v0.AddressParam `json:"input"` - Output *core_types.Storage `json:"output"` + Output *core_types.Storage `json:"output"` } GetStorageAtData struct { - Input *rpc_v0.StorageAtParam `json:"input"` - Output *core_types.StorageItem `json:"output"` + Input *rpc_v0.StorageAtParam `json:"input"` + Output *core_types.StorageItem `json:"output"` } GenPrivAccountData struct { @@ -556,12 +556,12 @@ type ( GetBlockData struct { Input *rpc_v0.HeightParam `json:"input"` - Output *mintTypes.Block `json:"output"` + Output *mintTypes.Block `json:"output"` } GetBlocksData struct { - Input *rpc_v0.BlocksParam `json:"input"` - Output *core_types.Blocks `json:"output"` + Input *rpc_v0.BlocksParam `json:"input"` + Output *core_types.Blocks `json:"output"` } GetConsensusStateData struct { @@ -597,18 +597,18 @@ type ( } GetPeerData struct { - Input *rpc_v0.PeerParam `json:"input"` - Output *core_types.Peer `json:"output"` + Input *rpc_v0.PeerParam `json:"input"` + Output *core_types.Peer `json:"output"` } TransactData struct { Input *rpc_v0.TransactParam `json:"input"` - Output *transaction.Receipt `json:"output"` + Output *transaction.Receipt `json:"output"` } TransactCreateData struct { Input *rpc_v0.TransactParam `json:"input"` - Output *transaction.Receipt `json:"output"` + Output *transaction.Receipt `json:"output"` } GetUnconfirmedTxsData struct { @@ -617,36 +617,36 @@ type ( CallCodeData struct { Input *rpc_v0.CallCodeParam `json:"input"` - Output *core_types.Call `json:"output"` + Output *core_types.Call `json:"output"` } CallData struct { - Input *rpc_v0.CallParam `json:"input"` - Output *core_types.Call `json:"output"` + Input *rpc_v0.CallParam `json:"input"` + Output *core_types.Call `json:"output"` } EventSubscribeData struct { - Input *rpc_v0.EventIdParam `json:"input"` - Output *event.EventSub `json:"output"` + Input *rpc_v0.EventIdParam `json:"input"` + Output *event.EventSub `json:"output"` } EventUnsubscribeData struct { - Input *rpc_v0.SubIdParam `json:"input"` - Output *event.EventUnsub `json:"output"` + Input *rpc_v0.SubIdParam `json:"input"` + Output *event.EventUnsub `json:"output"` } TransactNameRegData struct { Input *rpc_v0.TransactNameRegParam `json:"input"` - Output *transaction.Receipt `json:"output"` + Output *transaction.Receipt `json:"output"` } GetNameRegEntryData struct { Input *rpc_v0.NameRegEntryParam `json:"input"` - Output *core_types.NameRegEntry `json:"output"` + Output *core_types.NameRegEntry `json:"output"` } GetNameRegEntriesData struct { - Input *rpc_v0.FilterListParam `json:"input"` + Input *rpc_v0.FilterListParam `json:"input"` Output *core_types.ResultListNames `json:"output"` } diff --git a/txs/names.go b/txs/names.go index 657cdc15744781e86cb7d3844049a1f79c8141e1..1cc00e168c4b3dfce9cb1685969e645caf412d41 100644 --- a/txs/names.go +++ b/txs/names.go @@ -1,8 +1,9 @@ package txs import ( - core_types "github.com/eris-ltd/eris-db/core/types" "regexp" + + core_types "github.com/eris-ltd/eris-db/core/types" ) var ( diff --git a/txs/tx_utils.go b/txs/tx_utils.go index e697951091cfd0b0ce58c748b7e6bdb5c4aef5b9..cdc4be247762db25b3abccda6919b7f72f594751 100644 --- a/txs/tx_utils.go +++ b/txs/tx_utils.go @@ -2,6 +2,7 @@ package txs import ( "fmt" + acm "github.com/eris-ltd/eris-db/account" ptypes "github.com/eris-ltd/eris-db/permission/types"