Skip to content

Commit

Permalink
Update SDK version to v0.36.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderbez committed Aug 13, 2019
2 parents 89e6316 + c99a054 commit f5b80b1
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 32 deletions.
3 changes: 2 additions & 1 deletion .clog.yaml
Expand Up @@ -2,9 +2,10 @@ sections:
breaking: Breaking Changes
features: Features
improvements: Improvements
bugfixes: Bugfixes
bugfixes: Bug Fixes

tags:
- gaiad
- gaiacli
- rest
- sdk
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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.
Expand Down
22 changes: 12 additions & 10 deletions app/sim_test.go
Expand Up @@ -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")
Expand All @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions app/utils.go
Expand Up @@ -18,6 +18,7 @@ var (
exportParamsPath string
exportParamsHeight int
exportStatePath string
exportStatsPath string
seed int64
initialBlockHeight int
numBlocks int
Expand Down
33 changes: 20 additions & 13 deletions cli_test/cli_test.go
Expand Up @@ -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
Expand All @@ -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()
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -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=
Expand Down
7 changes: 3 additions & 4 deletions lcd_test/lcd_test.go
Expand Up @@ -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
Expand All @@ -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(
Expand Down
3 changes: 2 additions & 1 deletion sims.mk
Expand Up @@ -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..."
Expand Down

0 comments on commit f5b80b1

Please sign in to comment.