Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable the use of the VM with other prime numbers #1910

Open
ClementWalter opened this issue Jan 6, 2025 · 0 comments
Open

enable the use of the VM with other prime numbers #1910

ClementWalter opened this issue Jan 6, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@ClementWalter
Copy link

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).

@ClementWalter ClementWalter added the enhancement New feature or request label Jan 6, 2025
@ClementWalter ClementWalter changed the title enable the use the VM with other prime numbers enable the use of the VM with other prime numbers Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant