-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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 deterministic proto JSON marshaler (WIP) #13187
Conversation
Codecov Report
@@ Coverage Diff @@
## main #13187 +/- ##
==========================================
- Coverage 55.87% 53.73% -2.15%
==========================================
Files 646 653 +7
Lines 54895 55407 +512
==========================================
- Hits 30675 29773 -902
- Misses 21762 23240 +1478
+ Partials 2458 2394 -64
|
@@ -0,0 +1,64 @@ | |||
package stablejson |
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.
could you quickly tldr this?
Things like this was part of the reason moving away from amino. We didnt want to maintain our own encoding.
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.
My goal here is not to change the protojson encoding. I just want something deterministic. I needed it for the orm and now for typed events (not sure determinism is 100% necessary but feel better with it than without). The existing protojson implementations are explicitly non deterministic.
There is a separate convo to change bytes encoding to hex. I don't actually agree. I think we should stick with the standard. But that's a separate matter.
@marbar3778 @AmauryM so was the conclusion we should move this to the cosmos-proto repo? Should the amino json support live there too? |
that makes more sense to me |
Not sure if that's possible, but I think stablejson should be in cosmos-proto, but the amino part in the SDK. I'm not sure it should be exposed to anyone else apart from the SDK internals. |
I think it would be easiest for them to be in the same place so some code can be shared. (Although duplication may be terrible... or even unavoidable if the implementation ends up being really different). |
Altnernatively, we could also bring cosmos-proto here as a standalone module. |
I don't have a strong opinion. Let's just make a call |
cosmos-proto, please |
moving to cosmos-proto |
Description
Started pulling some code from https://github.com/cosmos/cosmos-sdk/tree/main/orm/internal/stablejson into its own package and filling in pieces I was missing before. Ref #12994 (comment)
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change