Closed zmalatrax closed 5 months ago
Actually the SegmentArena builtin has a different initialization than the other builtins (initial_stack()
having the same behaviour though).
Therefore, when this builtin will be implemented, we'll have to think how addSegment(builtin: ProxyHandler)
should be updated.
Every builtins implement the same method
initial_stack(self)
which returns the value to append to the stack during initialization: either the start address of the segment or nothing.The flags
self.included
is true if the builtin (its name) is inprogram.builtins
.self.included
is false when the builtins used by the program is a sub-set of the layout of the run, those builtins are not initialized.Therefore, there is no need to implement an
initialStack()
method as this behaviour is already handled inaddSegment
: we return the start address of the segment when we initialize it.However, there is the flag
allow_missing_builtins
(used in proof mode) which allows to run a program with builtins that are not included in the layout of the run. For those builtins, the value0
is appended to the stack and the segment is initialized. So, when we'll implement the proof mode, we might need to handle this case but for now, no need to change how the stack is created.Source from CairoVM Python: builtin runner initial_stack(), builtin initialization, stack creation, builtin factory, included flag value