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

fix: Format decimals correctly for signmode textual #15129

Merged
merged 12 commits into from
Feb 27, 2023

Conversation

facundomedica
Copy link
Member

@facundomedica facundomedica commented Feb 22, 2023

Description

This solves the issue with values being formatted as huge numbers. Like --commission-rate="0.1" being shown as 100'000'000'000'000'000.

Warning: this is a workaround to a bigger issue regarding sdk.Dec. Values that don't contain a "." will be processed as if they were Ne-18. We need to double-check if this affects anything else

Related: #10863


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)

@facundomedica facundomedica marked this pull request as ready for review February 22, 2023 19:41
@facundomedica facundomedica requested a review from a team as a code owner February 22, 2023 19:41
@facundomedica facundomedica requested review from webmaster128 and amaury1093 and removed request for JeancarloBarrios and samricotta February 22, 2023 19:41
["123", "123"],
["1234", "1'234"],
["0.0", "0"],
["1.0", "1"],
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember when we introduced gov v1, we dropped the customtype to sdk.Dec, see here or tally. This means in state, the string is stored as a "normal" decimal.

What we need to make sure is that the string does always have a .. For example, we should test this manually with Ledger, using a weighted vote of 1, and make sure it shows 1 and not 1e-18.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will test that 👌

Copy link
Member Author

Choose a reason for hiding this comment

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

...Options (1/1)xWeightedVoteOption object�fOptionoVOTE_OPTION_YES�fWeighta1�nEnd of Options�nEnd of Message�iGas limitg200'000...

WhatsApp Image 2023-02-23 at 3 17 02 PM

Looks fine 👌 Also for bank send it looks good.

Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

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

Impl LGTM, can merge if it's tested manually #15129 (comment)

x/tx/textual/dec.go Outdated Show resolved Hide resolved
func (mp *SenderNonceMempool) NextSenderTx(sender string) sdk.Tx {
senderIndex, ok := mp.senders[sender]
func (snm *SenderNonceMempool) NextSenderTx(sender string) sdk.Tx {
senderIndex, ok := snm.senders[sender]
Copy link
Member Author

Choose a reason for hiding this comment

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

changes to make the linter happy

@github-actions github-actions bot removed the C:x/gov label Feb 24, 2023
Copy link
Contributor

@likhita-809 likhita-809 left a comment

Choose a reason for hiding this comment

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

everything lgtm

@facundomedica facundomedica enabled auto-merge (squash) February 27, 2023 12:12
@facundomedica facundomedica merged commit 74ff94f into main Feb 27, 2023
@facundomedica facundomedica deleted the facu/textual-dec-workaround branch February 27, 2023 12:34
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.

4 participants