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 fee.{payer,granter} and tip fields to StdSignDoc #10348

Merged
merged 34 commits into from Oct 22, 2021

Conversation

amaury1093
Copy link
Contributor

@amaury1093 amaury1093 commented Oct 12, 2021

Description

Closes: #10346

StdSignDoc used by LEGACY_AMINO_JSON:

{
  "account_number": {number},
  "chain_id": {string},
  "fee": {
    "amount": [{"amount": {number}, "denom": {string}}, ...],
    "gas": {number},
+   "payer": {string}, // optional, omitempty, chain-specific bech32 address
+   "granter": {string}, // optional, omitempty, chain-specific bech32 address
  },
  "memo": {string},
  "msgs": [{arbitrary}],
  "sequence": {number},
+  "tip": { // optional, whole struct is omitempty
+    "tipper": "cosmos1...", // cannot be ""
+    "amount": [{"amount": {number}, "denom": {string}}, ...], // array of coins, can be [], but not omitempty
+  }
}

Depends on:


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@amaury1093 amaury1093 changed the title Add fee.{payer,granter} and tip fields to StdSignDoc feat: Add fee.{payer,granter} and tip fields to StdSignDoc Oct 12, 2021
x/auth/migrations/legacytx/stdsign.go Outdated Show resolved Hide resolved
x/auth/migrations/legacytx/stdtx.go Outdated Show resolved Hide resolved
Base automatically changed from am/0fee0gas to master October 18, 2021 10:32
@amaury1093
Copy link
Contributor Author

Putting this PR as R4R

@amaury1093 amaury1093 marked this pull request as ready for review October 18, 2021 11:05
@codecov
Copy link

codecov bot commented Oct 18, 2021

Codecov Report

Merging #10348 (6b9abab) into master (994219a) will decrease coverage by 0.01%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10348      +/-   ##
==========================================
- Coverage   64.42%   64.41%   -0.02%     
==========================================
  Files         573      573              
  Lines       54619    54649      +30     
==========================================
+ Hits        35190    35202      +12     
- Misses      17432    17449      +17     
- Partials     1997     1998       +1     
Impacted Files Coverage Δ
x/auth/migrations/legacytx/stdsignmsg.go 0.00% <0.00%> (ø)
x/auth/migrations/legacytx/stdtx.go 82.14% <ø> (ø)
x/auth/migrations/legacytx/stdsign.go 77.52% <71.42%> (-0.79%) ⬇️
x/auth/tx/legacy_amino_json.go 87.23% <87.50%> (-0.77%) ⬇️
x/auth/migrations/legacytx/amino_signing.go 63.82% <100.00%> (ø)
x/auth/tx/builder.go 78.60% <100.00%> (+2.54%) ⬆️
x/auth/tx/direct_aux.go 88.88% <100.00%> (ø)
x/distribution/simulation/operations.go 80.54% <0.00%> (-9.73%) ⬇️

Copy link
Contributor

@atheeshp atheeshp left a comment

Choose a reason for hiding this comment

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

lgtm

x/auth/migrations/legacytx/stdtx_test.go Outdated Show resolved Hide resolved
Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
Copy link
Contributor

@i-norden i-norden left a comment

Choose a reason for hiding this comment

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

Hi Amaury, looking through this I can't find much to change. I think one of the unit tests is redundant but otherwise looks great.

At this stage do the docs/core/transactions.md, docs/basics/tx-lifecycle.md, docs/basics/gas-fees.md need to be updated?

x/auth/tx/legacy_amino_json_test.go Outdated Show resolved Hide resolved
x/auth/tx/legacy_amino_json_test.go Outdated Show resolved Hide resolved
@amaury1093
Copy link
Contributor Author

Thanks a lot @i-norden !

At this stage do the docs/core/transactions.md, docs/basics/tx-lifecycle.md, docs/basics/gas-fees.md need to be updated?

I created an issue for docs: #10426. I'd like the docs about this PR's changes to fit in nicely in the larger transactions tips story.

@amaury1093 amaury1093 merged commit 956d8b4 into master Oct 22, 2021
@amaury1093 amaury1093 deleted the am/amino-tipper branch October 22, 2021 13:13
@amaury1093 amaury1093 mentioned this pull request Oct 22, 2021
23 tasks
creachadair pushed a commit that referenced this pull request Oct 22, 2021
* Add IsTipper

* Use addr in signer data

* Always populate addr in signer data

* fi error messages

* make proto gen

* fix build

* Add fields to sign docs and sign mode handler

* Remove getSequence

* Update x/auth/migrations/legacytx/stdtx.go

Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>

* Update x/auth/migrations/legacytx/stdsign.go

Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>

* Use addressCodec

* NewTxConfig with addrCdc

* REmove simapp.NewBech32

* Move bech32 stuff to x/auth/address

* Add changelog

* Move address.Codec to x/auth

* Fix test

* Add tests for tipper and feepayer

* Rename tests

* Add more tests

* Empty tip test

* Revert unwanted files

* Less line diff

* fix test

* fix another test

* Fix test

* Update x/auth/migrations/legacytx/stdtx_test.go

Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>

* Address reviews

Co-authored-by: Simon Warta <2603011+webmaster128@users.noreply.github.com>
Co-authored-by: atheeshp <59333759+atheeshp@users.noreply.github.com>
@amaury1093 amaury1093 mentioned this pull request May 20, 2022
72 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add feepayer, feegranter and tip fields to StdSignDoc
4 participants