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

Refactor CommitValidator and port over code from the lite_impl module #358

Merged
merged 1 commit into from
Jun 23, 2020

Conversation

romac
Copy link
Member

@romac romac commented Jun 23, 2020

Close: #341
Ref: #342

  • 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

Copy link
Member

@liamsi liamsi left a comment

Choose a reason for hiding this comment

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

LGTM 🙌

//
// It returns `ImplementationSpecific` error if it detects a signer
// that is not present in the validator set
fn validate_full(
Copy link
Member

Choose a reason for hiding this comment

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

it makes sense to decouple these and have a separate validate_full method instead 👍

.validate(signed_header, validators)
.map_err(|e| VerificationError::InvalidCommit(e.to_string()))?;
commit_validator.validate(signed_header, validators)?;
commit_validator.validate_full(signed_header, validators)?;
Copy link
Member

@liamsi liamsi Jun 23, 2020

Choose a reason for hiding this comment

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

Is there actually a place now where commit_validator.validate is used without validate_full?

Copy link
Member Author

Choose a reason for hiding this comment

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

No there's not. We currently perform both checks, and I don't see the need/place for doing just validate since we do 2/3 full verification of every block by that point. But perhaps that's not right, and we need to only to validate_full somewhere here: https://github.com/informalsystems/tendermint-rs/pull/358/files/b1aee8d1f4b42d56a5e43dda9fc52572455ff4ea#diff-1911c69336354ecbef5a4524721976faR236-R263

Copy link
Member

Choose a reason for hiding this comment

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

if we do #377, we can prob get rid of validate_full, especially since we're trying not to rely on the underlying validator_address. though I suppose so long as it is there it should be checked.

@liamsi liamsi merged commit 3988e6b into master Jun 23, 2020
@liamsi liamsi deleted the romain/move-validate branch June 23, 2020 21:01
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.

Extract tendermint::lite_impl::SignedHeader::validate into CommitValidator
3 participants