cairo-vm-go
                                
                                
                                
                                    cairo-vm-go copied to clipboard
                            
                            
                            
                        Add Cairo Zero Hints
Cairo Zero Hints
The following is a (big!) list of hints required by Cairo Zero. They might be an overlap between Cairo Zero hints and Cairo One hints #36 .
The list was extracted from sister VM in Go by LambdaClass where they gathered all Pythonic hints.
:eyes: For specific instructions on how to implement these hints you can check out the readme file in the zero package
Uint256 Operations
- [x] #187
 - [x] #219
 - [x] #221
 - [x] #223
 - [x] #224
 - [x] #226
 - [x] #227
 
Math Operations
- [x] IsNn: Checks if a value is non-negative within a specific range.
 - [x] IsNnOutOfRange: Checks if the negation of a value (minus one) is non-negative within a specific range.
 - [x] IsLeFelt: Determines if one value is less than or equal to another within a finite field.
 - [x] AssertLtFelt: Asserts that one value is strictly less than another within a finite field.
 - [x] #238
 - [x] IsPositive: Checks if a value is positive within a specific range and prime context.
 - [x] #239
 - [x] SplitInt: Splits an integer based on a base and asserts the result is within a certain range.
 - [x] SplitIntAssertRange: Asserts that the value for 
SplitIntis within the expected range. - [x] AssertNotZero: Asserts that a value is not zero.
 - [x] AssertNn: Asserts that a given integer is non-negative within a specified range.
 - [x] AssertNotEqual: Asserts that two given values are not equal.
 - [x] Assert250Bits: Asserts that a value is within the range of 250 bits.
 - [x] AssertLeFelt: Asserts that one value is less than or equal to another within a finite field.
 - [x] AssertLeFeltExcluded0: Custom assertion related to 
AssertLeFelt. - [x] AssertLeFeltExcluded1: Another custom assertion related to 
AssertLeFelt. - [x] AssertLeFeltExcluded2: Final custom assertion related to 
AssertLeFelt. - [x] #240
 - [x] #241
 - [x] #242
 - [ ] #243
 
Usort
- [x] #244
 - [x] #232
 - [x] #233
 - [x] #234
 - [x] #235
 
Other
- [ ] #246
 - [x] #247
 - [x] #248
 - [x] #249
 - [x] #250
 - [x] #251
 - [ ] #252
 - [ ] #253
 
Elliptic Curve Operations
- [x] #254
 - [x] #256
 - [x] #257
 - [x] #258
 - [x] #386
 - [x] #265
 - [x] #267
 - [x] #270
 
Signatures (ECDSA & SEC_P)
- [x] #271
 - [x] #273
 - [x] #274
 - [x] #275
 - [x] #276
 - [x] #277
 - [x] #278
 
Blake Hash
- [ ] #279
 - [x] #312
 - [x] #281
 - [ ] #280
 
Keccak
- [ ] #286
 - [ ] #287
 - [ ] #282
 - [ ] #283
 - [x] #285
 
Dictionaries
- [x] #294
 - [x] #289
 - [ ] #290
 - [ ] #291
 - [ ] #295
 - [x] #297
 - [ ] #296
 - [ ] #298
 - [x] #299
 - [x] #302
 - [x] #300
 - [x] #301
 - [x] #303
 - [ ] #292
 - [ ] #293
 - [ ] #288
 
To implement the hints in this issue you'll need to follow the next steps:
- Add the string that is the code of the hint in the hintcode file. The code of the hint is always the same string and can be found in the lambdaclass vm or if you look for it in the python vm
 - Then add your hint in the switch-case in the 
GetHintFromCodemethod in zerohint file. You'll need to implement a method for your hint there calledCreate<HintName>Hinter - The method 
Create<HintName>Hintershould check the parameters are correct and should return the correspondingHinterstructure. If the hint is already implemented, as is the case forAllocSegment, you don't need to do anything else, just return it - If the hint hasn't been implemented, you'll need to add it in the corresponding file in the zero package of the hintrunner, and add unit tests for it.
 
⚠️ The description has been updated with a link to the readme inside the hintunner/zero package with more detailed instructions on how to implement new Cairo 0 hints