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(textual): Coin and Coins value renderers #12729

Merged
merged 28 commits into from
Sep 14, 2022
Merged

Conversation

amaury1093
Copy link
Contributor

Description

Closes: #12708

Initially was part of #12088, but carved out of that PR into its own.


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)

@joeabbey joeabbey mentioned this pull request Jul 26, 2022
19 tasks
@amaury1093 amaury1093 marked this pull request as ready for review September 1, 2022 16:59
@amaury1093 amaury1093 requested a review from a team as a code owner September 1, 2022 16:59
[{"amount": "100000", "denom": "point"}, { "denom": "POINT", "exponent": 0 }, "100'000 POINT"],
[{"amount": "1000000", "denom": "point"}, { "denom": "POINT", "exponent": 0 }, "1'000'000 POINT"],
[{"amount": "10000000", "denom": "point"}, { "denom": "POINT", "exponent": 0 }, "10'000'000 POINT"]
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Add a test cases for

  • zero amount
  • coin without metadata
  • metadata with entries other than display and coin names
  • metadata without the display or coin name
  • failures (see timestamp.json for examples)

Copy link
Contributor Author

@amaury1093 amaury1093 Sep 5, 2022

Choose a reason for hiding this comment

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

Added test cases for all items except "metadata with entries other than display and coin names". That would be a test-only-related json parsing error, which I don't think is really useful here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Additional metadata entries would be valid JSON data, and shouldn't be an SDK error either. As I understand metadata, it should be perfectly valid to have:

"metadata": {
  "display": "buck",
  "denom_units": [
    {"denom": "ubuck", "exponent": 0},
    {"denom": "mill", "exponent": 3},
    {"denom": "cent", "exponent": 4},
    {"denom": "dime", "exponent": 5},
    {"denom": "buck", "exponent": 6},
    {"denom": "grand", "exponent": 9},
    {"denom": "dirksen", "exponent": 15}
  ]
}

Copy link
Contributor Author

@amaury1093 amaury1093 Sep 14, 2022

Choose a reason for hiding this comment

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

OK, I misunderstood, by metadata with entries other than display I understood adding e.g. a field foo: ... in the metadata struct.

Added test cases with unused items in the denom_units array.

"uxc1": { "denom": "xC1", "exponent": 6 }
},
"0.000001 xA, 0.000002 xB, 0.000003 xC, 0.000004 xC1"
]
Copy link
Contributor

Choose a reason for hiding this comment

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

Add test cases for an empty Coins and a Coins of a single Coin.

Also add cases with a failure in coins at the beginning, middle, and end or the coins array.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

Copy link
Contributor

Choose a reason for hiding this comment

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

Still needs empty coins and singleton coins.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added.

@codecov
Copy link

codecov bot commented Sep 6, 2022

Codecov Report

Merging #12729 (93b5537) into main (4fe7797) will decrease coverage by 0.78%.
The diff coverage is 24.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #12729      +/-   ##
==========================================
- Coverage   55.87%   55.09%   -0.79%     
==========================================
  Files         646      654       +8     
  Lines       54895    55627     +732     
==========================================
- Hits        30675    30648      -27     
- Misses      21762    22518     +756     
- Partials     2458     2461       +3     
Impacted Files Coverage Δ
baseapp/abci.go 67.01% <0.00%> (+2.59%) ⬆️
baseapp/grpcrouter.go 90.00% <ø> (ø)
baseapp/grpcrouter_helpers.go 25.00% <ø> (ø)
baseapp/grpcserver.go 1.72% <ø> (ø)
baseapp/msg_service_router.go 85.29% <ø> (+4.41%) ⬆️
baseapp/options.go 69.23% <ø> (+0.71%) ⬆️
client/cmd.go 57.73% <0.00%> (ø)
client/context.go 54.49% <0.00%> (-1.79%) ⬇️
client/flags/flags.go 19.35% <ø> (-0.32%) ⬇️
client/grpc_query.go 15.38% <ø> (+15.38%) ⬆️
... and 216 more

Copy link
Member

@facundomedica facundomedica left a comment

Choose a reason for hiding this comment

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

A couple of comments but looks solid 👌

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Sep 14, 2022
@amaury1093
Copy link
Contributor Author

I'm putting automerge on, to unblock some auto-generated CLI work which needs the coin formatting function.

@JimLarson I believe I addressed all your comments, but can do a follow-up if there's something else left.

@amaury1093 amaury1093 merged commit fd028db into main Sep 14, 2022
@amaury1093 amaury1093 deleted the am/12708-textual-coins branch September 14, 2022 10:32
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.

TEXTUAL Value Renderer for Coin and Coins
4 participants