Cairo 1/2 support from Programs without Gas related functions and builtins

Hello, I’m doing a proof of concept program to support running cairo 1/2 programs without the gas cost related built ins. The starting point is the cairo lang runner.

So far I have removed the call in the cairo lang runner to the create_entry_code() as it’s used here:

And I’m replacing it with one that works like the cairo 0 proof mode (Call rel 4, jmp rel 0 ). This is missing the update of the allocation pointer but in the case of programs without args and builtins it should behave just like the Cairo 0 version.

Since builtins shouldn’t be necessary for simpler programs, I’m also running the virtual machine with a plain layout, but I’m not sure in which cases Cairo 1/2 uses built ins.

Right now this approach seems to be working for programs without recursion, we are trying to find what’s the issue with these programs.

To summarize some specific questions:

  • How can I know if a program is using a built in ?
  • Is there something important that I should add from the entry code, when I don’t care about the gas costs?

If someone sees any issue with this approach, do tell.

For reference, these programs seem to be running fine:
[](https://Add with function)

These are having problems: