Closed zmalatrax closed 4 months ago
This PR aimed at implementing the Cairo Zero hints with their current format, which forces us to "compile" the hints (parse of references, apply ap tracking and a few other things) that we believe should not be part of the VM.
Therefore, until we have a way to pre-process the current compilation artifacts and provide artifacts which abstract this hint compilation from the VM, I'm closing this PR
To implement hints, a few things are needed:
A way to read variable used in hints (
ids.name
), managed by theIdsManager
class. This class relies on theReferences
parsed from theReferenceManager
and theIdentifiers
, given in the compilation artifacts.Some hints use constants (or aliases to constants), fetched from the compilation artifact by the
extractConstants
method. (e.g. BigStruct using SquashedDict that are not implemented yet)When instantiating the CairoRunner, the constants are extracted and the hints are transformed into an exploitable format to be stored as VirtualMachine attributes.
Some hints are using data from other hints, the ScopeManager is a stack of dictionaries (scopes) which allows sharing data across hints.
There still needs to add JSDoc and a few util methods might be implemented later on if a group of hints needs it. At the moment it works but it might not be following our coding guidelines, parts might/should be refactored