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

Add correct BlockHeight subtraction & remove panics. #1521

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

nuttycom
Copy link
Contributor

In contrast to the implementation of Sub<BlockHeight> for BlockHeight that was removed in version 0.3.0, a saturating subtraction for block heights having a return type of u32 makes sense for BlockHeight. Subtracting one block height from another yields the delta between them.

Other block height addition and subtraction operations have been made saturating, removing panics and the possibility of overflow.

In contrast to the implementation of `Sub<BlockHeight> for BlockHeight`
that was removed in version `0.3.0`, a saturating subtraction for block
heights having a return type of `u32` makes sense for `BlockHeight`.
Subtracting one block height from another yields the delta between them.

Other block height addition and subtraction operations have been made
saturating, removing panics and the possibility of overflow.
Copy link

codecov bot commented Aug 27, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 61.17%. Comparing base (a1047ad) to head (1b3433e).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
components/zcash_protocol/src/consensus.rs 50.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1521   +/-   ##
=======================================
  Coverage   61.17%   61.17%           
=======================================
  Files         141      141           
  Lines       16645    16645           
=======================================
  Hits        10183    10183           
  Misses       6462     6462           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@daira daira left a comment

Choose a reason for hiding this comment

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

utACK

@nuttycom nuttycom merged commit 7a1387d into zcash:main Aug 30, 2024
26 of 27 checks passed
@nuttycom nuttycom deleted the blockheight_saturating_ops branch August 30, 2024 17:26
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.

2 participants