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

Unbonding fractional shares causes crash #2654

Closed
4 tasks
faboweb opened this issue Nov 1, 2018 · 12 comments
Closed
4 tasks

Unbonding fractional shares causes crash #2654

faboweb opened this issue Nov 1, 2018 · 12 comments
Assignees

Comments

@faboweb
Copy link
Contributor

faboweb commented Nov 1, 2018

Summary of Bug

Commit: ce23ad4

Trying to undelegate fractional shares like this on a one node testnet:

POST /stake/delegators/cosmos1u275j7enpehhvenv5d79shegn495mjsj2e0vvx/delegations
body:

{"begin_unbondings":[{"delegator_addr":"cosmos1u275j7enpehhvenv5d79shegn495mjsj2e0vvx","validator_addr":"cosmosvaloper1u275j7enpehhvenv5d79shegn495mjsj0dmeq4","shares":"99.5000000000"}],"base_req":{"sequence":"0","name":"local","password":"1234567890","account_number":"0","chain_id":"test-chain-CB49oT"},"gas":"50000000"}

causes:

  • timeout of request
  • sequence number is now expected to be 1 but querying for the sequence number I get 0
  • restarting the node always crashes:
panic: interface conversion: interface {} is nil, not *types.Validator

goroutine 1 [running]:
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/types.(*ValidatorSet).IncrementAccum(0xc00084aed0, 0x1)
        /go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/types/validator_set.go:77 +0x3a9
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/state.updateState(0xc000b623a0, 0x11, 0x1e, 0x0, 0xc000b623c0, 0x14, 0x14, 0x1, 0xc000b62400, 0x14, ...)
        /go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/state/execution.go:355 +0xae
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/state.(*BlockExecutor).ApplyBlock(0xc000874190, 0xc000b623a0, 0x11, 0x1e, 0x0, 0xc000b623c0, 0x14, 0x14, 0x1, 0xc000b62400, ...)
        /go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/state/execution.go:90 +0x217
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/consensus.(*Handshaker).replayBlock(0xc000875958, 0xc000b623a0, 0x11, 0x1e, 0x0, 0xc000b623c0, 0x14, 0x14, 0x1, 0xc000b62400, ...)
        /go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/consensus/replay.go:412 +0x21a
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocks(0xc000875958, 0xc000b623a0,0x11, 0x1e, 0x0, 0xc000b623c0, 0x14, 0x14, 0x1, 0xc000b62400, ...)
        /go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/consensus/replay.go:343 +0x747
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/consensus.(*Handshaker).Handshake(0xc000875958, 0x1d92320, 0xc0001e09a0, 0x2, 0x1d88200)
        /go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/consensus/replay.go:246 +0x3d2
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/node.NewNode(0xc000b7b9e0, 0x1d89800, 0xc0001e54a0, 0xc000077ac0, 0x1d7c760, 0xc00090b360, 0xc000077ce0, 0x1ca4fb0, 0xc000077cf0, 0x1d88200, ...)
        /go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/node/node.go:203 +0x6c4
github.com/cosmos/cosmos-sdk/server.startInProcess(0xc00017d480, 0x1ca57e8, 0x1d, 0x0, 0x0)
        /go/src/github.com/cosmos/cosmos-sdk/server/start.go:119 +0x3f1
github.com/cosmos/cosmos-sdk/server.StartCmd.func1(0xc000b7d8c0, 0xc00017d720, 0x0, 0x2, 0x0, 0x0)
        /go/src/github.com/cosmos/cosmos-sdk/server/start.go:40 +0xab
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).execute(0xc000b7d8c0, 0xc00017d6e0, 0x2, 0x2, 0xc000b7d8c0, 0xc00017d6e0)
        /go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:698 +0x47a
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc000b7c6c0, 0xc00017d640, 0xc000823e60, 0x181560d)
        /go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:783 +0x2dc
github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra.(*Command).Execute(0xc000b7c6c0, 0x1814ec2, 0xc0001c8d10)
        /go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/spf13/cobra/command.go:736 +0x2b
github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/libs/cli.Executor.Execute(0xc000b7c6c0, 0x1ca5bd0, 0x2, 0xc0000c85e0)
        /go/src/github.com/cosmos/cosmos-sdk/vendor/github.com/tendermint/tendermint/libs/cli/setup.go:89 +0x4e
main.main()

Steps to Reproduce


For Admin Use

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

cwgoes commented Nov 1, 2018

Wow, this looks bad, this is a state machine bug. Thanks @faboweb.

It's possible we've fixed this since that commit (15 days old) but we should check.

@alexanderbez
Copy link
Contributor

@faboweb can you report back if this is reproducible on the latest v0.25.0?

@faboweb
Copy link
Contributor Author

faboweb commented Nov 1, 2018

@alexanderbez I won't get to it before Monday. I put it on my todo list. Does it work on the CLI?

@alexanderbez
Copy link
Contributor

Don't sweat it, I'll test it out. Maybe during the process I'll also figure out the issue ;-)

@alexanderbez alexanderbez self-assigned this Nov 1, 2018
@alexanderbez
Copy link
Contributor

alexanderbez commented Nov 1, 2018

Created a new account, bonded 3 steak to a validator, and unbonded 2.5 (via the CLI) successfully. I have not yet tried via the LCD.

@rigelrozanski
Copy link
Contributor

wondering if is this isolated to lcd as well

@alexanderbez
Copy link
Contributor

alexanderbez commented Nov 3, 2018

Yeah. @fedekunze can you verify the LCD gaia lite when you have a moment?

@faboweb
Copy link
Contributor Author

faboweb commented Nov 5, 2018

If I unbond 2.5 steak, my delegation correctly drops to 97.5 steak but my undelegation shows only 2 steak. Is that correct behavior? In sum the undelegation tx would reduce my total steaks by 0.5 steak.

@cwgoes
Copy link
Contributor

cwgoes commented Nov 5, 2018

If I unbond 2.5 steak, my delegation correctly drops to 97.5 steak but my undelegation shows only 2 steak. Is that correct behavior? In sum the undelegation tx would reduce my total steaks by 0.5 steak.

That's correct; the amount of tokens you receive is rounded down.

@jackzampolin
Copy link
Member

So is this a documentation fix then?

@alexanderbez
Copy link
Contributor

Ahhh I think we still need to verify it works via Gaia Lite. I tried via the CLI and it works, I just haven't had time to test Gaia Lite. Can you test @jackzampolin?

@cwgoes
Copy link
Contributor

cwgoes commented Nov 26, 2018

Closing this but please reopen @faboweb if you can reproduce on the develop branch.

@cwgoes cwgoes closed this as completed Nov 26, 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

5 participants