Skip to content

Vesting Error caught in simulation #3353

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

Closed
2 of 4 tasks
zmanian opened this issue Jan 22, 2019 · 2 comments
Closed
2 of 4 tasks

Vesting Error caught in simulation #3353

zmanian opened this issue Jan 22, 2019 · 2 comments

Comments

@zmanian
Copy link
Member

zmanian commented Jan 22, 2019

Reproduce with

go test ./cmd/gaia/app -run TestFullGaiaSimulation \
  -SimulationEnabled=true \
  -SimulationNumBlocks=400 \
  -SimulationVerbose=true \
  -SimulationCommit=true \
  -SimulationSeed=4 \
  -v -timeout 24h

stake trace


Simulating... block 190/400, operation 300/793. Panic with err
 negative coin amount: -69718

goroutine 15 [running]:
runtime/debug.Stack(0xc0034ac270, 0x2, 0x2)
	/snap/go/3095/src/runtime/debug/stack.go:24 +0xa7
github.com/cosmos/cosmos-sdk/x/mock/simulation.SimulateFromSeed.func2(0xc001440020, 0xc00015a780, 0xc00026aaf0)
	/home/zaki/go/src/github.com/cosmos/cosmos-sdk/x/mock/simulation/simulate.go:124 +0xb6
panic(0xb75080, 0xc002401cf0)
	/snap/go/3095/src/runtime/panic.go:513 +0x1b9
github.com/cosmos/cosmos-sdk/types.NewCoin(0xc0041c49ca, 0x5, 0xc00241bd00, 0xc00241bb01, 0x1, 0x1)
	/home/zaki/go/src/github.com/cosmos/cosmos-sdk/types/coin.go:31 +0x262
github.com/cosmos/cosmos-sdk/x/auth.BaseVestingAccount.spendableCoins(0xc0044f06e0, 0xc00241bb40, 0x1, 0x1, 0x0, 0x0, 0x0, 0xc00241bc40, 0x1, 0x1, ...)
	/home/zaki/go/src/github.com/cosmos/cosmos-sdk/x/auth/account.go:230 +0x252
github.com/cosmos/cosmos-sdk/x/auth.DelayedVestingAccount.SpendableCoins(0xc00241d260, 0x0, 0x3e09b0a9d9, 0x1466240, 0x0, 0x0, 0x0)
	/home/zaki/go/src/github.com/cosmos/cosmos-sdk/x/auth/account.go:489 +0xbb
github.com/cosmos/cosmos-sdk/x/bank/simulation.createSingleInputSendMsg(0xc005801080, 0xe9e5c0, 0xc0057f3020, 0xc00406ea00, 0xc, 0xc0000d9400, 0x9c, 0x9c, 0xe982a0, 0xc00026a720, ...)
	/home/zaki/go/src/github.com/cosmos/cosmos-sdk/x/bank/simulation/msgs.go:67 +0x37a
github.com/cosmos/cosmos-sdk/x/bank/simulation.SingleInputSendMsg.func1(0xc005801080, 0xc0002ab100, 0xe9e5c0, 0xc0057f3020, 0xc00406ea00, 0xc, 0xc0000d9400, 0x9c, 0x9c, 0xc001368000, ...)
	/home/zaki/go/src/github.com/cosmos/cosmos-sdk/x/bank/simulation/msgs.go:42 +0x11e
github.com/cosmos/cosmos-sdk/x/mock/simulation.createBlockSimulator.func1(0xc000270f00, 0xc0002ab100, 0xe9e5c0, 0xc0057f3020, 0xc00406ea00, 0xc, 0xc0000d9400, 0x9c, 0x9c, 0x0, ...)
	/home/zaki/go/src/github.com/cosmos/cosmos-sdk/x/mock/simulation/simulate.go:265 +0x553
github.com/cosmos/cosmos-sdk/x/mock/simulation.SimulateFromSeed(0xea5700, 0xc0002ab000, 0xc0002ab100, 0xde7608, 0x4, 0xc000286c30, 0xd, 0xd, 0xc000270ed0, 0x5, ...)
	/home/zaki/go/src/github.com/cosmos/cosmos-sdk/x/mock/simulation/simulate.go:171 +0x12d2
github.com/cosmos/cosmos-sdk/cmd/gaia/app.TestFullGaiaSimulation(0xc0002ab000)
	/home/zaki/go/src/github.com/cosmos/cosmos-sdk/cmd/gaia/app/sim_test.go:319 +0x339
testing.tRunner(0xc0002ab000, 0xde75a0)
	/snap/go/3095/src/testing/testing.go:827 +0xbf
created by testing.(*T).Run
	/snap/go/3095/src/testing/testing.go:878 +0x35c

For Admin Use

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

Looks like this is coming from a delayed vesting account.

@alexanderbez
Copy link
Contributor

After a bit of debugging, turns out it's actually in simulation:

coins := sdk.Coins{sdk.NewCoin(initCoins[denomIndex].Denom, amt)}
err = stored.SetCoins(initCoins.Minus(coins))

I think we need to go through messages and operations in simulation and make sure we're not calling SetCoins with amounts we're not supposed to (i.e. we should be calling SpendableCoins.

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

2 participants