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

feat: Add SIGN_MODE_DIRECT_AUX and tx Tip proto definitions #9405

Merged
merged 16 commits into from
Aug 11, 2021

Conversation

aaronc
Copy link
Member

@aaronc aaronc commented May 27, 2021

closes: #9406


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.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@aaronc aaronc requested review from fdymylja, gamarin2, zmanian and hxrts May 27, 2021 16:45
@aaronc aaronc changed the title feat: Add SIGN_MODE_DIRECT_AUX and tx Tip's feat: Add SIGN_MODE_DIRECT_AUX and tx Tip proto definitions May 27, 2021
Comment on lines 68 to 73
google.protobuf.Any public_key = 2;
string chain_id = 3;
uint64 account_number = 4;

// tip should be left empty if the signer is not the tipper for this transaction
Tip tip = 5;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that we need to have deterministic encoding for public_key and tip

proto/cosmos/tx/v1beta1/tx.proto Outdated Show resolved Hide resolved
proto/cosmos/tx/v1beta1/tx.proto Outdated Show resolved Hide resolved
@orijbot
Copy link

orijbot commented Jul 14, 2021

Visit https://dashboard.github.orijtech.com?pr=9405&repo=cosmos%2Fcosmos-sdk to see benchmark details.

@codecov
Copy link

codecov bot commented Jul 14, 2021

Codecov Report

Merging #9405 (674cbca) into master (c14b101) will decrease coverage by 0.13%.
The diff coverage is n/a.

❗ Current head 674cbca differs from pull request most recent head f4c2770. Consider uploading reports for the commit f4c2770 to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #9405      +/-   ##
==========================================
- Coverage   63.60%   63.46%   -0.14%     
==========================================
  Files         568      568              
  Lines       53509    53256     -253     
==========================================
- Hits        34034    33799     -235     
+ Misses      17550    17533      -17     
+ Partials     1925     1924       -1     
Impacted Files Coverage Δ
x/bank/types/key.go 70.00% <0.00%> (-12.36%) ⬇️
x/params/keeper/keeper.go 76.92% <0.00%> (-5.43%) ⬇️
x/bank/migrations/v044/store.go 68.42% <0.00%> (-5.27%) ⬇️
client/keys/import.go 57.14% <0.00%> (-1.95%) ⬇️
x/params/types/subspace.go 80.59% <0.00%> (-1.23%) ⬇️
x/auth/ante/fee.go 82.27% <0.00%> (-1.06%) ⬇️
client/context.go 57.22% <0.00%> (-1.06%) ⬇️
x/auth/client/testutil/suite.go 96.31% <0.00%> (-0.52%) ⬇️
types/events.go 82.77% <0.00%> (ø)
client/keys/add.go 67.42% <0.00%> (ø)
... and 4 more

@aaronc
Copy link
Member Author

aaronc commented Jul 27, 2021

Is someone able to pick this up as part of #9406? @AmauryM @ruhatch ?

@amaury1093
Copy link
Contributor

Is someone able to pick this up as part of #9406? @AmauryM @ruhatch ?

Discussed during our standup today, I'll clean up this PR.

@@ -96,6 +96,32 @@ message SignDocJSON {
bytes sign_doc_sha256_hash = 5;
}

// SignDocDirectAux is the type used for generating sign bytes for
// SIGN_MODE_DIRECT_AUX.
message SignDocDirectAux {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed from SignDocAux to SignDocDirectAux for consistency with SIGN_MODE_ namings

// primary signer and the one which pays the fee. The fee can be calculated
// based on the cost of evaluating the body and doing signature verification
// of the signers. This can be estimated via simulation.
Fee fee = 6;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aaronc I added Fee on top of your version of SignDocAux. Now everything that was in the signer's AuthInfo is in SignDoc too (for 0 malleability surface)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SignDocAux can't contain Fee. That defeats the whole purpose of aux - if they knew the fee, they wouldn't be using SIGN_MODE_AUX. Basically fee payers should always use SIGN_MODE_DIRECT and non-fee payers can use SIGN_MODE_AUX and then they don't need to sign over the fee or any of the rest of AuthInfo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks. I reverted Fee

@amaury1093 amaury1093 marked this pull request as ready for review August 2, 2021 16:50
@cyberbono3
Copy link
Contributor

should we add tests here?

@amaury1093
Copy link
Contributor

should we add tests here?

This PR only changes the proto definitions. We should add tests when we do the implementation of this sign mode

Copy link
Contributor

@cyberbono3 cyberbono3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aaronc aaronc added the A:automerge Automatically merge PR once all prerequisites pass. label Aug 7, 2021
@mergify mergify bot merged commit 69b4935 into master Aug 11, 2021
@mergify mergify bot deleted the aaronc/tx-tips branch August 11, 2021 11:12
@amaury1093 amaury1093 mentioned this pull request Sep 29, 2021
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add transaction tips (aka "meta transactions") - proto definitions
6 participants