Skip to content

added const support for EcPoint type#1588

Merged
TomerStarkware merged 1 commit intomainfrom
tomer/add_const_ecpoint
Mar 30, 2026
Merged

added const support for EcPoint type#1588
TomerStarkware merged 1 commit intomainfrom
tomer/add_const_ecpoint

Conversation

@TomerStarkware
Copy link
Copy Markdown
Collaborator

@TomerStarkware TomerStarkware commented Mar 30, 2026

added const support for EcPoint type

added const support for EcPoint type

Introduces Breaking Changes?

No


This change is Reviewable

@TomerStarkware TomerStarkware requested a review from orizi March 30, 2026 12:43
@TomerStarkware TomerStarkware force-pushed the tomer/add_const_ecpoint branch from 16f87d1 to d199605 Compare March 30, 2026 12:46
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

Benchmarking results

Benchmark for program dict_insert

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 11.532 ± 0.032 11.498 11.581 5.53 ± 0.08
cairo-native (embedded AOT) 2.084 ± 0.028 2.051 2.122 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.150 ± 0.023 2.122 2.201 1.03 ± 0.02

Benchmark for program dict_snapshot

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 565.6 ± 13.3 551.4 587.4 1.00
cairo-native (embedded AOT) 1787.3 ± 22.0 1751.2 1816.2 3.16 ± 0.08
cairo-native (embedded JIT using LLVM's ORC Engine) 1873.2 ± 24.2 1838.8 1917.8 3.31 ± 0.09

Benchmark for program factorial_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.986 ± 0.042 4.947 5.095 2.24 ± 0.05
cairo-native (embedded AOT) 2.223 ± 0.044 2.156 2.290 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 2.278 ± 0.054 2.213 2.372 1.02 ± 0.03

Benchmark for program fib_2M

Open benchmarks
Command Mean [s] Min [s] Max [s] Relative
Cairo-vm (Rust, Cairo 1) 4.881 ± 0.026 4.855 4.942 2.81 ± 0.03
cairo-native (embedded AOT) 1.739 ± 0.015 1.708 1.760 1.00
cairo-native (embedded JIT using LLVM's ORC Engine) 1.810 ± 0.029 1.764 1.845 1.04 ± 0.02

Benchmark for program linear_search

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 603.3 ± 16.6 588.9 648.1 1.00
cairo-native (embedded AOT) 1776.9 ± 30.8 1729.4 1815.3 2.95 ± 0.10
cairo-native (embedded JIT using LLVM's ORC Engine) 1906.7 ± 33.4 1880.6 1977.9 3.16 ± 0.10

Benchmark for program logistic_map

Open benchmarks
Command Mean [ms] Min [ms] Max [ms] Relative
Cairo-vm (Rust, Cairo 1) 515.6 ± 9.0 498.5 531.6 1.00
cairo-native (embedded AOT) 1919.1 ± 26.4 1889.8 1964.0 3.72 ± 0.08
cairo-native (embedded JIT using LLVM's ORC Engine) 2082.0 ± 12.7 2059.6 2099.6 4.04 ± 0.07

Copy link
Copy Markdown
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orizi made 1 comment.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on TomerStarkware).


a discussion (no related file):
fix PR description.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 30, 2026

Benchmark results Main vs HEAD.

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_insert.cairo (JIT) 2.235 ± 0.057 2.161 2.320 1.04 ± 0.03
base dict_insert.cairo (AOT) 2.147 ± 0.042 2.083 2.209 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_insert.cairo (JIT) 2.067 ± 0.018 2.042 2.096 1.04 ± 0.02
head dict_insert.cairo (AOT) 1.979 ± 0.023 1.950 2.023 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base dict_snapshot.cairo (JIT) 1.883 ± 0.042 1.842 1.982 1.07 ± 0.04
base dict_snapshot.cairo (AOT) 1.763 ± 0.046 1.696 1.843 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head dict_snapshot.cairo (JIT) 1.778 ± 0.016 1.758 1.812 1.07 ± 0.01
head dict_snapshot.cairo (AOT) 1.662 ± 0.018 1.638 1.690 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base factorial_2M.cairo (JIT) 2.310 ± 0.030 2.258 2.368 1.05 ± 0.02
base factorial_2M.cairo (AOT) 2.210 ± 0.031 2.164 2.258 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head factorial_2M.cairo (JIT) 2.199 ± 0.033 2.166 2.271 1.03 ± 0.02
head factorial_2M.cairo (AOT) 2.132 ± 0.018 2.110 2.171 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base fib_2M.cairo (JIT) 1.789 ± 0.024 1.744 1.835 1.01 ± 0.03
base fib_2M.cairo (AOT) 1.774 ± 0.048 1.708 1.861 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head fib_2M.cairo (JIT) 1.735 ± 0.012 1.721 1.757 1.04 ± 0.01
head fib_2M.cairo (AOT) 1.672 ± 0.011 1.660 1.690 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base linear_search.cairo (JIT) 1.923 ± 0.027 1.880 1.966 1.06 ± 0.03
base linear_search.cairo (AOT) 1.816 ± 0.046 1.751 1.880 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head linear_search.cairo (JIT) 1.847 ± 0.017 1.820 1.874 1.07 ± 0.01
head linear_search.cairo (AOT) 1.719 ± 0.009 1.706 1.734 1.00

Base

Command Mean [s] Min [s] Max [s] Relative
base logistic_map.cairo (JIT) 2.176 ± 0.061 2.093 2.274 1.13 ± 0.05
base logistic_map.cairo (AOT) 1.922 ± 0.059 1.827 2.015 1.00

Head

Command Mean [s] Min [s] Max [s] Relative
head logistic_map.cairo (JIT) 2.008 ± 0.016 1.986 2.030 1.10 ± 0.01
head logistic_map.cairo (AOT) 1.828 ± 0.014 1.803 1.854 1.00

Copy link
Copy Markdown
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orizi reviewed 3 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on TomerStarkware).


src/libfuncs/const.rs line 297 at r1 (raw file):

                        _ => val,
                    };
                    entry.const_int(context, location, val, 252)?

this feels like something that happens a lot of times in this project.

Code quote:

                    let (sign, val) = x.clone().into_parts();
                    let val = match sign {
                        Sign::Minus => PRIME.clone() - val,
                        _ => val,
                    };
                    entry.const_int(context, location, val, 252)?

@TomerStarkware TomerStarkware force-pushed the tomer/add_const_ecpoint branch from d199605 to c1e64c1 Compare March 30, 2026 14:22
Copy link
Copy Markdown
Collaborator Author

@TomerStarkware TomerStarkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomerStarkware made 2 comments.
Reviewable status: 2 of 6 files reviewed, 2 unresolved discussions (waiting on orizi).


a discussion (no related file):

Previously, orizi wrote…

fix PR description.

Done.


src/libfuncs/const.rs line 297 at r1 (raw file):

Previously, orizi wrote…

this feels like something that happens a lot of times in this project.

Done.

Copy link
Copy Markdown
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orizi reviewed 4 files and all commit messages, made 1 comment, and resolved 1 discussion.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on TomerStarkware).


