-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add HexString method for namespace id #201
Add HexString method for namespace id #201
Conversation
Codecov Report
@@ Coverage Diff @@
## master #201 +/- ##
=======================================
Coverage 95.39% 95.40%
=======================================
Files 5 5
Lines 565 566 +1
=======================================
+ Hits 539 540 +1
Misses 15 15
Partials 11 11
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oooh nice!
this might actually be more useful in https://github.com/celestiaorg/celestia-app/blob/578c71cbfe033c1b597b903d22fda06f772db816/pkg/namespace/namespace.go#L8
since I think this namespace doesn't include the namespace verison, correct @rootulp? which could lead to devs using the incorrect hex
This namespace does include the namespace version so I think we can include this change here. |
Any reason not to change the default behavior of String to be always hex encoded? The current String is sorta useless while having default human-readable support for Stringer everywhere is not, AFAICS. The current String implementation can still be done with string(ID) if anyone needs raw nid in string format. @evan-forbes, @rootulp, thoughts? |
My rationale for recommending a new
If we can verify that no consumers of this library rely on the existing string representation then I think we can make the breaking change and modify the existing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@walldiss Could you please revise the title of the PR to capitalize |
I verified the usage in the node and it's used only in places where human-readable string is expected. |
I'm fine with mergin either, but I tend to agree that returning hex makes a lot of sense. if we need a string() for some reason, we can just call |
Merging b/c @walldiss doesn't have permission to. |
This PR contains a breaking change that implements #201 (comment). Relevant #200
Overview
Implements #200