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: implement dict hints primitives #106

Merged
merged 78 commits into from
Aug 1, 2024
Merged

Conversation

zmalatrax
Copy link
Collaborator

@zmalatrax zmalatrax commented Jul 17, 2024

Closes #102, closes #103, closes #104, closes #105, closes #107, closes #108, closes #109, closes #110, closes #111, closes #112, closes #113, closes #114, closes #115, closes #116, closes #117, closes #118

To execute and implement hints related to dictionnaries, a few things must be implemented first:

  • ScopeManager, to access variables across different hints (used in AssertLeFindSmallArc, AssertLeIsFirstArcExcluded and AssertLeIsSecondArcExcluded).
  • DictManager a map of dictionnaries, where allocated dictionnaries are stored during execution
  • SquashedDictManager, handles the squashing of the dictionnaries, needed to end the run and generate correct traces.

Once done, dictionnaries can be handled.

Implemented hint Usage
AllocFelt252Dict Dictionnary initialization
Felt252DictEntryInit Dictionnary usage (methods from dict.cairo)
Felt252DictEntryUpdate Dictionnary usage (methods from dict.cairo)
GetSegmentArenaIndex Dictionnary finalization
InitSquashData Dictionnary finalization
GetCurrentAccessIndex Dictionnary finalization
ShouldSkipSquashLoop Dictionnary finalization
GetCurrentAccessDelta Dictionnary finalization
ShouldContinueSquashLoop Dictionnary finalization
GetNextDictKey Dictionnary finalization
AssertLeFindSmallArcs Dictionnary finalization
AssertLeIsFirstArcExcluded Dictionnary finalization
AssertLeIsSecondArcExcluded Dictionnary finalization

@zmalatrax zmalatrax force-pushed the feat/implement-dict-hint-base branch from 6c2cd53 to 7c5a04d Compare July 30, 2024 08:28
Copy link
Contributor

@enitrat enitrat left a comment

Choose a reason for hiding this comment

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

Considering that this implementation is the "front-door" to the CairoVM, I would double-down on explicit and well-formed JSDoc for every functions

src/errors/squashedDictManager.ts Outdated Show resolved Hide resolved
src/errors/squashedDictManager.ts Outdated Show resolved Hide resolved
src/errors/virtualMachine.ts Outdated Show resolved Hide resolved
src/hints/dict/allocFelt252Dict.ts Outdated Show resolved Hide resolved
src/hints/dict/felt252DictEntryInit.ts Show resolved Hide resolved
src/hints/dict/initSquashData.ts Outdated Show resolved Hide resolved
src/hints/dict/getCurrentAccessDelta.ts Outdated Show resolved Hide resolved
src/hints/dict/felt252DictEntryUpdate.ts Outdated Show resolved Hide resolved
src/hints/dict/felt252DictEntryUpdate.ts Outdated Show resolved Hide resolved
src/hints/dict/felt252DictEntryInit.ts Outdated Show resolved Hide resolved
@zmalatrax zmalatrax force-pushed the feat/implement-dict-hint-base branch from 35ab62f to c489739 Compare July 30, 2024 15:27
@enitrat enitrat merged commit 58fd07d into main Aug 1, 2024
3 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
3 participants