src/utils.rs line 244 at r2 (raw file):

pub fn felt252_str(value: &str) -> Felt {
    let value = value

Suggestion:

}

/// Normalize a signed BigInt felt value to its unsigned field representation.
///
/// Negative values are mapped to `PRIME - |value|`.
pub fn felt_to_unsigned(value: &BigInt) -> BigUint {
    match value.sign() {
        Sign::Minus => &*PRIME - value.magnitude(),
        _ => value.magnitude().clone(),
    }
}

/// Parse a numeric string into felt, wrapping negatives around the prime modulo.
pub fn felt252_str(value: &str) -> Felt {
    let value = value

@TomerStarkware TomerStarkware force-pushed the tomer/add_const_ecpoint branch from c1e64c1 to cb9bcfb Compare March 30, 2026 16:29
Copy link
Copy Markdown
Collaborator Author

@TomerStarkware TomerStarkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TomerStarkware made 1 comment.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on orizi).


src/utils.rs line 244 at r2 (raw file):

pub fn felt252_str(value: &str) -> Felt {
    let value = value

Done.

Copy link
Copy Markdown
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@orizi reviewed 1 file and all commit messages, made 1 comment, and resolved 2 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on TomerStarkware).

@TomerStarkware TomerStarkware added this pull request to the merge queue Mar 30, 2026
Merged via the queue into main with commit 645b5c7 Mar 30, 2026
17 checks passed
@TomerStarkware TomerStarkware deleted the tomer/add_const_ecpoint branch March 30, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants