Skip to content

Commit

Permalink
Cast type when using as_b256
Browse files Browse the repository at this point in the history
  • Loading branch information
danhper committed Aug 12, 2024
1 parent a882888 commit 36a9ca3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/interpreter/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,9 +458,9 @@ impl Value {
}

pub fn as_b256(&self) -> Result<B256> {
match self {
Value::FixBytes(n, 32) => Ok(*n),
_ => bail!("cannot convert {} to b256", self.get_type()),
match Type::FixBytes(32).cast(self) {
Ok(Value::FixBytes(n, 32)) => Ok(n),
_ => bail!("cannot convert {} to bytes32", self.get_type()),
}
}

Expand Down

0 comments on commit 36a9ca3

Please sign in to comment.