Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Randomized fuzzer: slashing period ended before infraction #2224

Closed
4 tasks
ValarDragon opened this issue Sep 4, 2018 · 8 comments
Closed
4 tasks

Randomized fuzzer: slashing period ended before infraction #2224

ValarDragon opened this issue Sep 4, 2018 · 8 comments

Comments

@ValarDragon
Copy link
Contributor

ValarDragon commented Sep 4, 2018

Steps to Reproduce

In $GOPATH/src/github.com/cosmos/cosmos-sdk/cmd/gaia/app/sim_test.go comment out govsim.SimulateMsgDeposit(app.govKeeper, app.stakeKeeper),.
Then in the makefile, change one of the commands to use -SimulationNumBlocks=500 -SimulationBlockSize=200.

Then you get the following output:

$ make test_sim_gaia_fast
Running quick Gaia simulation. This may take several minutes...
=== RUN   TestFullGaiaSimulation
Starting SimulateFromSeed with randomness created with seed 42
Starting the simulation from time Sun Jan 31 13:59:47 UTC 26140, unixtime 762734152787
Simulating... block 206/500, operation 150/161.--- FAIL: TestFullGaiaSimulation (185.83s)
panic: slashing period ended before infraction: infraction height 207, slashing period ended at 206 [recovered]
	panic: slashing period ended before infraction: infraction height 207, slashing period ended at 206

goroutine 44 [running]:
testing.tRunner.func1(0xc420a07b30)
	/usr/local/go/src/testing/testing.go:742 +0x29d
panic(0xcf5980, 0xc420930df0)
	/usr/local/go/src/runtime/panic.go:502 +0x229
github.com/cosmos/cosmos-sdk/x/slashing.Keeper.capBySlashingPeriod(0x1048320, 0xc420a284b0, 0xc4209f5f80, 0x1055e80, 0xc4209330e0, 0xc4209f5f80, 0x1048320, 0xc420a284e0, 0xa, 0x104f800, ...)
	/home/valar/Code/go/src/github.com/cosmos/cosmos-sdk/x/slashing/slashing_period.go:18 +0x32d
github.com/cosmos/cosmos-sdk/x/slashing.Keeper.handleDoubleSign(0x1048320, 0xc420a284b0, 0xc4209f5f80, 0x1055e80, 0xc4209330e0, 0xc4209f5f80, 0x1048320, 0xc420a284e0, 0xa, 0x104f800, ...)
	/home/valar/Code/go/src/github.com/cosmos/cosmos-sdk/x/slashing/keeper.go:62 +0x649
github.com/cosmos/cosmos-sdk/x/slashing.BeginBlocker(0x104f800, 0xc4227d6570, 0xc420047600, 0x1a8, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcf, ...)
	/home/valar/Code/go/src/github.com/cosmos/cosmos-sdk/x/slashing/tick.go:34 +0x672
github.com/cosmos/cosmos-sdk/cmd/gaia/app.(*GaiaApp).BeginBlocker(0xc4209f0400, 0x104f800, 0xc4227d6570, 0xc420047600, 0x1a8, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/home/valar/Code/go/src/github.com/cosmos/cosmos-sdk/cmd/gaia/app/app.go:143 +0xea
github.com/cosmos/cosmos-sdk/cmd/gaia/app.(*GaiaApp).BeginBlocker-fm(0x104f800, 0xc4227d6570, 0xc420047600, 0x1a8, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcf, ...)
	/home/valar/Code/go/src/github.com/cosmos/cosmos-sdk/cmd/gaia/app/app.go:114 +0xba
github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).BeginBlock(0xc420a205b0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xcf, 0x0, 0xc00edcebe6, 0x15968a0, ...)
	/home/valar/Code/go/src/github.com/cosmos/cosmos-sdk/baseapp/baseapp.go:418 +0x23a
github.com/cosmos/cosmos-sdk/x/mock/simulation.SimulateFromSeed(0x10599e0, 0xc420a07b30, 0xc420a205b0, 0xfd0c10, 0x2a, 0xc42064f620, 0xb, 0xb, 0xc420a1df08, 0x0, ...)
	/home/valar/Code/go/src/github.com/cosmos/cosmos-sdk/x/mock/simulation/random_simulate_blocks.go:97 +0xbfe
github.com/cosmos/cosmos-sdk/cmd/gaia/app.TestFullGaiaSimulation(0xc420a07b30)
	/home/valar/Code/go/src/github.com/cosmos/cosmos-sdk/cmd/gaia/app/sim_test.go:171 +0x2ac
testing.tRunner(0xc420a07b30, 0xfd0be8)
	/usr/local/go/src/testing/testing.go:777 +0xd0
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:824 +0x2e0
FAIL	github.com/cosmos/cosmos-sdk/cmd/gaia/app	185.862s
Makefile:159: recipe for target 'test_sim_gaia_fast' failed
make: *** [test_sim_gaia_fast] Error 1

This exists on develop.


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@ValarDragon
Copy link
Contributor Author

Its very possible that this could be a bug in the simulator and not the actual state machine.

@cwgoes
Copy link
Contributor

cwgoes commented Sep 4, 2018

Its very possible that this could be a bug in the simulator and not the actual state machine.

Possibly! I don't immediately know what that would be though - do you mean having incorrect block times or something?

@ValarDragon
Copy link
Contributor Author

Oh your right, I think we do keep track of the height correctly. It may be that the way we track double sign height in the simulator (or the state machine) is off somewhere though.

@ValarDragon
Copy link
Contributor Author

@cwgoes
Copy link
Contributor

cwgoes commented Sep 4, 2018

Thanks @rigelrozanski, will tackle ASAP, this should probably block 0.25.

@jackzampolin jackzampolin added this to the 0.25 milestone Sep 5, 2018
@ValarDragon
Copy link
Contributor Author

This can now be replicated with:
disable both goverance msgs in sim_test,
run:

go test ./cmd/gaia/app -run TestFullGaiaSimulation -SimulationSeed=741 -SimulationEnabled=true -SimulationNumBlocks=300 -SimulationBlockSize=100 -v -timeout 24h

@cwgoes
Copy link
Contributor

cwgoes commented Oct 5, 2018

#2430 will close, the height should have been stored as big endian.

@cwgoes
Copy link
Contributor

cwgoes commented Oct 9, 2018

Closed by #2430.

@cwgoes cwgoes closed this as completed Oct 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants