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

ints: stricter numbers #4939

Merged
merged 8 commits into from Jun 4, 2020
Merged

ints: stricter numbers #4939

merged 8 commits into from Jun 4, 2020

Conversation

tac0turtle
Copy link
Contributor

@tac0turtle tac0turtle commented Jun 2, 2020

ref #2684

* proto: change int32 to uint32

- address comments post merge from: #4332

proto goes down to int32/uint32 it does not provide a smaller size

* add contract to comment

* change to assertValues

* make funcs take uint32

* fix linting

* change equal to equalValues
@auto-comment
Copy link

auto-comment bot commented Jun 2, 2020

👋 Thanks for creating a PR!

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.

  • Wrote tests
  • Updated CHANGELOG_PENDING.md
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Updated relevant documentation (docs/) and code comments
  • Re-reviewed Files changed in the Github PR explorer
  • Applied Appropriate Labels

Thank you for your contribution to Tendermint! 🚀

@tac0turtle tac0turtle changed the title proto: change int32 to uint32 (#4557) ints: stricter numbers Jun 2, 2020
* ints: change some ints to int32

- this is to help reduce the overall size of some proto prs.

Signed-off-by: Marko Baricevic <marbar3778@yahoo.com>

* add safemath for int32

* add safemath for subtraction

* add go doc to safemath funcs

* move panics to safe math, add checkconvert func

* make safe convert accept int64
@codecov
Copy link

codecov bot commented Jun 2, 2020

Codecov Report

Merging #4939 into master will increase coverage by 0.04%.
The diff coverage is 81.25%.

@@            Coverage Diff             @@
##           master    #4939      +/-   ##
==========================================
+ Coverage   63.34%   63.39%   +0.04%     
==========================================
  Files         189      189              
  Lines       19585    19584       -1     
==========================================
+ Hits        12406    12415       +9     
+ Misses       6192     6183       -9     
+ Partials      987      986       -1     
Impacted Files Coverage Δ
config/config.go 77.71% <0.00%> (ø)
config/toml.go 65.95% <ø> (ø)
consensus/reactor.go 72.96% <72.41%> (+0.78%) ⬆️
consensus/state.go 71.56% <96.77%> (-0.38%) ⬇️
tools/tm-signer-harness/internal/test_harness.go 61.40% <100.00%> (ø)
blockchain/v2/routine.go 77.61% <0.00%> (-2.99%) ⬇️
consensus/replay.go 71.72% <0.00%> (-0.85%) ⬇️
statesync/syncer.go 79.44% <0.00%> (-0.80%) ⬇️
p2p/switch.go 68.80% <0.00%> (-0.54%) ⬇️
... and 5 more

@tac0turtle tac0turtle self-assigned this Jun 3, 2020
@tac0turtle tac0turtle added the T:code-hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity. label Jun 3, 2020
@tac0turtle tac0turtle marked this pull request as ready for review June 3, 2020 19:25
Copy link
Contributor

@erikgrinaker erikgrinaker left a comment

Choose a reason for hiding this comment

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

LGTM! Have there been discussions on changing to uints? Many of these should probably never be negative.

@tac0turtle
Copy link
Contributor Author

LGTM! Have there been discussions on changing to uints? Many of these should probably never be negative.

there hasnt been any large discussions on when and how to tackle this but it is a want. I think tendermint is one of if not the only one heavily relying on ints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T:code-hygiene General cleanup and restructuring of code to provide clarity, flexibility, and modularity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants