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

support denoms custom validation #7450

Merged
merged 5 commits into from
Oct 7, 2020

Conversation

okwme
Copy link
Contributor

@okwme okwme commented Oct 4, 2020

Backport of #6755

Closes: #6744
Origin: #6755


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

@codecov
Copy link

codecov bot commented Oct 4, 2020

Codecov Report

❗ No coverage uploaded for pull request base (launchpad/backports@203876e). Click here to learn what that means.
The diff coverage is n/a.

@@                  Coverage Diff                   @@
##             launchpad/backports    #7450   +/-   ##
======================================================
  Coverage                       ?   50.23%           
======================================================
  Files                          ?      338           
  Lines                          ?    17548           
  Branches                       ?        0           
======================================================
  Hits                           ?     8815           
  Misses                         ?     7945           
  Partials                       ?      788           

@alessio
Copy link
Contributor

alessio commented Oct 4, 2020

Hey! Just rebase this against launchpad/backports - that will do it

@alessio
Copy link
Contributor

alessio commented Oct 4, 2020

@ethanfrey @clevinson
Hello fellow SRMs!
I love this PR and it's good-to-go from me (pending rebase to the right target branch). I also believe that this does not require Stable Release Exception - this introduces neither API nor ABI changes.

Copy link
Contributor

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

The code looks clean enough to me. And all that change are private (package-internal) variables, just adding some public variables.

I guess you could set this in app.go to allow different denoms, but I am unclear if that is actually useful? Keeping them strict and consistent is nice in the lead-up to IBC. Why do we want people to allow emoji denoms? (Show me the use case and I may approve it)

@@ -70,6 +70,31 @@ func TestCoinIsValid(t *testing.T) {
}
}

func TestCustomValidation(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This part I get

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

)

func returnDecCoin() *regexp.Regexp {
Copy link
Contributor

Choose a reason for hiding this comment

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

And so if I write the global CoinDenomRegex it will let me override all these checks done inside of Coin.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alessio alessio changed the base branch from okwme/v0.39.1-target to launchpad/backports October 4, 2020 19:53
@alessio
Copy link
Contributor

alessio commented Oct 4, 2020

FTR @okwme, I've taken care of this ->

just rebase this against launchpad/backports - that will do it

👍

@okwme
Copy link
Contributor Author

okwme commented Oct 5, 2020

The code looks clean enough to me. And all that change are private (package-internal) variables, just adding some public variables.

I guess you could set this in app.go to allow different denoms, but I am unclear if that is actually useful? Keeping them strict and consistent is nice in the lead-up to IBC. Why do we want people to allow emoji denoms? (Show me the use case and I may approve it)

We made a kudos blockchain where users can mint one emoji denom coin a day: https://github.com/interchainberlin/pooltoy

I had to fork the SDK just to allow use of emojis. I can see why it's important for IBC denom management to be consistent but when the logic is just internal to the application it should be up to the application to make those design choices. We might go as far and actually make denom recommendations (in the form of default values maybe like now) but it's always going to be up to the app developer to make those final calls. We'd be better to give them a clean method of doing so rather than forcing them to fork the SDK and potentially fall out of sync with updates.

Do you think it's a strong enough security threat that we should be making it as difficult as possible to make custom denoms validation @ethanfrey ?

@ethanfrey
Copy link
Contributor

Thank you for explaining the use case. Sounds like a fun toy.

I would just ask you to check with the IBC team on this one if it is an issue (or if they can add emoji support to ICS20). If they give it an okay, then I will too. This is more important for the merge to master, I guess this can go in, but then if we disable emojis in stargate, that would suck.

@okwme
Copy link
Contributor Author

okwme commented Oct 5, 2020 via email

Copy link
Contributor

@ethanfrey ethanfrey left a comment

Choose a reason for hiding this comment

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

Thinking a bit more, it shouldn't not stop an IBC transfer for an emoji from a chain to a non-emoji chain, as the tokens are described with hashes. It would just block displaying it properly on the remote chain. And that being that IBC doesn't add emoji support.

I actually see other use-cases changing lengths or casing or special chars per chain.

I just need to think on it a bit, but I approve this. Happy to see them pool toys

Copy link
Contributor

@alessio alessio left a comment

Choose a reason for hiding this comment

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

Good to go (pending merge of #6755 - that should go in first)

Copy link
Contributor

@alessio alessio left a comment

Choose a reason for hiding this comment

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

@alessio alessio added this to the 0.39.2 - The Launchpad Series milestone Oct 6, 2020
@alessio alessio mentioned this pull request Oct 6, 2020
9 tasks
@alessio alessio changed the title Billy/6744 launchpad custom validation support denoms' custom validation Oct 6, 2020
@alessio alessio changed the title support denoms' custom validation support denoms custom validation Oct 6, 2020
@okwme
Copy link
Contributor Author

okwme commented Oct 7, 2020

@alessio updated the changelog, is that the correct format?

@alessio
Copy link
Contributor

alessio commented Oct 7, 2020

@okwme looks good to me

@okwme okwme merged commit 3101928 into launchpad/backports Oct 7, 2020
@okwme okwme deleted the billy/6744-launchpad-custom-validation branch October 7, 2020 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants