-
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
AppendJson is a bit misleading #1531
Comments
Ahhh confusing indeed! I think we could have both solutions you suggested actually and leave it up to the client to choose which it wants 👍 |
I'll address this in #983 :-) |
Just to make sure we won't do double the work: I'm currently adding a method that takes arbitary JSON and returns (semantically) the same JSON but sorted by keys. |
@liamsi perfect, I won't implement the sorted variant, I'll just rename the existing function. Also, fun fact, |
I know, my idea was to take arbitrary json, decode into an Amino doesn't by key (like proto3 doesn't sort field names either; although map keys are sorted by proto3 IIRC). |
Closed via #1559 |
While it sounds like it will append to the end, it uses a golang
map
internally. Hence, the passed key won't necessarily end up at the end (and the written JSON can have a completely different key ordering):cosmos-sdk/server/util.go
Lines 126 to 136 in 270e216
This might causes some confusion. Suggestions: either
InsertKeyAndSortJSON
(sort keys after including the new key) , or,IncludeJSON
(keeps the introduced non-determinism but is clearly named).See also:
tendermint/go-amino#171 (comment)
#983 (comment)
The text was updated successfully, but these errors were encountered: