cairo-vm
cairo-vm copied to clipboard
enable the use of the VM with other prime numbers
Why
Currently, the cairo vm has a hard-coded reference to the current starknet prime number
pub fn prime(&self) -> &str {
_ = self;
PRIME_STR
}
which means that the prime from the program's compilation is not used and this particular prime is enforced. This is becoming a strong limitation with the upcoming Stwo prover using M31 as a base field.
What
Use the prime number as given in the compiled program instead of this hard coded one.
How
The current prime value is hardcoded in various different places (see https://github.com/search?q=repo:lambdaclass/cairo-vm%20prime&type=code). I'm also not sure about the implication at the core crypto level (lib used, possibility to use native u32 for storing values).