-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Put AccountSequence in SignerInfo #6997
Conversation
@@ -28,7 +28,7 @@ querying. However, this ADR solely focuses on transactions. Querying should be | |||
addressed in a future ADR, but it should build off of these proposals. | |||
|
|||
Based on detailed discussions ([\#6030](https://github.com/cosmos/cosmos-sdk/issues/6030) | |||
and [\#6078](https://github.com/cosmos/cosmos-sdk/issues/6078)), the original | |||
and [\#6078](https://github.com/cosmos/cosmos-sdk/issues/6078)), the original |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, spacing changes are made by my editor... but i think they make sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you editor. By the way, have you considered adding an .editorconfig to this repo? I made very good experience with it and use it in all projects: https://editorconfig.org/
Codecov Report
@@ Coverage Diff @@
## master #6997 +/- ##
==========================================
+ Coverage 54.49% 54.54% +0.05%
==========================================
Files 550 550
Lines 37706 37684 -22
==========================================
+ Hits 20546 20554 +8
+ Misses 15472 15441 -31
- Partials 1688 1689 +1 |
…966-seq-in-signerinfo
…966-seq-in-signerinfo
…966-seq-in-signerinfo
…966-seq-in-signerinfo
x/auth/signing/sign_mode_handler.go
Outdated
// for replay protection. This field is only useful for Legacy Amino signing, | ||
// since in SIGN_MODE_DIRECT the account sequence is already in the signer | ||
// info. | ||
AccountSequence uint64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have loved to remove AccountSequence
from SignerData, but afaiu it is still used for SIGN_MODE_LEGACY. So keeping it here.
x/auth/ante/sigverify.go
Outdated
// Check account sequence number. | ||
if sig.AccountSequence != acc.GetSequence() { | ||
return ctx, sdkerrors.Wrapf( | ||
sdkerrors.ErrWrongAccountSequence, | ||
"account sequence mismatch, expected %d, got %d", acc.GetSequence(), sig.AccountSequence, | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A separate ante handler would also have made sense, but since it's just 7 lines, I thought just to leave it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing to pull out this error case. Much appreciated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the a huge benefit for clients.
A concern I have is how to handle |
…osmos-sdk into am-6966-seq-in-signerinfo
Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>
Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>
Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, it looks good and I am very happy for this better error message on incorrect sequence numbers (the most common case of a theoretically valid tx failing... when they end up out of order).
I think there is some simplification that can be made and the test constants cleaned up a bit. Also the AccountSequence
vs Sequence
issue... but I think you inherited the naming mis-match
x/auth/ante/sigverify.go
Outdated
// Check account sequence number. | ||
if sig.AccountSequence != acc.GetSequence() { | ||
return ctx, sdkerrors.Wrapf( | ||
sdkerrors.ErrWrongAccountSequence, | ||
"account sequence mismatch, expected %d, got %d", acc.GetSequence(), sig.AccountSequence, | ||
) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the a huge benefit for clients.
…966-seq-in-signerinfo
…966-seq-in-signerinfo
…966-seq-in-signerinfo
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
…966-seq-in-signerinfo
…osmos-sdk into am-6966-seq-in-signerinfo
* WIP test the grounds * Update ADR020 * Fix compile errors * Fix ADR * Make ante tests pass * Fix remaining ante handler tests * Simplify code * Fix x/bank app_test * Fix tests * Remove useless accSeq from signerdata * Fix test * Update simapp/helpers/test_helpers.go Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> * Update simapp/helpers/test_helpers.go Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> * Update x/auth/client/cli/tx_multisign.go Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> * Address rewview * Update x/auth/ante/sigverify.go Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com> * Update x/auth/ante/sigverify_test.go Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com> * Update x/auth/tx/builder_test.go Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com> * Update x/auth/tx/builder_test.go Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com> * Update x/auth/tx/direct_test.go Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com> * Update x/auth/tx/builder_test.go Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com> * AccSeq -> Seq * Address reviews * Better variable naming * Fix variable assign * Remove old SetSignerInfo * Fix test * proto-gen * Make proto-gen * Reput gw comment * Add Changelog * Update x/bank/app_test.go Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> * Update x/bank/app_test.go Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: SaReN <sahithnarahari@gmail.com> Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>
Description
fixes #6966
cc @ethanfrey
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes