Skip to content

fix: Add boundary tests for SecpSplitOutOfRange in secp_utils #2062

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

Merged
merged 11 commits into from
Apr 29, 2025

Conversation

VolodymyrBg
Copy link
Contributor

Description

Implemented the TODO in secp_utils.rs by adding proper boundary tests for the
bigint3_split function. Tests now verify that values up to BASE³-1 work correctly,
while BASE³ and above properly trigger SecpSplitOutOfRange errors. This provides
complete test coverage for the function's range validation.

Checklist

  • Linked to Github Issue
  • Unit tests added
  • Integration tests added.
  • This change requires new documentation.
    • Documentation has been added/updated.
    • CHANGELOG has been updated.

@JulianGCalderon JulianGCalderon added the tests Implementation of tests label Apr 14, 2025
@JulianGCalderon
Copy link
Contributor

JulianGCalderon commented Apr 14, 2025

Hi @VolodymyrBg, thanks for the contribution! Could you fix the CI lints?

@VolodymyrBg
Copy link
Contributor Author

Hi @VolodymyrBg, thanks for the contribution! Could you fix the CI lints?

Done , but i'm still not sure with these tests
Benchmark Hyper Threading / benchmark (pull_request) Failing after 8m
Details

Hyperfine Benchmark / Run benchmarks for unmodified programs (pull_request) Failing after 16m
i ran locally and they passed

@JulianGCalderon
Copy link
Contributor

Hi @VolodymyrBg, thanks for the contribution! Could you fix the CI lints?

Done , but i'm still not sure with these tests Benchmark Hyper Threading / benchmark (pull_request) Failing after 8m Details

Hyperfine Benchmark / Run benchmarks for unmodified programs (pull_request) Failing after 16m i ran locally and they passed

Don't worry about those jobs, they always fail for external contributors.

@VolodymyrBg
Copy link
Contributor Author

@JulianGCalderon Is this PR actual, or should I close it?

@JulianGCalderon
Copy link
Contributor

Hey @VolodymyrBg. We would like to keep only the changes in the test. Could you remove the optimization?

We don't have any benchmark to support that optimization, and given that we don't know how much it will improve, we prefer not to add complexity to the function.

@VolodymyrBg
Copy link
Contributor Author

Hey @VolodymyrBg. We would like to keep only the changes in the test. Could you remove the optimization?

We don't have any benchmark to support that optimization, and given that we don't know how much it will improve, we prefer not to add complexity to the function.

Done

@JulianGCalderon
Copy link
Contributor

Thanks @VolodymyrBg, could you also restore the changelog?

@JulianGCalderon
Copy link
Contributor

Hey @VolodymyrBg, sorry for the confusion. What I meant is for you to remove the changelog entry entirely. We don't modify the changelog on test-only changes.

@VolodymyrBg
Copy link
Contributor Author

Hey @VolodymyrBg, sorry for the confusion. What I meant is for you to remove the changelog entry entirely. We don't modify the changelog on test-only changes.

Sorry for misunderstanding

Copy link
Contributor

@JulianGCalderon JulianGCalderon left a comment

Choose a reason for hiding this comment

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

LGTM

@gabrielbosio gabrielbosio added this pull request to the merge queue Apr 29, 2025
Merged via the queue into lambdaclass:main with commit 3b36cd9 Apr 29, 2025
181 of 185 checks passed
enitrat pushed a commit to kkrt-labs/cairo-vm that referenced this pull request May 6, 2025
…class#2062)

* fix: Add boundary tests for SecpSplitOutOfRange in secp_utils

* Update secp_utils.rs

* Update CHANGELOG.md

* Update secp_utils.rs

* remove optimizations

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* empty commit to fix CI

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>
Stavbe pushed a commit that referenced this pull request May 14, 2025
* fix: Add boundary tests for SecpSplitOutOfRange in secp_utils

* Update secp_utils.rs

* Update CHANGELOG.md

* Update secp_utils.rs

* remove optimizations

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* empty commit to fix CI

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>
gabrielbosio pushed a commit that referenced this pull request May 21, 2025
* fix: Add boundary tests for SecpSplitOutOfRange in secp_utils

* Update secp_utils.rs

