From 5ed24e44d2b84c2d433bbcc1be3f02f4345cac43 Mon Sep 17 00:00:00 2001 From: ValarDragon Date: Mon, 3 Sep 2018 19:13:08 -0700 Subject: [PATCH] simulation: Minor changes Now that we properly initialize governance, a ton of governance slashing doesn't happen in the first few blocks. Because of this, we can run through blocks in the range (0,200) quite rapidly. This PR acknowledges that and increases many of the default block heights. --- Makefile | 2 +- cmd/gaia/app/sim_test.go | 9 +++++---- x/mock/simulation/random_simulate_blocks.go | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index e363891e2..2f23fd54f 100644 --- a/Makefile +++ b/Makefile @@ -157,7 +157,7 @@ test_sim_gaia_nondeterminism: test_sim_gaia_fast: @echo "Running quick Gaia simulation. This may take several minutes..." - @go test ./cmd/gaia/app -run TestFullGaiaSimulation -SimulationEnabled=true -SimulationNumBlocks=50 -v -timeout 24h + @go test ./cmd/gaia/app -run TestFullGaiaSimulation -SimulationEnabled=true -SimulationNumBlocks=150 -v -timeout 24h test_sim_gaia_slow: @echo "Running full Gaia simulation. This may take awhile!" diff --git a/cmd/gaia/app/sim_test.go b/cmd/gaia/app/sim_test.go index 3878166b3..61affb261 100644 --- a/cmd/gaia/app/sim_test.go +++ b/cmd/gaia/app/sim_test.go @@ -189,7 +189,7 @@ func TestAppStateDeterminism(t *testing.T) { t.Skip("Skipping Gaia simulation") } - numSeeds := 5 + numSeeds := 3 numTimesToRunPerSeed := 5 appHashList := make([]json.RawMessage, numTimesToRunPerSeed) @@ -206,10 +206,11 @@ func TestAppStateDeterminism(t *testing.T) { testAndRunTxs(app), []simulation.RandSetup{}, []simulation.Invariant{}, - 20, - 20, - true, + 50, + 100, + false, ) + app.Commit() appHash := app.LastCommitID().Hash appHashList[j] = appHash } diff --git a/x/mock/simulation/random_simulate_blocks.go b/x/mock/simulation/random_simulate_blocks.go index fc7543280..14ca6c216 100644 --- a/x/mock/simulation/random_simulate_blocks.go +++ b/x/mock/simulation/random_simulate_blocks.go @@ -155,7 +155,7 @@ func createBlockSimulator(testingMode bool, tb testing.TB, t *testing.T, event f AssertAllInvariants(t, app, invariants, log) } if opCount%50 == 0 { - fmt.Printf("\rSimulating... block %d/%d, operation %d/%d.", header.Height, totalNumBlocks, opCount, blocksize) + fmt.Printf("\rSimulating... block %d/%d, operation %d/%d. ", header.Height, totalNumBlocks, opCount, blocksize) } } opCount++