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

Sort all msg.GetSignBytes #1563

Merged
merged 6 commits into from
Jul 6, 2018
Merged

Sort all msg.GetSignBytes #1563

merged 6 commits into from
Jul 6, 2018

Conversation

liamsi
Copy link
Contributor

@liamsi liamsi commented Jul 5, 2018

Call MustSortJSON before return JSON bytes to guarantee alphabetic ordering on all msgs.

related discussion: tendermint/go-amino#171 (comment)
resolves #1550

  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGELOG.md
  • Updated Gaia/Examples
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)
  • Added appropriate labels to PR (ex. wip, ready-for-review, docs)

- call SortJSON before return JSON bytes to guarantee alphabetic
ordering
Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

Can we avoid the duplication by adding server.MustSortJSON which panics on error?

Also, every msg.GetSignBytes function should be sorted.

- call MustSortJSON before return JSON bytes to guarantee alphabetic
ordering

- moved SortJSON and MustSortJSON to types package to avoid cyclic
package dep
@liamsi liamsi requested review from jbibla and zramsay as code owners July 6, 2018 00:13
@liamsi
Copy link
Contributor Author

liamsi commented Jul 6, 2018

Thanks for the review @cwgoes. Now, all GetSignBytes call MustSortJSON (with one exception: server/mock/tx.go which doesn't include valid JSON). As discussed, moved the JSON-sorted related methods and tests into types, too.

@codecov
Copy link

codecov bot commented Jul 6, 2018

Codecov Report

Merging #1563 into develop will decrease coverage by 0.08%.
The diff coverage is 58.06%.

@@             Coverage Diff             @@
##           develop    #1563      +/-   ##
===========================================
- Coverage    64.46%   64.37%   -0.09%     
===========================================
  Files          118      119       +1     
  Lines         6495     6510      +15     
===========================================
+ Hits          4187     4191       +4     
- Misses        2060     2068       +8     
- Partials       248      251       +3

@liamsi liamsi changed the title sort all relevant GetSignBytes Sort all msg.GetSignBytes Jul 6, 2018
@rigelrozanski
Copy link
Contributor

Looks good! Last step is to go through the PR checkboxes then we should be good to merge

Copy link
Contributor

@rigelrozanski rigelrozanski left a comment

Choose a reason for hiding this comment

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

hmm why cli tests failing?

@liamsi
Copy link
Contributor Author

liamsi commented Jul 6, 2018

hmm why cli tests failing?

Not sure. Looks unrelated to this change 🤔 Merged in latest develop. Let's see (tomorrow) 😴

Copy link
Contributor

@cwgoes cwgoes left a comment

Choose a reason for hiding this comment

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

utACK

@cwgoes cwgoes dismissed rigelrozanski’s stale review July 6, 2018 02:07

CLI tests are nondeterministic.

@cwgoes cwgoes merged commit 6946636 into cosmos:develop Jul 6, 2018
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.

msg.GetSignBytes() should sort JSON alphabetically by keys
3 participants