Skip to content

Commit

Permalink
fix unwraps
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancoGiachetta committed Nov 15, 2024
1 parent 13e00ff commit 18d061c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions vm/src/hint_processor/cairo_1_hint_processor/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ fn find_inverse(value: BigUint, modulus: &BigUint) -> Result<(bool, BigUint), Hi
.ok_or(HintError::BigUintToBigIntFail)?
.extended_gcd(&modulus.to_bigint().ok_or(HintError::BigUintToBigIntFail)?);

let gcd = ex_gcd.gcd.to_biguint().unwrap();
let gcd = ex_gcd
.gcd
.to_biguint()
.ok_or(HintError::BigIntToBigUintFail)?;
if gcd.is_one() {
return Ok((true, get_modulus(&ex_gcd.x, modulus)));
}
Expand Down Expand Up @@ -145,7 +148,10 @@ fn compute_gates(
n_mul_mods: usize,
modulus_ptr: Relocatable,
) -> Result<usize, HintError> {
let modulus = read_circuit_value(vm, modulus_ptr)?.unwrap();
let modulus = read_circuit_value(vm, modulus_ptr)?.ok_or(HintError::Memory(
MemoryError::ExpectedInteger(Box::from(modulus_ptr)),
))?;

let mut circuit = Circuit {
vm,
values_ptr,
Expand Down

0 comments on commit 18d061c

Please sign in to comment.