open-dust / cairo-foundry

Foundry like framework for starknet contracts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Do not load program form file at every test (in cairo_run)

tdelabro opened this issue · comments

IO is expensive.
Each test file can contain multiple tests.
Right now we re-read the compiled file before running each test in cairo.rs:

let program = match Program::new(path, entrypoint)

What we can do instead is use cairo-rs deserialize_program_json once. And then use build our Program directly from this in-memory json + the entrypoint

What to do:

  • change cairo-rs deserialize_program implem by factorizing the second part of the function in another public method
  • call deserialize_program_json once then pass it to this new function each time we want to run new

I will take care of this issue :)