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

light-client-verifier: 🌱 restore verify_commit() interface #1423

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
- `[tendermint-light-client-verifier]` Restores the commit verification interfaces of `PredicateVerifier<P, C, V>` from `<= 0.35.0`.
* `verify_commit(&self. untrusted: &UntrustedBlockState<'_>)` is restored, as in <= 0.35.0.
* `verify_commit(&self, untrusted: &UntrustedBlockState<'_>, trusted: &TrustedBlockState<'_>,)` introduced in 0.36.0 is renamed to `verify_commit_against_trusted`.
The performance improvements made in the `0.36.0` release are still intact.
([\#1423](https://github.com/informalsystems/tendermint-rs/pull/1423))
20 changes: 17 additions & 3 deletions light-client-verifier/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,24 @@ where
Verdict::Success
}

/// Verify that more than 2/3 of the validators correctly committed the block.
///
/// Use [`PredicateVerifier::verify_commit_against_trusted()`] to also verify that there is
/// enough overlap between validator sets.
pub fn verify_commit(&self, untrusted: &UntrustedBlockState<'_>) -> Verdict {
verdict!(self.predicates.has_sufficient_signers_overlap(
untrusted.signed_header,
untrusted.validators,
&self.voting_power_calculator,
));

Verdict::Success
}

/// Verify that a) there is enough overlap between the validator sets of the
/// trusted and untrusted blocks and b) more than 2/3 of the validators
/// correctly committed the block.
pub fn verify_commit(
pub fn verify_commit_against_trusted(
&self,
untrusted: &UntrustedBlockState<'_>,
trusted: &TrustedBlockState<'_>,
Expand Down Expand Up @@ -288,7 +302,7 @@ where
ensure_verdict_success!(self.verify_validator_sets(&untrusted));
ensure_verdict_success!(self.validate_against_trusted(&untrusted, &trusted, options, now));
ensure_verdict_success!(self.check_header_is_from_past(&untrusted, options, now));
ensure_verdict_success!(self.verify_commit(&untrusted, &trusted, options));
ensure_verdict_success!(self.verify_commit_against_trusted(&untrusted, &trusted, options));

Verdict::Success
}
Expand All @@ -305,7 +319,7 @@ where
) -> Verdict {
ensure_verdict_success!(self.verify_validator_sets(&untrusted));
ensure_verdict_success!(self.validate_against_trusted(&untrusted, &trusted, options, now));
ensure_verdict_success!(self.verify_commit(&untrusted, &trusted, options));
ensure_verdict_success!(self.verify_commit_against_trusted(&untrusted, &trusted, options));
Verdict::Success
}
}
Expand Down
Loading