From d1e2d4272433ddf8c2dc7ea8af28de001db9c815 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 13 Aug 2019 12:11:30 -0400 Subject: [PATCH 1/6] Update SDK version to v0.36.0 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a834c07cae..7f466082fd 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.36.0-rc4 + github.com/cosmos/cosmos-sdk v0.36.0 github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d // indirect github.com/go-kit/kit v0.9.0 // indirect github.com/golang/mock v1.3.1 // indirect diff --git a/go.sum b/go.sum index 9ff3f59c10..0f6eb0d1ad 100644 --- a/go.sum +++ b/go.sum @@ -37,8 +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.36.0-rc4 h1:XE5N/w9n7MHXEDw0wFMTXj1FLxbKHVtVfCrOT5MDDSs= -github.com/cosmos/cosmos-sdk v0.36.0-rc4/go.mod h1:3b/k/Zd+YDuttSmEJdNkxga1H5EIiDUhSYeErAHQN7A= +github.com/cosmos/cosmos-sdk v0.36.0 h1:nDHhZDeucmv/PoThz89Q8cj9S8OH2EUutgertz2pZ90= +github.com/cosmos/cosmos-sdk v0.36.0/go.mod h1:3b/k/Zd+YDuttSmEJdNkxga1H5EIiDUhSYeErAHQN7A= 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= From 77af6e37bee9df5f4ceb23c2e8c82407331338c3 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 13 Aug 2019 12:14:45 -0400 Subject: [PATCH 2/6] Update clog config and CHANGELOG --- .clog.yaml | 3 ++- CHANGELOG.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.clog.yaml b/.clog.yaml index 1c7cc76cb9..467add0d46 100644 --- a/.clog.yaml +++ b/.clog.yaml @@ -2,9 +2,10 @@ sections: breaking: Breaking Changes features: Features improvements: Improvements - bugfixes: Bugfixes + bugfixes: Bug Fixes tags: - gaiad - gaiacli - rest + - sdk diff --git a/CHANGELOG.md b/CHANGELOG.md index f570df37cc..977a7e157b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ ### Breaking Changes +* (sdk) Update SDK version to v0.36.0 * (gaiad) [\#3985](https://github.com/cosmos/cosmos-sdk/issues/3985) ValidatorPowerRank uses potential consensus power * (gaiad) [\#4027](https://github.com/cosmos/cosmos-sdk/issues/4027) gaiad version command does not return the checksum of the go.sum file shipped along with the source release tarball. Go modules feature guarantees dependencies reproducibility and as long as binaries are built via the Makefile shipped with the sources, no dependendencies can break such guarantee. From 09ac2b968a0e810c0756ca85cb9e36d252b09ca7 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 13 Aug 2019 12:33:37 -0400 Subject: [PATCH 3/6] Update go.mod --- go.mod | 1 + 1 file changed, 1 insertion(+) diff --git a/go.mod b/go.mod index 7f466082fd..8a364511d9 100644 --- a/go.mod +++ b/go.mod @@ -33,5 +33,6 @@ require ( golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect golang.org/x/text v0.3.2 // indirect + google.golang.org/appengine v1.4.0 // indirect google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df // indirect ) From e0753a61c13fc61bf558bd2baa763ee95ca79ccb Mon Sep 17 00:00:00 2001 From: Federico Kunze Date: Tue, 13 Aug 2019 18:38:22 +0200 Subject: [PATCH 4/6] update sims --- app/sim_test.go | 22 ++++++++++++---------- app/utils.go | 1 + go.mod | 1 + sims.mk | 3 ++- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/app/sim_test.go b/app/sim_test.go index 4ca3ba9c19..60b34beeb8 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -44,8 +44,10 @@ func init() { flag.StringVar(&exportParamsPath, "ExportParamsPath", "", "custom file path to save the exported params JSON") flag.IntVar(&exportParamsHeight, "ExportParamsHeight", 0, "height to which export the randomly generated params") flag.StringVar(&exportStatePath, "ExportStatePath", "", "custom file path to save the exported app state JSON") + flag.StringVar(&exportStatsPath, "ExportStatsPath", "", "custom file path to save the exported simulation statistics JSON") flag.Int64Var(&seed, "Seed", 42, "simulation random seed") - flag.IntVar(&numBlocks, "NumBlocks", 500, "number of blocks") + flag.IntVar(&initialBlockHeight, "InitialBlockHeight", 1, "initial block to start the simulation") + flag.IntVar(&numBlocks, "NumBlocks", 500, "number of new blocks to simulate from the initial block height") flag.IntVar(&blockSize, "BlockSize", 200, "operations per block") flag.BoolVar(&enabled, "Enabled", false, "enable the simulation") flag.BoolVar(&verbose, "Verbose", false, "verbose log output") @@ -60,15 +62,15 @@ func init() { // helper function for populating input for SimulateFromSeed func getSimulateFromSeedInput(tb testing.TB, w io.Writer, app *GaiaApp) ( testing.TB, io.Writer, *baseapp.BaseApp, simulation.AppStateFn, int64, - simulation.WeightedOperations, sdk.Invariants, int, int, int, + simulation.WeightedOperations, sdk.Invariants, int, int, int, int, string, bool, bool, bool, bool, bool, map[string]bool) { exportParams := exportParamsPath != "" return tb, w, app.BaseApp, appStateFn, seed, testAndRunTxs(app), invariants(app), - numBlocks, exportParamsHeight, blockSize, - exportParams, commit, lean, onOperation, allInvariants, app.ModuleAccountAddrs() + initialBlockHeight, numBlocks, exportParamsHeight, blockSize, + exportStatsPath, exportParams, commit, lean, onOperation, allInvariants, app.ModuleAccountAddrs() } func appStateFn( @@ -712,10 +714,10 @@ func TestAppStateDeterminism(t *testing.T) { // Run randomized simulation simulation.SimulateFromSeed( - t, os.Stdout, app.BaseApp, appStateFn, seed, - testAndRunTxs(app), []sdk.Invariant{}, - 50, 100, 0, - false, true, false, false, false, app.ModuleAccountAddrs(), + t, os.Stdout, app.BaseApp, appStateFn, seed, testAndRunTxs(app), + []sdk.Invariant{}, 1, numBlocks, exportParamsHeight, + blockSize, "", false, commit, lean, + false, false, app.ModuleAccountAddrs(), ) appHash := app.LastCommitID().Hash appHashList[j] = appHash @@ -742,8 +744,8 @@ func BenchmarkInvariants(b *testing.B) { // 2. Run parameterized simulation (w/o invariants) _, params, simErr := simulation.SimulateFromSeed( b, ioutil.Discard, app.BaseApp, appStateFn, seed, testAndRunTxs(app), - []sdk.Invariant{}, numBlocks, exportParamsHeight, blockSize, - exportParams, commit, lean, onOperation, false, app.ModuleAccountAddrs(), + []sdk.Invariant{}, initialBlockHeight, numBlocks, exportParamsHeight, blockSize, + exportStatsPath, exportParams, commit, lean, onOperation, false, app.ModuleAccountAddrs(), ) // export state and params before the simulation error is checked diff --git a/app/utils.go b/app/utils.go index b3e7d2fca6..d6dbfe37d3 100644 --- a/app/utils.go +++ b/app/utils.go @@ -18,6 +18,7 @@ var ( exportParamsPath string exportParamsHeight int exportStatePath string + exportStatsPath string seed int64 initialBlockHeight int numBlocks int diff --git a/go.mod b/go.mod index 7f466082fd..8a364511d9 100644 --- a/go.mod +++ b/go.mod @@ -33,5 +33,6 @@ require ( golang.org/x/net v0.0.0-20190724013045-ca1201d0de80 // indirect golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa // indirect golang.org/x/text v0.3.2 // indirect + google.golang.org/appengine v1.4.0 // indirect google.golang.org/genproto v0.0.0-20190701230453-710ae3a149df // indirect ) diff --git a/sims.mk b/sims.mk index 4bed15cc84..adea39e909 100644 --- a/sims.mk +++ b/sims.mk @@ -7,7 +7,8 @@ SIMAPP = github.com/cosmos/gaia/app sim-gaia-nondeterminism: @echo "Running nondeterminism test..." - @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true -v -timeout 10m + @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ + -NumBlocks=100 -BlockSize=200 -Commit=true -v -timeout 24h sim-gaia-custom-genesis-fast: @echo "Running custom genesis simulation..." From 2417e18d70f155ece3a8094392271176d90d1708 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 13 Aug 2019 13:28:27 -0400 Subject: [PATCH 5/6] Update CLI tests --- cli_test/cli_test.go | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/cli_test/cli_test.go b/cli_test/cli_test.go index 7269e5a706..971f588146 100644 --- a/cli_test/cli_test.go +++ b/cli_test/cli_test.go @@ -105,8 +105,9 @@ func TestGaiaCLIMinimumFees(t *testing.T) { barAddr := f.KeyAddress(keyBar) // Send a transaction that will get rejected - success, _, _ := f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fee2Denom, 10), "-y") - require.False(f.T, success) + success, stdOut, _ := f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fee2Denom, 10), "-y") + require.Contains(t, stdOut, "insufficient fees") + require.True(f.T, success) tests.WaitForNextNBlocksTM(1, f.Port) // Ensure tx w/ correct fees pass @@ -118,7 +119,8 @@ func TestGaiaCLIMinimumFees(t *testing.T) { // Ensure tx w/ improper fees fails txFees = fmt.Sprintf("--fees=%s", sdk.NewInt64Coin(feeDenom, 1)) success, _, _ = f.TxSend(keyFoo, barAddr, sdk.NewInt64Coin(fooDenom, 10), txFees, "-y") - require.False(f.T, success) + require.Contains(t, stdOut, "insufficient fees") + require.True(f.T, success) // Cleanup testing directories f.Cleanup() @@ -137,10 +139,11 @@ func TestGaiaCLIGasPrices(t *testing.T) { // insufficient gas prices (tx fails) badGasPrice, _ := sdk.NewDecFromStr("0.000003") - success, _, _ := f.TxSend( + success, stdOut, _ := f.TxSend( keyFoo, barAddr, sdk.NewInt64Coin(fooDenom, 50), fmt.Sprintf("--gas-prices=%s", sdk.NewDecCoinFromDec(feeDenom, badGasPrice)), "-y") - require.False(t, success) + require.Contains(t, stdOut, "insufficient fees") + require.True(t, success) // wait for a block confirmation tests.WaitForNextNBlocksTM(1, f.Port) @@ -188,10 +191,11 @@ func TestGaiaCLIFeesDeduction(t *testing.T) { // insufficient funds (coins + fees) tx fails largeCoins := sdk.TokensFromConsensusPower(10000000) - success, _, _ = f.TxSend( + success, stdOut, _ := f.TxSend( keyFoo, barAddr, sdk.NewCoin(fooDenom, largeCoins), fmt.Sprintf("--fees=%s", sdk.NewInt64Coin(feeDenom, 2)), "-y") - require.False(t, success) + require.Contains(t, stdOut, "insufficient account funds") + require.True(t, success) // Wait for a block tests.WaitForNextNBlocksTM(1, f.Port) @@ -295,8 +299,9 @@ func TestGaiaCLIGasAuto(t *testing.T) { // Test failure with auto gas disabled and very little gas set by hand sendTokens := sdk.TokensFromConsensusPower(10) - success, _, _ := f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=10", "-y") - require.False(t, success) + success, stdOut, _ := f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=10", "-y") + require.Contains(t, stdOut, "out of gas in location") + require.True(t, success) // Check state didn't change fooAcc = f.QueryAccount(fooAddr) @@ -311,8 +316,9 @@ func TestGaiaCLIGasAuto(t *testing.T) { require.Equal(t, startTokens, fooAcc.GetCoins().AmountOf(denom)) // Test failure with 0 gas - success, _, _ = f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=0", "-y") - require.False(t, success) + success, stdOut, _ = f.TxSend(keyFoo, barAddr, sdk.NewCoin(denom, sendTokens), "--gas=0", "-y") + require.Contains(t, stdOut, "out of gas in location") + require.True(t, success) // Check state didn't change fooAcc = f.QueryAccount(fooAddr) @@ -980,8 +986,9 @@ func TestGaiaCLIMultisignInsufficientCosigners(t *testing.T) { require.False(t, success) // Broadcast the transaction - success, _, _ = f.TxBroadcast(signedTxFile.Name()) - require.False(t, success) + success, stdOut, _ := f.TxBroadcast(signedTxFile.Name()) + require.Contains(t, stdOut, "signature verification failed") + require.True(t, success) // Cleanup testing directories f.Cleanup() From c99a0541eeac5b629330e2bc2eae1146b46727a1 Mon Sep 17 00:00:00 2001 From: Aleksandr Bezobchuk Date: Tue, 13 Aug 2019 13:32:59 -0400 Subject: [PATCH 6/6] Update REST tests --- lcd_test/lcd_test.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lcd_test/lcd_test.go b/lcd_test/lcd_test.go index bd76de050a..d35a433261 100644 --- a/lcd_test/lcd_test.go +++ b/lcd_test/lcd_test.go @@ -116,7 +116,7 @@ func TestCoinSend(t *testing.T) { // test failure with too little gas res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, "100", 0, false, true, fees) - require.Equal(t, http.StatusInternalServerError, res.StatusCode, body) + require.Equal(t, http.StatusOK, res.StatusCode, body) require.Nil(t, err) // test failure with negative gas @@ -129,12 +129,11 @@ func TestCoinSend(t *testing.T) { // test failure with 0 gas res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, "0", 0, false, true, fees) - require.Equal(t, http.StatusInternalServerError, res.StatusCode, body) + require.Equal(t, http.StatusOK, res.StatusCode, body) // test failure with wrong adjustment res, body, _ = doTransferWithGas(t, port, seed, name1, memo, pw, addr, client.GasFlagAuto, 0.1, false, true, fees) - - require.Equal(t, http.StatusInternalServerError, res.StatusCode, body) + require.Equal(t, http.StatusOK, res.StatusCode, body) // run simulation and test success with estimated gas res, body, _ = doTransferWithGas(