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

Signatures converted from LegacyAmino to SignaturesV2 fail on sequence number other than 0 #7229

Closed
4 tasks
zmanian opened this issue Sep 2, 2020 · 5 comments · Fixed by #7234 or #7285
Closed
4 tasks
Assignees

Comments

@zmanian
Copy link
Member

zmanian commented Sep 2, 2020

https://github.com/cosmos/cosmos-sdk/blob/master/x/auth/types/stdtx.go#L381-L393

This converts legacy amino signatures to the new SignaturesV2. This always sets SignaturesV2 Sequence to 0.

Here we check if the account sequence matches matches the onchain sequence number.

https://github.com/cosmos/cosmos-sdk/blob/master/x/auth/ante/sigverify.go#L210-L215

This means signatures from that are converted from LegacyAmino will always fail in the ante handler except for the 1st tx from an account.


For Admin Use

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

zmanian commented Sep 2, 2020

on possible suggestion is that we skip sig.Sequence != acc.GetSequence() check if sig.Sequence == 0 && acc.GetSequence() != 0

@amaury1093
Copy link
Contributor

From Zaki:

Okay so this fix didn't actually work.

What happened is that CopyTx extracts a V2 Signature with SkipSequenceCheck on it but then immediately puts in to SignerInfos that doesn't contain SkipSequenceCheck field.

When the anteHandler calls GetSignatureV2(), it gets back a Signature with SkipSequenceCheck as false.
https://github.com/cosmos/cosmos-sdk/blob/master/client/tx/legacy.go#L39-L60

@alexanderbez
Copy link
Contributor

So do we need to instead add SkipSequenceCheck to SignerInfos?

@robert-zaremba
Copy link
Collaborator

I will try to look at it. @zmanian , @amaurymartiny - do we have some test cases for this? How can I replicate? Or I just need to dive in the code and guess what's wrong?

@aaronc
Copy link
Member

aaronc commented Sep 10, 2020

I just discussed this with @amaurymartiny.

I don't think we actually need SkipSequenceCheck at all. We just need to skip the sequence check if SIGN_MODE_LEGACY_AMINO_JSON is used. For multisigs, this would mean that we skip the check only if all signers use legacy amino JSON.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants