The output builtin has been implemented as a segment which only accepts Felt
A method getOutput() has been added to the CairoRunner class to return the Output builtin segment if the builtin is in use
To find the index of the Output segment, we rely on the fact that builtins are always initialized after the Program and Execution segments (rationale for the outputIdx + 2)
Layouts should enforce the builtins order, with output always being the first one. therefore we could simply return runner.vm.memory.segments[2] in getOutput.
However layout/builtin order is not enforced atm so programs which uses builtins in a different order, like % builtins bitwise output can run on our VM (whereas the cairo VM in python throws as the builtins are not ordered as expected).
This can be updated when implementing layouts.
Python implementation of the Output builtin implements a PublicMemoryPage dictionnary which seems to be only used in the starknetOS & bootloader. There is no need to implement such structure for now imo
Closes #65
Felt
getOutput()
has been added to theCairoRunner
class to return the Output builtin segment if the builtin is in useTo find the index of the Output segment, we rely on the fact that builtins are always initialized after the Program and Execution segments (rationale for the
outputIdx + 2
)Layouts should enforce the builtins order, with
output
always being the first one. therefore we could simply returnrunner.vm.memory.segments[2]
ingetOutput
. However layout/builtin order is not enforced atm so programs which uses builtins in a different order, like% builtins bitwise output
can run on our VM (whereas the cairo VM in python throws as the builtins are not ordered as expected). This can be updated when implementing layouts.Python implementation of the Output builtin implements a PublicMemoryPage dictionnary which seems to be only used in the starknetOS & bootloader. There is no need to implement such structure for now imo