* Update CHANGELOG.md

* Update secp_utils.rs

* remove optimizations

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* empty commit to fix CI

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>
gabrielbosio added a commit that referenced this pull request Jun 4, 2025
* Remove duplicated `get_val` (#2065)

* avoid installing gmp if it is already installed

* revert part of the last commit

* changelog

* remove unwanted file

* CI: Make cache keys depend on Cairo version (#2056)

* Add Makefile and requirements.txt to cache key

* Don't fetch cairo stwo exclusive programs

* Remove empty file

* Restrict caching Cairo programs

Revert how the Rust workflow uses the Cairo program paths to
calculate the cache keys.
This change would imply the branch only adds Makefile and
requirements.txt to the cache key computation.

---------

Co-authored-by: gabrielbosio <[email protected]>
Co-authored-by: Gabriel Bosio <[email protected]>

* dev: make Memory::get `pub` (#2039)

* dev: make Memory::get `pub`

* edit changelog

* dev: expose get_maybe_relocatable instead

* add comment on borrowed variant

* add tests

* feat(breaking): add support for hint accessible scopes (#2042)

* feat: add support for hint accessible scopes

update changelog

* Update vm/src/hint_processor/hint_processor_definition.rs

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* feat: add support for alias identifiers destination in program serde (#2071)

* feat: add support for aliases destination in program serde

* add changelog

---------

Co-authored-by: Julián González Calderón <[email protected]>

* fix: Add boundary tests for SecpSplitOutOfRange in secp_utils (#2062)

* fix: Add boundary tests for SecpSplitOutOfRange in secp_utils

* Update secp_utils.rs

* Update CHANGELOG.md

* Update secp_utils.rs

* remove optimizations

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md

* empty commit to fix CI

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* docs: add --run_from_cairo_pie documentation for Cairo 0 and Cairo 1 (#2077)

* docs: add --run_from_cairo_pie flag usage documentation for Cairo 0

* docs: add --run_from_cairo_pie flag usage documentation for Cairo 1

* Update README.md

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* Update README.md

* Update README.md

* Update README.md

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

* Update README.md

Co-authored-by: Gabriel Bosio <[email protected]>

* Update README.md

Co-authored-by: Julian Gonzalez Calderon <[email protected]>

---------

Co-authored-by: Julian Gonzalez Calderon <[email protected]>
Co-authored-by: Gabriel Bosio <[email protected]>

* Fix WRITE_DIVMOD_SEGMENT hint (#2078)

* Minor fixes - use CAIRO_PRIME

* Add error handling

* Update CHANGELOG.md

* Bump cairo-lang to 0.13.5 (#1959)

* Update cairo-lang versin

* Update changelog

* Add new hints

* Specify prime in new hints

* Only apply mod floor if prime is not CAIRO_PRIME

* Properly implement pack for a different prime

* Fix pack in compute_doubling_slope

* Add negative_points.cairo test

* Add try_get_point_from_x for negative points

* Add double_x test for negative points

* Allow to many arguments

* Add codecov to cairo-0-secp-hints feature

* Prepare for Release v3.0.0-rc.1 (#2092)

* Update version

* Update lock

* Update toolchain

* Update changelog

* Fix clippy

* Update toolchain in CI

* fix: correct cache keys for no-std test coverage in CI (#2093)

* Update rust.yml

* Update rust.yml

* Update rust toolchain to 1.87.0 (#2100)

* update rust toolchain to 1.87.0

* remove uneeded file

* update rust in workflows

* update changelog

* clippy

* clippy

* remove unneeded clippy allow

* fix Changelog link (#2104)

* Improve memory_segments coverage (#2110)

* Add tests for .gen_arg() and .write_arg()

* Add test for .is_valid_memory_value()

* Assert contents of memory segments

---------

Co-authored-by: Franco Giachetta <[email protected]>
Co-authored-by: Julian Gonzalez Calderon <[email protected]>
Co-authored-by: Mathieu <[email protected]>
Co-authored-by: VolodymyrBg <[email protected]>
Co-authored-by: GarmashAlex <[email protected]>
Co-authored-by: crStiv <[email protected]>
Co-authored-by: DiegoC <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Implementation of tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants