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

feat: define HashMap of hint groups along with hint strings #1943

Merged

Conversation

dorimedini-starkware
Copy link
Collaborator

Define a HashMap of hint groups along with hint strings

Description

In the starkware sequencer, it will be useful to have access to a complete list of hint strings implemented in the VM.
The current situation is: each hint string is defined as a separate const, with no container aggregating all of them.

This PR introduces a macro to define + collect hint constants - should be no change except additional lazy_static HashMaps of hint strings (hint name => hint string).

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.

@dorimedini-starkware
Copy link
Collaborator Author

Note: to refactor hint_codes.rs, I did the following:

  1. Turned off auto-formatting in my editor
  2. find: pub const ([A-Z_0-9a-z]+): &str = ?\n? *(r#)?"(([^;]|\n)*)"#?;\n\n?
  3. replace: ($1, indoc! {r#"$3"#}),\n
  4. Fox consts X: &str = Y annotated with #[cfg(feature = "test_utils")], I changed the (X, indoc! {Y}) to be (X, indoc! {Y}, "test_utils").
  5. the cairo0_hints module got the same treatment, except I had to move all the (X, indoc! {Y}) pairs to the top

@dorimedini-starkware dorimedini-starkware force-pushed the dori/hint-strings-in-set branch 2 times, most recently from b251c39 to 064b00f Compare February 11, 2025 12:25
@dorimedini-starkware dorimedini-starkware force-pushed the dori/hint-strings-in-set branch 8 times, most recently from 45d4c7c to b993877 Compare February 12, 2025 16:17
@gabrielbosio gabrielbosio added this pull request to the merge queue Feb 13, 2025
Merged via the queue into lambdaclass:main with commit 526285c Feb 13, 2025
181 of 184 checks passed
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.

3 participants