Skip to content

Commit

Permalink
Add assertion for non-zero trust-level in Tendermint client initializ…
Browse files Browse the repository at this point in the history
…ation (#1698)

* Add assertion for non-zero trust-level in Tendermint client initialization

* Add .changelog entry
  • Loading branch information
hu55a1n1 authored Dec 21, 2021
1 parent ce695e7 commit f0a8114
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add missing assertion for non-zero trust-level in Tendermint client initialization.
([#1697](https://github.com/informalsystems/ibc-rs/issues/1697))
8 changes: 8 additions & 0 deletions modules/src/clients/ics07_tendermint/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ impl ClientState {
));
}

// `TrustThreshold` is guaranteed to be in the range `[0, 1)`, but a `TrustThreshold::ZERO`
// value is invalid in this context
if trust_level == TrustThreshold::ZERO {
return Err(Error::validation(
"ClientState trust-level cannot be zero".to_string(),
));
}

// Disallow empty proof-specs
if proof_specs.is_empty() {
return Err(Error::validation(
Expand Down

0 comments on commit f0a8114

Please sign in to comment.