Skip to main content

handle_falcon_div

Function handle_falcon_div 

Source
pub fn handle_falcon_div(
    process: &ProcessorState<'_>,
) -> Result<Vec<AdviceMutation>, EventError>
Expand description

FALCON_DIV system event handler.

Pushes the result of divison (both the quotient and the remainder) of a u64 by the Falcon prime (M = 12289) onto the advice stack.

Inputs: Operand stack: [event_id, a1, a0, …] Advice stack: […]

Outputs: Advice stack: [q1, q0, r, …]

where (a0, a1) are the 32-bit limbs of the dividend (with a0 representing the 32 least significant bits and a1 representing the 32 most significant bits). Similarly, (q0, q1) represent the quotient and r the remainder.

§Errors

  • Returns an error if the divisor is ZERO.
  • Returns an error if either a0 or a1 is not a u32.