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

Followup on 149 and 151 #155

Merged
merged 5 commits into from
Feb 13, 2020
Merged

Conversation

liamsi
Copy link
Member

@liamsi liamsi commented Feb 12, 2020

closes #154

  • Referenced an issue explaining the need for the change
  • Updated all relevant documentation in docs
  • Updated all code comments where relevant
  • Wrote tests
  • Updated CHANGES.md

- don't use refs for time and duration
- simplify is_within_trust_period according to suggestion in: #149 (comment)
- simply Kind::DurationOutOfRange as we don't need to wrap a SystemTimeError anymore
let header_time: SystemTime = last_header.bft_time().into();
let expires_at = header_time.add(trusting_period);
// Ensure now > expires_at.
// TODO: shouldn't this be <= instead below:
Copy link
Member Author

@liamsi liamsi Feb 12, 2020

Choose a reason for hiding this comment

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

See discussion: #149 (comment) cc @ebuchman

Copy link
Member Author

Choose a reason for hiding this comment

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

The spec mentions return header.Time + trustedPeriod > now (for the non-error'ing case) and the go code also behaves accordingly. So this should indeed be <=!

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed accordingly in 301958f

@liamsi liamsi marked this pull request as ready for review February 12, 2020 02:12
@liamsi liamsi mentioned this pull request Feb 12, 2020
3 tasks
@codecov-io
Copy link

codecov-io commented Feb 12, 2020

Codecov Report

Merging #155 into master will decrease coverage by 1.36%.
The diff coverage is 45.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #155      +/-   ##
==========================================
- Coverage   36.74%   35.38%   -1.37%     
==========================================
  Files          91       91              
  Lines        3233     3188      -45     
  Branches      500      505       +5     
==========================================
- Hits         1188     1128      -60     
- Misses       1775     1776       +1     
- Partials      270      284      +14
Impacted Files Coverage Δ
tendermint/src/lite/error.rs 47.05% <0%> (+0.9%) ⬆️
tendermint/src/lite/types.rs 49.13% <0%> (-5.93%) ⬇️
tendermint-lite/src/main.rs 0% <0%> (ø) ⬆️
tendermint/src/lite_impl/signed_header.rs 78.84% <44.44%> (ø) ⬆️
tendermint/src/lite/verifier.rs 70.75% <61.11%> (-5.83%) ⬇️
tendermint/src/validator.rs 47.77% <0%> (-5.49%) ⬇️
tendermint/src/block/commit.rs 45% <0%> (-5%) ⬇️
tendermint/src/vote/power.rs 10.52% <0%> (-3.76%) ⬇️
... and 18 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 52e2132...301958f. Read the comment docs.

@liamsi liamsi requested review from ebuchman, xla and tarcieri February 12, 2020 02:13
@liamsi
Copy link
Member Author

liamsi commented Feb 12, 2020

I don't understand why this seems to decrease test-coverage?

@liamsi liamsi requested a review from Shivani912 February 12, 2020 02:17
trusting_period: &Duration,
now: &SystemTime,
trusting_period: Duration,
now: SystemTime,
Copy link
Member Author

Choose a reason for hiding this comment

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

Both SytemTime and Duration implement the Copy trait. Hence, these references where not needed.

#[error("duration error {:?}", _0)]
DurationOutOfRange(#[from] SystemTimeError),
#[error("trusted header time is too far in the future")]
DurationOutOfRange,
Copy link
Member Author

@liamsi liamsi Feb 12, 2020

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

@Shivani912
Copy link
Contributor

As discussed with @liamsi I'm working on fixing issues with voting_power_in explained here and will be adding more rust-only tests

@Shivani912
Copy link
Contributor

Looks good to me! 👍

@liamsi
Copy link
Member Author

liamsi commented Feb 13, 2020

Thanks for the review @Shivani912 👍

@liamsi liamsi merged commit 5c3aff6 into master Feb 13, 2020
@liamsi liamsi deleted the ismail/light_errors_followup_149_and_151 branch February 13, 2020 22:56
@liamsi liamsi mentioned this pull request Feb 13, 2020
5 tasks
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.

Light client errors follow-up
3 participants