mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-11 18:23:09 +00:00
Merge pull request #1119 from mir-protocol/jacqui/topos-protocol/stack_len_bounds_aux_error
Fix `generate_exception` (#1115 replacement)
This commit is contained in:
commit
dca50adfac
@ -699,7 +699,14 @@ pub(crate) fn generate_exception<F: Field>(
|
||||
return Err(ProgramError::GasLimitError);
|
||||
}
|
||||
|
||||
row.stack_len_bounds_aux = (row.stack_len + F::ONE).inverse();
|
||||
let disallowed_len = F::from_canonical_usize(MAX_USER_STACK_SIZE + 1);
|
||||
let diff = row.stack_len - disallowed_len;
|
||||
if let Some(inv) = diff.try_inverse() {
|
||||
row.stack_len_bounds_aux = inv;
|
||||
} else {
|
||||
// This is a stack overflow that should have been caught earlier.
|
||||
return Err(ProgramError::InterpreterError);
|
||||
}
|
||||
|
||||
row.general.exception_mut().exc_code_bits = [
|
||||
F::from_bool(exc_code & 1 != 0),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user