Closed raphaelDkhn closed 9 months ago
Hi @raphaelDkhn !
Can you leave here the .cairo program and the code where you are executing the cairo_runner.run_from_entrypoint
, so we can replicate it?
I finally got it to work by passing the struct as a serialized array:
fn main() {
let program_bytes = include_bytes!("../example/target/dev/example.casm.json");
let program = serde_json::from_slice::<CasmContractClass>(program_bytes).unwrap();
let program_builtins = get_casm_contract_builtins(&program, 0);
let calldata: Vec<MaybeRelocatable> = vec![
MaybeRelocatable::from(2),
MaybeRelocatable::from(2),
MaybeRelocatable::from(2),
MaybeRelocatable::from(4),
MaybeRelocatable::from(1),
MaybeRelocatable::from(2),
MaybeRelocatable::from(3),
MaybeRelocatable::from(4),
];
let _ret = run_cairo_1_entrypoint(&program, &program_builtins, 0, &calldata);
}
Great @raphaelDkhn ! So, we can help you with something more?
I think, all good! We can close the issue. Thank you!
Thank you @raphaelDkhn !! Any other issue you encounter please ask us, happy to help
I'm working with CairoVM to execute Cairo programs including arguments. However, I'm facing challenges when these arguments are complex data structures.
The program I aim to run using CairoVM is as follows:
The challenge arises with the argument, which is a struct in this case. I'm struggling to properly construct this struct argument to pass it to
cairo_runner.run_from_entrypoint
.As a temporary workaround, I thought to serialize the struct and passing the array of felt into the function instead. However, I'm seeking a more efficient or appropriate method for handling this. Any suggestions or guidance would be greatly appreciated.