openvm_algebra_moduli_setup

Macro moduli_declare

Source
moduli_declare!() { /* proc-macro */ }
Expand description

This macro generates the code to setup the modulus for a given prime. Also it places the moduli into a special static variable to be later extracted from the ELF and used by the VM. Usage:

moduli_declare! {
    Bls12381 { modulus = "0x1a0111ea397fe69a4b1ba7b6434bacd764774b84f38512bf6730d2a0f6b0f6241eabfffeb153ffffb9feffffffffaaab" },
    Bn254 { modulus = "21888242871839275222246405745257275088696311157297823662689037894645226208583" },
}

This creates two structs, Bls12381 and Bn254, each representing the modular arithmetic class (implementing Add, Sub and so on).