From d04cf6d5073e7c1939b480ad78710627cbc26d64 Mon Sep 17 00:00:00 2001 From: Xuyang Song Date: Sun, 1 Dec 2024 17:08:17 +0100 Subject: [PATCH 1/2] bump juvix-cairo-vm --- native/cairo_vm/Cargo.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/cairo_vm/Cargo.lock b/native/cairo_vm/Cargo.lock index e8d6bb5..b6764ef 100644 --- a/native/cairo_vm/Cargo.lock +++ b/native/cairo_vm/Cargo.lock @@ -595,7 +595,7 @@ dependencies = [ [[package]] name = "juvix-cairo-vm" version = "0.9.0" -source = "git+https://github.com/anoma/juvix-cairo-vm#56635ae19ab43d7fcb2f2fbef63a3d5c451f8be5" +source = "git+https://github.com/anoma/juvix-cairo-vm#e0c926825607b658d429f1096ec70b959096ee3f" dependencies = [ "ark-ff", "ark-std", From 192f9b51a868b9fb32499b0413fed79f6d866054 Mon Sep 17 00:00:00 2001 From: Xuyang Song Date: Sun, 1 Dec 2024 17:09:58 +0100 Subject: [PATCH 2/2] test invalid inputs for cairo_vm --- test/cairo_negative_test.exs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/cairo_negative_test.exs b/test/cairo_negative_test.exs index 6967190..661cccb 100644 --- a/test/cairo_negative_test.exs +++ b/test/cairo_negative_test.exs @@ -24,6 +24,19 @@ defmodule NegativeTest do assert error_message == "Invalid input JSON" end + test "cairo_vm_runner with missing entries" do + {:ok, program} = File.read("./juvix/cairo.json") + + invalid_input = """ + { + "y": 7 + } + """ + + assert {:error, "Runtime error: The cairo program execution failed"} = + Cairo.cairo_vm_runner(program, invalid_input) + end + test "cairo_vm_runner with runtime error in Cairo program" do program_with_error = ~S""" {"attributes":[],"builtins":["output","range_check","ec_op","poseidon"],"data":["0x4","0x48087ffd7fff8000","0x482a800080018000","0x48087ffb7fff8000","0x480880027fff8000","0x208b7fff7fff7ffe","0x4002800080007fff","0x4826800180008000","0x1","0x48107ffb7fff8000","0x48107ffb7fff8000","0x48107ffb7fff8000","0x10780017fff7fff","0x0"],"hints":{"8":[{"accessible_scopes":[],"code":"Input(y)","flow_tracking_data":{"ap_tracking":{"group":0,"offset":0},"reference_ids":{}}}],"9":[{"accessible_scopes":[],"code":"Input(x)","flow_tracking_data":{"ap_tracking":{"group":0,"offset":0},"reference_ids":{}}}]},"identifiers":{"__main__.__end__":{"pc":159,"type":"label"},"__main__.__start__":{"pc":0,"type":"label"},"__main__.main":{"decorators":[],"pc":0,"type":"function"}},"main_scope":"__main__","prime":"0x800000000000011000000000000000000000000000000000000000000000001","reference_manager":{"references":[]}}