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

x/distribution withdraw-all-rewards got wrong account sequence on PeriodicVestingAccount #567

Closed
kwunyeung opened this issue Jul 17, 2021 · 6 comments
Labels
status/waiting-upstream This issue is waiting for a dependency to be updated in order to be worked on

Comments

@kwunyeung
Copy link
Contributor

The buggy account is

https://morpheus.desmos.network/accounts/desmos1snmetx9sfrmznr4z6d3lnwlyvwu36sgcpzzhlr

I ran

desmos tx distribution withdraw-all-rewards

to withdraw all rewards from all delegations but then after broadcasting the tx, it gave me this

Error: rpc error: code = InvalidArgument desc = account sequence mismatch, expected 29, got 28: incorrect account sequence: invalid request

The sequence number is incremented before the tx is committed. Interestingly, for the same account, withdrawing rewards from each delegation by MsgWithdrawDelegatorReward has no problem. It only happens with the withdraw-all-rewards command which broadcast a tx with multiple MsgWithdrawDelegatorReward.

I have tested this with other accounts but only this account would give the issue. It has 12 delegations and it's a PeriodicVestingAccount. Not sure if this is an issue in x/distribution in the SDK or some misuse of x/auth.

@dadamu dadamu self-assigned this Jul 19, 2021
@dadamu
Copy link
Contributor

dadamu commented Jul 21, 2021

@kwunyeung The withdraw-all-rewards cmd should have been fixed in this issue with 0.42.5 version of cosmos-sdk. By the way, I can't reproduce it as well in the current desmos version.

@kwunyeung
Copy link
Contributor Author

@dadamu the issue exists when an account has more than 5 delegations as withdraw-all-rewards will commit the first tx with 5 MsgWithdrawDelegatorReward messages and then another 5 MsgWithdrawDelegatorReward messages, etc. The sequence will not be correct if the --broadcast-mode is not block.

If this has been fixed in v0.42.5, have we picked the fix in our sdk fork? I think withdraw-all-rewards should bypass sync and async mode.

@dadamu
Copy link
Contributor

dadamu commented Jul 22, 2021

@kwunyeung Tested it with 12 nodes. The default max-msgs is 5 so the error happens, setting it to 0 (meaning that send all msgs in one transaction) can solve it.

@kwunyeung
Copy link
Contributor Author

I guess we need to mention it somewhere in the doc then.

@RiccardoM
Copy link
Contributor

I've opened a PR to improve the UX of the withdraw-all-rewards directly inside the Cosmos SDK: cosmos/cosmos-sdk#9781

@RiccardoM RiccardoM added the status/waiting-upstream This issue is waiting for a dependency to be updated in order to be worked on label Jul 27, 2021
@RiccardoM
Copy link
Contributor

Should have been solved with v0.17.6. In that version I'm using commit desmos-labs/cosmos-sdk@640390b our fork of the SDK repo, which also integrates the commit that should have fixed this (desmos-labs/cosmos-sdk@52843ec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/waiting-upstream This issue is waiting for a dependency to be updated in order to be worked on
Projects
None yet
Development

No branches or pull requests

3 participants