Skip to content

Commit

Permalink
fix(rust): Enforce that spec.InnerSpec.ChildSize is >= 1 (#339)
Browse files Browse the repository at this point in the history
* Enforce that the spec.InnerSpec.ChildSize is >= 1

* Add changelog entry

---------

Co-authored-by: Romain Ruetschi <romain@informal.systems>
  • Loading branch information
zbuc and romac authored Jul 17, 2024
1 parent 333d554 commit d124546
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
# Changelog

# Unreleased

## Rust

- fix(rust): Enforce that `spec.InnerSpec.ChildSize` is >= 1 ([#339](https://github.com/cosmos/ics23/pull/339))

# 0.11.1

## Rust
Expand Down
4 changes: 4 additions & 0 deletions rust/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@ fn ensure_inner(inner: &ics23::InnerOp, spec: &ics23::ProofSpec) -> Result<()> {
"Inner prefix too long: {}",
inner.prefix.len(),
);
ensure!(
inner_spec.child_size > 0,
"spec.InnerSpec.ChildSize must be >= 1"
);
ensure!(
inner.suffix.len() % (inner_spec.child_size as usize) == 0,
"InnerOp suffix malformed"
Expand Down

0 comments on commit d124546

Please sign in to comment.