diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index 75d75c372..c9fe3fafa 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -278,43 +278,6 @@ func TestGaiaCLISend(t *testing.T) { f.Cleanup() } -func TestGaiaCLIConfirmTx(t *testing.T) { - t.Parallel() - f := InitFixtures(t) - - // start gaiad server - proc := f.GDStart() - defer proc.Stop(false) - - // Save key addresses for later use - fooAddr := f.KeyAddress(keyFoo) - barAddr := f.KeyAddress(keyBar) - - fooAcc := f.QueryAccount(fooAddr) - startTokens := sdk.TokensFromConsensusPower(50) - require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) - - // send some tokens from one account to the other - sendTokens := sdk.TokensFromConsensusPower(10) - f.txSendWithConfirm(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "Y") - tests.WaitForNextNBlocksTM(1, f.Port) - - // ensure account balances match expected - barAcc := f.QueryAccount(barAddr) - require.Equal(t, sendTokens, barAcc.GetCoins().AmountOf(denom)) - - // send some tokens from one account to the other (cancelling confirmation) - f.txSendWithConfirm(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "n") - tests.WaitForNextNBlocksTM(1, f.Port) - - // ensure account balances match expected - barAcc = f.QueryAccount(barAddr) - require.Equal(t, sendTokens, barAcc.GetCoins().AmountOf(denom)) - - // Cleanup testing directories - f.Cleanup() -} - func TestGaiaCLIGasAuto(t *testing.T) { t.Parallel() f := InitFixtures(t) diff --git a/cli_test/test_helpers.go b/cli_test/test_helpers.go index 41951cd4b..71feda44d 100644 --- a/cli_test/test_helpers.go +++ b/cli_test/test_helpers.go @@ -313,14 +313,6 @@ func (f *Fixtures) TxSend(from string, to sdk.AccAddress, amount sdk.Coin, flags return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), client.DefaultKeyPass) } -func (f *Fixtures) txSendWithConfirm( - from string, to sdk.AccAddress, amount sdk.Coin, confirm string, flags ...string, -) (bool, string, string) { - - cmd := fmt.Sprintf("%s tx send %s %s %s %v", f.GaiacliBinary, from, to, amount, f.Flags()) - return executeWriteRetStdStreams(f.T, addFlags(cmd, flags), confirm, client.DefaultKeyPass) -} - // TxSign is gaiacli tx sign func (f *Fixtures) TxSign(signer, fileName string, flags ...string) (bool, string, string) { cmd := fmt.Sprintf("%s tx sign %v --from=%s %v", f.GaiacliBinary, f.Flags(), signer, fileName) diff --git a/cmd/gaiad/testnet.go b/cmd/gaiad/testnet.go index 34bee7205..5a287d451 100644 --- a/cmd/gaiad/testnet.go +++ b/cmd/gaiad/testnet.go @@ -3,6 +3,7 @@ package main // DONTCOVER import ( + "bufio" "encoding/json" "fmt" "net" @@ -54,7 +55,7 @@ Note, strict routability for addresses is turned off in the config file. Example: gaiad testnet --v 4 --output-dir ./output --starting-ip-address 192.168.10.2 `, - RunE: func(_ *cobra.Command, _ []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { config := ctx.Config outputDir := viper.GetString(flagOutputDir) @@ -66,8 +67,8 @@ Example: startingIPAddress := viper.GetString(flagStartingIPAddress) numValidators := viper.GetInt(flagNumValidators) - return InitTestnet(config, cdc, mbm, genAccIterator, outputDir, chainID, minGasPrices, - nodeDirPrefix, nodeDaemonHome, nodeCLIHome, startingIPAddress, numValidators) + return InitTestnet(cmd, config, cdc, mbm, genAccIterator, outputDir, chainID, + minGasPrices, nodeDirPrefix, nodeDaemonHome, nodeCLIHome, startingIPAddress, numValidators) }, } @@ -94,8 +95,8 @@ Example: const nodeDirPerm = 0755 // Initialize the testnet -func InitTestnet(config *tmconfig.Config, cdc *codec.Codec, mbm module.BasicManager, - genAccIterator genutil.GenesisAccountsIterator, +func InitTestnet(cmd *cobra.Command, config *tmconfig.Config, cdc *codec.Codec, + mbm module.BasicManager, genAccIterator genutil.GenesisAccountsIterator, outputDir, chainID, minGasPrices, nodeDirPrefix, nodeDaemonHome, nodeCLIHome, startingIPAddress string, numValidators int) error { @@ -124,14 +125,12 @@ func InitTestnet(config *tmconfig.Config, cdc *codec.Codec, mbm module.BasicMana config.SetRoot(nodeDir) - err := os.MkdirAll(filepath.Join(nodeDir, "config"), nodeDirPerm) - if err != nil { + if err := os.MkdirAll(filepath.Join(nodeDir, "config"), nodeDirPerm); err != nil { _ = os.RemoveAll(outputDir) return err } - err = os.MkdirAll(clientDir, nodeDirPerm) - if err != nil { + if err := os.MkdirAll(clientDir, nodeDirPerm); err != nil { _ = os.RemoveAll(outputDir) return err } @@ -154,7 +153,7 @@ func InitTestnet(config *tmconfig.Config, cdc *codec.Codec, mbm module.BasicMana memo := fmt.Sprintf("%s@%s:26656", nodeIDs[i], ip) genFiles = append(genFiles, config.GenesisFile()) - buf := client.BufferStdin() + buf := bufio.NewReader(cmd.InOrStdin()) prompt := fmt.Sprintf( "Password for account '%s' (default %s):", nodeDirName, client.DefaultKeyPass, ) @@ -185,8 +184,7 @@ func InitTestnet(config *tmconfig.Config, cdc *codec.Codec, mbm module.BasicMana } // save private key seed words - err = writeFile(fmt.Sprintf("%v.json", "key_seed"), clientDir, cliPrint) - if err != nil { + if err := writeFile(fmt.Sprintf("%v.json", "key_seed"), clientDir, cliPrint); err != nil { return err } @@ -229,8 +227,7 @@ func InitTestnet(config *tmconfig.Config, cdc *codec.Codec, mbm module.BasicMana } // gather gentxs folder - err = writeFile(fmt.Sprintf("%v.json", nodeDirName), gentxsDir, txBytes) - if err != nil { + if err := writeFile(fmt.Sprintf("%v.json", nodeDirName), gentxsDir, txBytes); err != nil { _ = os.RemoveAll(outputDir) return err } @@ -253,7 +250,7 @@ func InitTestnet(config *tmconfig.Config, cdc *codec.Codec, mbm module.BasicMana return err } - fmt.Printf("Successfully initialized %d node directories\n", numValidators) + cmd.PrintErrf("Successfully initialized %d node directories\n", numValidators) return nil } @@ -324,8 +321,7 @@ func collectGenFiles( genFile := config.GenesisFile() // overwrite each validator's genesis file to have a canonical genesis time - err = genutil.ExportGenesisFileWithTime(genFile, chainID, nil, appState, genTime) - if err != nil { + if err := genutil.ExportGenesisFileWithTime(genFile, chainID, nil, appState, genTime); err != nil { return err } } diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index fd8eae678..c6a4d6c2b 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -69,6 +69,7 @@ $(CLOG): $(call go_install,alessio,clog,1) $(RUNSIM): + go get github.com/cosmos/cosmos-sdk/contrib/runsim@v0.28.2-0.20190622092459-7b5e6cee0787 go install -mod=readonly github.com/cosmos/cosmos-sdk/contrib/runsim tools-clean: diff --git a/go.mod b/go.mod index 47418eb79..6002f3abd 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.12 require ( github.com/btcsuite/btcd v0.0.0-20190523000118-16327141da8c // indirect - github.com/cosmos/cosmos-sdk v0.28.2-0.20190615141739-ac2e765607a6 + github.com/cosmos/cosmos-sdk v0.28.2-0.20190622092459-7b5e6cee0787 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/google/gofuzz v1.0.0 // indirect github.com/gorilla/mux v1.7.2 // indirect @@ -22,7 +22,7 @@ require ( github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa github.com/spf13/afero v1.2.2 // indirect - github.com/spf13/cobra v0.0.4 + github.com/spf13/cobra v0.0.5 github.com/spf13/viper v1.4.0 github.com/stretchr/testify v1.3.0 github.com/syndtr/goleveldb v1.0.0 // indirect diff --git a/go.sum b/go.sum index 2fb92dd6e..bd3915a75 100644 --- a/go.sum +++ b/go.sum @@ -37,12 +37,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/cosmos-sdk v0.28.2-0.20190615123411-73700df8c39d h1:gZxkU0oeSSSl0U4TfvRf7FTEIWwOBSRTMXLN3Qq9w58= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190615123411-73700df8c39d/go.mod h1:MvaJDmjgAK7X1rTnpk8+c6tUFfIZ++iuNCp2sUWzprM= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190615141739-ac2e765607a6 h1:PI7DItlX43pOwKjkOdZq9syqoeN9XMv+sPwjUDPGdcY= -github.com/cosmos/cosmos-sdk v0.28.2-0.20190615141739-ac2e765607a6/go.mod h1:MvaJDmjgAK7X1rTnpk8+c6tUFfIZ++iuNCp2sUWzprM= -github.com/cosmos/cosmos-sdk v0.35.0 h1:EPeie1aKHwnXtTzKggvabG7aAPN+DDmju2xquvjFwao= -github.com/cosmos/cosmos-sdk v0.35.0/go.mod h1:ruF+G4D7hRf34uzZQvf/SIja9fsIThU5D7GirwTMQ9I= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190622092459-7b5e6cee0787 h1:XGquCRUoKKg1g0Brutz2rMQsXRhtZ0h48acUpf4Uwo0= +github.com/cosmos/cosmos-sdk v0.28.2-0.20190622092459-7b5e6cee0787/go.mod h1:qmAeSBtA2C1zBXJ7jqzpQV4AP9WbdZdk4uwIkjyn2Jw= 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= @@ -76,6 +72,8 @@ github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekf github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129 h1:tT8iWCYw4uOem71yYA3htfH+LNopJvcqZQshm56G5L4= +github.com/golang/mock v1.3.1-0.20190508161146-9fa652df1129/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg= @@ -139,7 +137,6 @@ github.com/onsi/ginkgo v1.8.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.5.0 h1:izbySO9zDPmjJ8rDjLvkA2zJHIo+HkYXHnf7eN7SSyo= github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= -github.com/otiai10/copy v0.0.0-20180813032824-7e9a647135a1/go.mod h1:pXzZSDlN+HPzSdyIBnKNN9ptD9Hx7iZMWIJPTwo4FPE= github.com/otiai10/copy v1.0.1 h1:gtBjD8aq4nychvRZ2CyJvFWAw0aja+VHazDdruZKGZA= github.com/otiai10/copy v1.0.1/go.mod h1:8bMCJrAqOtN/d9oyh5HR7HhLQMvcGMpGdwRDYsfOCHc= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= @@ -197,15 +194,13 @@ github.com/spf13/afero v1.2.2 h1:5jhuqJyZCZf2JRofRvN/nIFgIWNzPa3/Vz8mYylgbWc= github.com/spf13/afero v1.2.2/go.mod h1:9ZxEEn6pIJ8Rxe320qSDBk6AsU0r9pR7Q4OcevTdifk= github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v0.0.4 h1:S0tLZ3VOKl2Te0hpq8+ke0eSJPfCnNTPiDlsfwi1/NE= -github.com/spf13/cobra v0.0.4/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= +github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.0.3/go.mod h1:A8kyI5cUJhb8N+3pkfONlcEcZbueH6nhAm0Fq7SrnBM= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0 h1:yXHLWeravcrgGyFSyCgdYpXQ9dR9c/WED3pg1RhxqEU= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= @@ -221,10 +216,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-20180820045704-3764759f34a5 h1:u8i49c+BxloX3XQ55cvzFNXplizZP/q00i+IlttUjAU= github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= -github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso= github.com/tendermint/go-amino v0.15.0 h1:TC4e66P59W7ML9+bxio17CPKnxW3nKIRAYskntMAoRk= github.com/tendermint/go-amino v0.15.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/iavl v0.12.1/go.mod h1:EoKMMv++tDOL5qKKVnoIqtVPshRrEPeJ0WsgDOLAauM= github.com/tendermint/iavl v0.12.2 h1:Ls5p5VINCM1HRT9g5Vvs2zmDOCU/CCIvIHzd/pZ8P0E= github.com/tendermint/iavl v0.12.2/go.mod h1:EoKMMv++tDOL5qKKVnoIqtVPshRrEPeJ0WsgDOLAauM= github.com/tendermint/tendermint v0.31.5 h1:vTet8tCq3B9/J9Yo11dNZ8pOB7NtSy++bVSfkP4KzR4= @@ -259,6 +252,7 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -278,6 +272,7 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= 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=