diff --git a/crates/blockifier/feature_contracts/cairo1/compiled/test_contract_entrypoint_a.sierra.json b/crates/blockifier/feature_contracts/cairo1/compiled/test_contract_entrypoint_a.sierra.json new file mode 100644 index 0000000000..1c4fcdf39f --- /dev/null +++ b/crates/blockifier/feature_contracts/cairo1/compiled/test_contract_entrypoint_a.sierra.json @@ -0,0 +1 @@ +{"sierra_program":["0x1","0x6","0x0","0x2","0x8","0x0","0xa7","0x59","0x18","0x52616e6765436865636b","0x800000000000000100000000000000000000000000000000","0x436f6e7374","0x800000000000000000000000000000000000000000000002","0x1","0x4","0x2","0x4661696c656420746f20646573657269616c697a6520706172616d202331","0x4661696c656420746f20646573657269616c697a6520706172616d202332","0x537472756374","0x800000000000000f00000000000000000000000000000001","0x0","0x2ee1e2b1b89f8c495f200e4956278a4d47395fe262f27b52e5865c9524c08c3","0x66656c74323532","0x800000000000000700000000000000000000000000000000","0x456e756d","0x800000000000000700000000000000000000000000000003","0x11c6d8087e00642489f92d2821ad6ebd6532ad1a3b6d12833da6d6810391511","0x3","0x4f7574206f6620676173","0x4172726179","0x800000000000000300000000000000000000000000000001","0x536e617073686f74","0x800000000000000700000000000000000000000000000001","0x7","0x800000000000000700000000000000000000000000000002","0x1baeba72e79e9db2587cf44fedb2f3700b2075a5e8e39a562584862c4b71f62","0x8","0x9","0xc","0x753332","0x49","0x53746f7261676541646472657373","0x53746f726167654261736541646472657373","0x4275696c74696e436f737473","0x53797374656d","0x16a4c8d7c05909052238a862d8cc3e7975bf05a07b3a69c6b28951083a6d672","0x800000000000000300000000000000000000000000000003","0x12","0x9931c641b913035ae674b400b61a51476d506bbe8bba2ff8a6272790aba9e6","0xa","0x13","0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473","0x426f78","0x4761734275696c74696e","0x34","0x7265766f6b655f61705f747261636b696e67","0x77697468647261775f676173","0x6272616e63685f616c69676e","0x7374727563745f6465636f6e737472756374","0x73746f72655f74656d70","0x61727261795f736e617073686f745f706f705f66726f6e74","0x64726f70","0x16","0x61727261795f6e6577","0x636f6e73745f61735f696d6d656469617465","0x15","0x61727261795f617070656e64","0x7374727563745f636f6e737472756374","0x656e756d5f696e6974","0x14","0x17","0x11","0x6765745f6275696c74696e5f636f737473","0x10","0x77697468647261775f6761735f616c6c","0x73746f726167655f626173655f616464726573735f636f6e7374","0x1275130f95dda36bcbb6e9d28796c1d7e10b6e9fd5ed083e0ede4b12f613528","0x73746f726167655f616464726573735f66726f6d5f62617365","0xd","0xb","0x647570","0xe","0x73746f726167655f77726974655f73797363616c6c","0x66656c743235325f616464","0x736e617073686f745f74616b65","0x6","0x656e61626c655f61705f747261636b696e67","0x756e626f78","0x72656e616d65","0x5","0x6a756d70","0x656e756d5f6d61746368","0x64697361626c655f61705f747261636b696e67","0x13e","0xffffffffffffffff","0x4d","0xf","0x40","0x19","0x1a","0x1b","0x1c","0x1d","0x36","0x1e","0x1f","0x20","0x21","0x22","0x23","0x24","0x25","0x26","0x27","0x28","0x29","0x2a","0x2b","0x2c","0x2d","0x2e","0x2f","0x30","0x31","0x32","0x33","0x35","0x37","0x38","0x91","0x70","0x84","0x130","0xad","0xb2","0x120","0xbc","0xc1","0x10f","0xd6","0xff","0xf4","0x39","0x3a","0x3b","0x3c","0x3d","0x3e","0x3f","0x41","0x42","0x43","0x44","0x45","0x46","0x47","0x48","0x4a","0x4b","0x4c","0x4e","0x4f","0x50","0x51","0x52","0x53","0x54","0x55","0x56","0x57","0x58","0x59","0x5a","0x5b","0x9f","0xb06","0x40313050605120c11100f0e0d0c0b0a090706050403080706050403020100","0x1f0c071e0504031d050d0c1a0a1c051b0c1a0a190518170605161514070605","0x280c2610190527050d0c260a250c0b0a02240f230f220f212007060504030f","0xc0505331d0505320c310c300c2f2e022d0605182c2b07060504032a052905","0x5053b0605053a060505333905053806050537360505351c05053506050534","0xc42410505330c403d0505333f0505333e05053305073d05073c2a05053b27","0x4c0c4b0c4a490505331e0505330605054847050538460505380c4544070543","0x5354d050538060505350c073d05073c2905053b1d05053b19050535190505","0x5053b0c52510505331c0505330c075105073c060505500605054f0c4e1d05","0x56050c0c0c550505053807050538130505350c545105055305075105073c13","0x60c1c0556051305130c0c56050c070c194d07575106075607050c07050c0c","0xc56051d054d0c0c56050c070c470539291d0756071c05510c060556050605","0x470c460556054605290c460556050c1d0c1e0556050c1c0c0c56052905190c","0x3f0556054105490c41055605495807460c580556050c1e0c49055605461e07","0x556053f053f0c070556050705410c510556055105580c060556050605060c","0x27052a0c270556050c270c0c560547054d0c0c56050c070c3f07510606053f","0x556050c390c0c56050c070c363907593d2a075607275106133d0c27055605","0x5a0756055a055a0c5b0556050c000c5a0556050c3e0c000556053e05360c3e","0x56052a05060c5c0556055c05290c0005560500055c0c5b0556055b055b0c5c","0x56050c1c0c0c56050c070c626160135f5e5d0756075c005b073d515d0c2a05","0x56505290c65055605645a075e0c5a0556055a05290c640556050c3e0c6305","0x5620c0c56056705610c68670756056605600c66055605656307470c650556","0x580c2a0556052a05060c6b0556056a05640c6a0556056905630c6905560568","0xc070c6b5e5d2a06056b0556056b053f0c5e0556055e05410c5d0556055d05","0x56d05490c6d055605626c07460c6c0556050c1e0c0c56055a05650c0c5605","0x6e053f0c610556056105410c600556056005580c2a0556052a05060c6e0556","0xc700556050c660c6f0556050c1c0c0c56050c070c6e61602a06056e055605","0x55605717207460c720556050c1e0c71055605706f07470c70055605700529","0x56050705410c360556053605580c390556053905060c740556057305490c73","0x1c0c0c56051305670c0c56050c070c7407363906057405560574053f0c0705","0x1e0c760556052e7507470c2e0556052e05290c2e0556050c660c750556050c","0xc4d0556054d05060c780556057705490c77055605765f07460c5f0556050c","0xc0c7807194d06057805560578053f0c070556050705410c19055605190558","0x556051305130c0c56050c070c194d07795106075607050c07050c0c56050c","0x1d054d0c0c56050c070c47057a291d0756071c05510c060556050605060c1c","0x556054605290c460556050c1d0c1e0556050c1c0c0c56052905190c0c5605","0x54105490c41055605495807460c580556050c1e0c49055605461e07470c46","0x3f053f0c070556050705410c510556055105580c060556050605060c3f0556","0xc270556050c270c0c560547054d0c0c56050c070c3f07510606053f055605","0xc1c0c0c56050c070c3639077b3d2a075607275106133d0c2705560527052a","0x5600c5a055605003e07470c000556050005290c000556050c3e0c3e055605","0x640c5e0556055d05630c5d0556055c05620c0c56055b05610c5c5b0756055a","0xc070556050705410c3d0556053d05580c2a0556052a05060c600556055e05","0x56050c660c610556050c1c0c0c56050c070c60073d2a06056005560560053f","0x636407460c640556050c1e0c63055605626107470c620556056205290c6205","0x5410c360556053605580c390556053905060c660556056505490c65055605","0x56051305670c0c56050c070c6607363906056605560566053f0c0705560507","0x55605686707470c680556056805290c680556050c660c670556050c1c0c0c","0x56054d05060c6c0556056b05490c6b055605696a07460c6a0556050c1e0c69","0x7194d06056c0556056c053f0c070556050705410c190556051905580c4d05","0x1305130c0c56050c070c194d077c5106075607050c07050c0c56050c0c0c6c","0xc47057d291d0756071c05510c060556050605060c0c56050c680c1c055605","0x6c0c4905560546056b0c460556051e056a0c1e0556052905690c0c56050c07","0x56050c6f0c0c56050c070c0c7e050c6e0c4105560549056d0c580556051d05","0x74105710c4105560527056d0c5805560547056c0c270556053f05700c3f05","0xc0c56050c070c3e058036390756075805510c0c56050c070c3d057f2a0556","0x5c05560539056c0c5b0556055a056b0c5a05560500056a0c00055605360569","0x5e05700c5e0556050c6f0c0c56050c070c0c81050c6e0c5d0556055b056d0c","0x620582610556075d05710c5d05560560056d0c5c0556053e056c0c60055605","0xc0c56050c720c0c56050c070c65058364630756075c05510c0c56050c070c","0x50c1c0c0c56052a05650c0c56056105650c0c56056405190c0c560563054d","0x50c1e0c68055605676607470c670556056705290c670556050c1d0c660556","0x5580c060556050605060c6b0556056a05490c6a055605686907460c690556","0x50c070c6b07510606056b0556056b053f0c070556050705410c5105560551","0x76c5106133d0c6c0556056c052a0c6c0556050c270c0c560565054d0c0c56","0x5a0c720556057105360c710556050c390c0c56050c070c706f07846e6d0756","0x7505560575055b0c750556050c000c740556056173075e0c732a0756052a05","0x7275076e515d0c6d0556056d05060c740556057405290c7205560572055c0c","0xc860556050c1c0c0c56050c720c0c56050c070c78775f1385762e07560774","0x556058905620c0c56058805610c89880756058705600c870556052a860747","0x56052e05580c6d0556056d05060c8c0556058b05640c8b0556058a05630c8a","0xc0c56050c070c8c762e6d06058c0556058c053f0c760556057605410c2e05","0x5490c8d055605785907460c590556050c1e0c0c56052a05650c0c56050c72","0x3f0c770556057705410c5f0556055f05580c6d0556056d05060c8e0556058d","0xc56056105650c0c56050c720c0c56050c070c8e775f6d06058e0556058e05","0x470c900556059005290c900556050c660c8f0556050c1c0c0c56052a05650c","0x940556059305490c93055605919207460c920556050c1e0c91055605908f07","0x5560594053f0c070556050705410c700556057005580c6f0556056f05060c","0x55c054d0c0c56056205730c0c56050c720c0c56050c070c9407706f060594","0x950556059505290c950556050c740c200556050c1c0c0c56052a05650c0c56","0x56055705490c57055605969707460c970556050c1e0c96055605952007470c","0x598053f0c070556050705410c510556055105580c060556050605060c9805","0x54d0c0c56053d05730c0c56050c720c0c56050c070c980751060605980556","0x9a9907470c9a0556059a05290c9a0556050c750c990556050c1c0c0c560558","0x5060c9e0556059d05490c9d0556059b9c07460c9c0556050c1e0c9b055605","0x6059e0556059e053f0c070556050705410c510556055105580c0605560506","0xa00556050c660c9f0556050c1c0c0c56051305670c0c56050c070c9e075106","0x5605a1a207460ca20556050c1e0ca1055605a09f07470ca0055605a005290c","0x50705410c190556051905580c4d0556054d05060ca4055605a305490ca305","0x7050c3d3f3e0c061d3f3e0c0613a407194d0605a4055605a4053f0c070556","0x1307050c3d3f3e0c061d3f3e0c06a51307050c3d3f3e0c061d3f3e0c060c13","0xa6"],"sierra_program_debug_info":{"type_names":[[0,"RangeCheck"],[1,"Const"],[2,"Const"],[3,"Unit"],[4,"felt252"],[5,"core::option::Option::"],[6,"Const"],[7,"Array"],[8,"Snapshot>"],[9,"core::array::Span::"],[10,"Tuple>"],[11,"Const"],[12,"u32"],[13,"Const"],[14,"StorageAddress"],[15,"StorageBaseAddress"],[16,"BuiltinCosts"],[17,"System"],[18,"core::panics::Panic"],[19,"Tuple>"],[20,"core::panics::PanicResult::<(core::array::Span::,)>"],[21,"Const"],[22,"Box"],[23,"GasBuiltin"]],"libfunc_names":[[0,"revoke_ap_tracking"],[1,"withdraw_gas"],[2,"branch_align"],[3,"struct_deconstruct>"],[4,"store_temp"],[5,"array_snapshot_pop_front"],[6,"drop>>"],[7,"drop>"],[8,"array_new"],[9,"const_as_immediate>"],[10,"store_temp"],[11,"array_append"],[12,"struct_construct"],[13,"struct_construct>>"],[14,"enum_init,)>, 1>"],[15,"store_temp"],[16,"store_temp"],[17,"store_temp,)>>"],[18,"get_builtin_costs"],[19,"store_temp"],[20,"withdraw_gas_all"],[21,"storage_base_address_const<521780245902522698637863835114646400086704280925471510886115468919502353704>"],[22,"storage_address_from_base"],[23,"const_as_immediate>"],[24,"const_as_immediate>"],[25,"dup"],[26,"store_temp"],[27,"store_temp"],[28,"storage_write_syscall"],[29,"felt252_add"],[30,"snapshot_take>"],[31,"drop>"],[32,"struct_construct>"],[33,"struct_construct>>"],[34,"enum_init,)>, 0>"],[35,"drop"],[36,"const_as_immediate>"],[37,"drop>"],[38,"enable_ap_tracking"],[39,"unbox"],[40,"rename"],[41,"enum_init, 0>"],[42,"store_temp>>"],[43,"store_temp>"],[44,"jump"],[45,"struct_construct"],[46,"enum_init, 1>"],[47,"enum_match>"],[48,"disable_ap_tracking"],[49,"drop"],[50,"const_as_immediate>"],[51,"const_as_immediate>"]],"user_func_names":[[0,"test_contracts::TestContract::__wrapper__get_num"],[1,"test_contracts::TestContract::__wrapper__number_a"],[2,"test_contracts::TestContract::__wrapper__constructor"]]},"contract_class_version":"0.1.0","entry_points_by_type":{"EXTERNAL":[{"selector":"0x15d9e3ddc3010201d5746658f5fe8ace001ef8f271b83fa78558aa1e2adef1a","function_idx":1},{"selector":"0x1c659e9390feb38b127ccb1d3c1101dd77161ebdc45a31d8a64f586187cc3a2","function_idx":0}],"L1_HANDLER":[],"CONSTRUCTOR":[{"selector":"0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194","function_idx":2}]},"abi":[{"type":"constructor","name":"constructor","inputs":[{"name":"arg1","type":"core::felt252"},{"name":"arg2","type":"core::felt252"}]},{"type":"function","name":"get_num","inputs":[],"outputs":[{"type":"core::felt252"}],"state_mutability":"external"},{"type":"function","name":"number_a","inputs":[],"outputs":[{"type":"core::felt252"}],"state_mutability":"external"},{"type":"event","name":"test_contracts::TestContract::Event","kind":"enum","variants":[]}]} \ No newline at end of file diff --git a/crates/blockifier/feature_contracts/cairo1/compiled/test_contract_entrypoint_b.sierra.json b/crates/blockifier/feature_contracts/cairo1/compiled/test_contract_entrypoint_b.sierra.json new file mode 100644 index 0000000000..29c6f18084 --- /dev/null +++ b/crates/blockifier/feature_contracts/cairo1/compiled/test_contract_entrypoint_b.sierra.json @@ -0,0 +1 @@ +{"sierra_program":["0x1","0x6","0x0","0x2","0x8","0x0","0xa7","0x59","0x18","0x52616e6765436865636b","0x800000000000000100000000000000000000000000000000","0x436f6e7374","0x800000000000000000000000000000000000000000000002","0x1","0x4","0x2","0x4661696c656420746f20646573657269616c697a6520706172616d202331","0x4661696c656420746f20646573657269616c697a6520706172616d202332","0x537472756374","0x800000000000000f00000000000000000000000000000001","0x0","0x2ee1e2b1b89f8c495f200e4956278a4d47395fe262f27b52e5865c9524c08c3","0x66656c74323532","0x800000000000000700000000000000000000000000000000","0x456e756d","0x800000000000000700000000000000000000000000000003","0x11c6d8087e00642489f92d2821ad6ebd6532ad1a3b6d12833da6d6810391511","0x3","0x4f7574206f6620676173","0x4172726179","0x800000000000000300000000000000000000000000000001","0x536e617073686f74","0x800000000000000700000000000000000000000000000001","0x7","0x800000000000000700000000000000000000000000000002","0x1baeba72e79e9db2587cf44fedb2f3700b2075a5e8e39a562584862c4b71f62","0x8","0x9","0xc","0x753332","0x49","0x53746f7261676541646472657373","0x53746f726167654261736541646472657373","0x4275696c74696e436f737473","0x53797374656d","0x16a4c8d7c05909052238a862d8cc3e7975bf05a07b3a69c6b28951083a6d672","0x800000000000000300000000000000000000000000000003","0x12","0x9931c641b913035ae674b400b61a51476d506bbe8bba2ff8a6272790aba9e6","0xa","0x13","0x496e70757420746f6f206c6f6e6720666f7220617267756d656e7473","0x426f78","0x4761734275696c74696e","0x34","0x7265766f6b655f61705f747261636b696e67","0x77697468647261775f676173","0x6272616e63685f616c69676e","0x7374727563745f6465636f6e737472756374","0x73746f72655f74656d70","0x61727261795f736e617073686f745f706f705f66726f6e74","0x64726f70","0x16","0x61727261795f6e6577","0x636f6e73745f61735f696d6d656469617465","0x15","0x61727261795f617070656e64","0x7374727563745f636f6e737472756374","0x656e756d5f696e6974","0x14","0x17","0x11","0x6765745f6275696c74696e5f636f737473","0x10","0x77697468647261775f6761735f616c6c","0x73746f726167655f626173655f616464726573735f636f6e7374","0x1275130f95dda36bcbb6e9d28796c1d7e10b6e9fd5ed083e0ede4b12f613528","0x73746f726167655f616464726573735f66726f6d5f62617365","0xd","0xb","0x647570","0xe","0x73746f726167655f77726974655f73797363616c6c","0x66656c743235325f616464","0x736e617073686f745f74616b65","0x6","0x656e61626c655f61705f747261636b696e67","0x756e626f78","0x72656e616d65","0x5","0x6a756d70","0x656e756d5f6d61746368","0x64697361626c655f61705f747261636b696e67","0x13e","0xffffffffffffffff","0x4d","0xf","0x40","0x19","0x1a","0x1b","0x1c","0x1d","0x36","0x1e","0x1f","0x20","0x21","0x22","0x23","0x24","0x25","0x26","0x27","0x28","0x29","0x2a","0x2b","0x2c","0x2d","0x2e","0x2f","0x30","0x31","0x32","0x33","0x35","0x37","0x38","0x91","0x70","0x84","0x130","0xad","0xb2","0x120","0xbc","0xc1","0x10f","0xd6","0xff","0xf4","0x39","0x3a","0x3b","0x3c","0x3d","0x3e","0x3f","0x41","0x42","0x43","0x44","0x45","0x46","0x47","0x48","0x4a","0x4b","0x4c","0x4e","0x4f","0x50","0x51","0x52","0x53","0x54","0x55","0x56","0x57","0x58","0x59","0x5a","0x5b","0x9f","0xb06","0x40313050605120c11100f0e0d0c0b0a090706050403080706050403020100","0x1f0c071e0504031d050d0c1a0a1c051b0c1a0a190518170605161514070605","0x280c2610190527050d0c260a250c0b0a02240f230f220f212007060504030f","0xc0505331d0505320c310c300c2f2e022d0605182c2b07060504032a052905","0x5053b0605053a060505333905053806050537360505351c05053506050534","0xc42410505330c403d0505333f0505333e05053305073d05073c2a05053b27","0x4c0c4b0c4a490505331e0505330605054847050538460505380c4544070543","0x5354d050538060505350c073d05073c2905053b1d05053b19050535190505","0x5053b0c52510505331c0505330c075105073c060505500605054f0c4e1d05","0x56050c0c0c550505053807050538130505350c545105055305075105073c13","0x60c1c0556051305130c0c56050c070c194d07575106075607050c07050c0c","0xc56051d054d0c0c56050c070c470539291d0756071c05510c060556050605","0x470c460556054605290c460556050c1d0c1e0556050c1c0c0c56052905190c","0x3f0556054105490c41055605495807460c580556050c1e0c49055605461e07","0x556053f053f0c070556050705410c510556055105580c060556050605060c","0x27052a0c270556050c270c0c560547054d0c0c56050c070c3f07510606053f","0x556050c390c0c56050c070c363907593d2a075607275106133d0c27055605","0x5a0756055a055a0c5b0556050c000c5a0556050c3e0c000556053e05360c3e","0x56052a05060c5c0556055c05290c0005560500055c0c5b0556055b055b0c5c","0x56050c1c0c0c56050c070c626160135f5e5d0756075c005b073d515d0c2a05","0x56505290c65055605645a075e0c5a0556055a05290c640556050c3e0c6305","0x5620c0c56056705610c68670756056605600c66055605656307470c650556","0x580c2a0556052a05060c6b0556056a05640c6a0556056905630c6905560568","0xc070c6b5e5d2a06056b0556056b053f0c5e0556055e05410c5d0556055d05","0x56d05490c6d055605626c07460c6c0556050c1e0c0c56055a05650c0c5605","0x6e053f0c610556056105410c600556056005580c2a0556052a05060c6e0556","0xc700556050c660c6f0556050c1c0c0c56050c070c6e61602a06056e055605","0x55605717207460c720556050c1e0c71055605706f07470c70055605700529","0x56050705410c360556053605580c390556053905060c740556057305490c73","0x1c0c0c56051305670c0c56050c070c7407363906057405560574053f0c0705","0x1e0c760556052e7507470c2e0556052e05290c2e0556050c660c750556050c","0xc4d0556054d05060c780556057705490c77055605765f07460c5f0556050c","0xc0c7807194d06057805560578053f0c070556050705410c19055605190558","0x556051305130c0c56050c070c194d07795106075607050c07050c0c56050c","0x1d054d0c0c56050c070c47057a291d0756071c05510c060556050605060c1c","0x556054605290c460556050c1d0c1e0556050c1c0c0c56052905190c0c5605","0x54105490c41055605495807460c580556050c1e0c49055605461e07470c46","0x3f053f0c070556050705410c510556055105580c060556050605060c3f0556","0xc270556050c270c0c560547054d0c0c56050c070c3f07510606053f055605","0xc1c0c0c56050c070c3639077b3d2a075607275106133d0c2705560527052a","0x5600c5a055605003e07470c000556050005290c000556050c3e0c3e055605","0x640c5e0556055d05630c5d0556055c05620c0c56055b05610c5c5b0756055a","0xc070556050705410c3d0556053d05580c2a0556052a05060c600556055e05","0x56050c660c610556050c1c0c0c56050c070c60073d2a06056005560560053f","0x636407460c640556050c1e0c63055605626107470c620556056205290c6205","0x5410c360556053605580c390556053905060c660556056505490c65055605","0x56051305670c0c56050c070c6607363906056605560566053f0c0705560507","0x55605686707470c680556056805290c680556050c660c670556050c1c0c0c","0x56054d05060c6c0556056b05490c6b055605696a07460c6a0556050c1e0c69","0x7194d06056c0556056c053f0c070556050705410c190556051905580c4d05","0x1305130c0c56050c070c194d077c5106075607050c07050c0c56050c0c0c6c","0xc47057d291d0756071c05510c060556050605060c0c56050c680c1c055605","0x6c0c4905560546056b0c460556051e056a0c1e0556052905690c0c56050c07","0x56050c6f0c0c56050c070c0c7e050c6e0c4105560549056d0c580556051d05","0x74105710c4105560527056d0c5805560547056c0c270556053f05700c3f05","0xc0c56050c070c3e058036390756075805510c0c56050c070c3d057f2a0556","0x5c05560539056c0c5b0556055a056b0c5a05560500056a0c00055605360569","0x5e05700c5e0556050c6f0c0c56050c070c0c81050c6e0c5d0556055b056d0c","0x620582610556075d05710c5d05560560056d0c5c0556053e056c0c60055605","0xc0c56050c720c0c56050c070c65058364630756075c05510c0c56050c070c","0x50c1c0c0c56052a05650c0c56056105650c0c56056405190c0c560563054d","0x50c1e0c68055605676607470c670556056705290c670556050c1d0c660556","0x5580c060556050605060c6b0556056a05490c6a055605686907460c690556","0x50c070c6b07510606056b0556056b053f0c070556050705410c5105560551","0x76c5106133d0c6c0556056c052a0c6c0556050c270c0c560565054d0c0c56","0x5a0c720556057105360c710556050c390c0c56050c070c706f07846e6d0756","0x7505560575055b0c750556050c000c740556056173075e0c732a0756052a05","0x7275076e515d0c6d0556056d05060c740556057405290c7205560572055c0c","0xc860556050c1c0c0c56050c720c0c56050c070c78775f1385762e07560774","0x556058905620c0c56058805610c89880756058705600c870556052a860747","0x56052e05580c6d0556056d05060c8c0556058b05640c8b0556058a05630c8a","0xc0c56050c070c8c762e6d06058c0556058c053f0c760556057605410c2e05","0x5490c8d055605785907460c590556050c1e0c0c56052a05650c0c56050c72","0x3f0c770556057705410c5f0556055f05580c6d0556056d05060c8e0556058d","0xc56056105650c0c56050c720c0c56050c070c8e775f6d06058e0556058e05","0x470c900556059005290c900556050c660c8f0556050c1c0c0c56052a05650c","0x940556059305490c93055605919207460c920556050c1e0c91055605908f07","0x5560594053f0c070556050705410c700556057005580c6f0556056f05060c","0x55c054d0c0c56056205730c0c56050c720c0c56050c070c9407706f060594","0x950556059505290c950556050c740c200556050c1c0c0c56052a05650c0c56","0x56055705490c57055605969707460c970556050c1e0c96055605952007470c","0x598053f0c070556050705410c510556055105580c060556050605060c9805","0x54d0c0c56053d05730c0c56050c720c0c56050c070c980751060605980556","0x9a9907470c9a0556059a05290c9a0556050c750c990556050c1c0c0c560558","0x5060c9e0556059d05490c9d0556059b9c07460c9c0556050c1e0c9b055605","0x6059e0556059e053f0c070556050705410c510556055105580c0605560506","0xa00556050c660c9f0556050c1c0c0c56051305670c0c56050c070c9e075106","0x5605a1a207460ca20556050c1e0ca1055605a09f07470ca0055605a005290c","0x50705410c190556051905580c4d0556054d05060ca4055605a305490ca305","0x7050c3d3f3e0c061d3f3e0c0613a407194d0605a4055605a4053f0c070556","0x1307050c3d3f3e0c061d3f3e0c06a51307050c3d3f3e0c061d3f3e0c060c13","0xa6"],"sierra_program_debug_info":{"type_names":[[0,"RangeCheck"],[1,"Const"],[2,"Const"],[3,"Unit"],[4,"felt252"],[5,"core::option::Option::"],[6,"Const"],[7,"Array"],[8,"Snapshot>"],[9,"core::array::Span::"],[10,"Tuple>"],[11,"Const"],[12,"u32"],[13,"Const"],[14,"StorageAddress"],[15,"StorageBaseAddress"],[16,"BuiltinCosts"],[17,"System"],[18,"core::panics::Panic"],[19,"Tuple>"],[20,"core::panics::PanicResult::<(core::array::Span::,)>"],[21,"Const"],[22,"Box"],[23,"GasBuiltin"]],"libfunc_names":[[0,"revoke_ap_tracking"],[1,"withdraw_gas"],[2,"branch_align"],[3,"struct_deconstruct>"],[4,"store_temp"],[5,"array_snapshot_pop_front"],[6,"drop>>"],[7,"drop>"],[8,"array_new"],[9,"const_as_immediate>"],[10,"store_temp"],[11,"array_append"],[12,"struct_construct"],[13,"struct_construct>>"],[14,"enum_init,)>, 1>"],[15,"store_temp"],[16,"store_temp"],[17,"store_temp,)>>"],[18,"get_builtin_costs"],[19,"store_temp"],[20,"withdraw_gas_all"],[21,"storage_base_address_const<521780245902522698637863835114646400086704280925471510886115468919502353704>"],[22,"storage_address_from_base"],[23,"const_as_immediate>"],[24,"const_as_immediate>"],[25,"dup"],[26,"store_temp"],[27,"store_temp"],[28,"storage_write_syscall"],[29,"felt252_add"],[30,"snapshot_take>"],[31,"drop>"],[32,"struct_construct>"],[33,"struct_construct>>"],[34,"enum_init,)>, 0>"],[35,"drop"],[36,"const_as_immediate>"],[37,"drop>"],[38,"enable_ap_tracking"],[39,"unbox"],[40,"rename"],[41,"enum_init, 0>"],[42,"store_temp>>"],[43,"store_temp>"],[44,"jump"],[45,"struct_construct"],[46,"enum_init, 1>"],[47,"enum_match>"],[48,"disable_ap_tracking"],[49,"drop"],[50,"const_as_immediate>"],[51,"const_as_immediate>"]],"user_func_names":[[0,"test_contracts::TestContract::__wrapper__get_num"],[1,"test_contracts::TestContract::__wrapper__number_b"],[2,"test_contracts::TestContract::__wrapper__constructor"]]},"contract_class_version":"0.1.0","entry_points_by_type":{"EXTERNAL":[{"selector":"0x1c659e9390feb38b127ccb1d3c1101dd77161ebdc45a31d8a64f586187cc3a2","function_idx":0},{"selector":"0x1e387efac81ec38762d5cbdc900314fb40c0d2d16e9fea8624ddd8043a3b056","function_idx":1}],"L1_HANDLER":[],"CONSTRUCTOR":[{"selector":"0x28ffe4ff0f226a9107253e17a904099aa4f63a02a5621de0576e5aa71bc5194","function_idx":2}]},"abi":[{"type":"constructor","name":"constructor","inputs":[{"name":"arg1","type":"core::felt252"},{"name":"arg2","type":"core::felt252"}]},{"type":"function","name":"get_num","inputs":[],"outputs":[{"type":"core::felt252"}],"state_mutability":"external"},{"type":"function","name":"number_b","inputs":[],"outputs":[{"type":"core::felt252"}],"state_mutability":"external"},{"type":"event","name":"test_contracts::TestContract::Event","kind":"enum","variants":[]}]} \ No newline at end of file diff --git a/crates/blockifier/feature_contracts/cairo1/test_contract_entrypoint_a.cairo b/crates/blockifier/feature_contracts/cairo1/test_contract_entrypoint_a.cairo new file mode 100644 index 0000000000..5a0d2f2515 --- /dev/null +++ b/crates/blockifier/feature_contracts/cairo1/test_contract_entrypoint_a.cairo @@ -0,0 +1,55 @@ +// Basic contract with an external entrypoint function. +// Used for comparison to its counterpart. +// `test_contract_entrypoint_a.cairo` : Has an external entrypoint for function: `number_a`. +// `test_contract_entrypoint_b.cairo` : Has an external entrypoint for function: `number_b`. +// These two contracts both have the same `sierra_program`, and both have an entrypoint with the same signature, +// However, they are different contracts because the function names used for the entrypoints are different. + +#[starknet::contract] +mod TestContract { + #[storage] + struct Storage { + my_storage_var: felt252, + two_counters: starknet::storage::Map, + ec_point: (felt252, felt252), + } + + #[constructor] + fn constructor(ref self: ContractState, arg1: felt252, arg2: felt252) -> felt252 { + self.my_storage_var.write(arg1 + arg2); + arg1 + } + + #[external(v0)] + fn get_num( + ref self: ContractState + ) -> felt252 { + let val_a = number_a(ref self); + let val_b = number_b(ref self); + self.my_storage_var.write(val_a); + val_a + val_b + } + + // Functions for external entrypoints. + // Reference: https://book.cairo-lang.org/ch14-02-contract-functions.html#external-functions + + // Note that although the function signatures are identical, the selector will be different. + // Reference: https://book.cairo-lang.org/ch15-01-contract-class-abi.html?highlight=abi#function-selector + // In the blockifier: `selector_from_name` uses `starknet_keccak` on `entry_point_name`. + + // First contract entrypoint. + #[external(v0)] + fn number_a( + ref self: ContractState + ) -> felt252 { + 73 + } + + // Second contract entrypoint. + // #[external(v0)] + fn number_b( + ref self: ContractState + ) -> felt252 { + 73 + } +} diff --git a/crates/blockifier/feature_contracts/cairo1/test_contract_entrypoint_b.cairo b/crates/blockifier/feature_contracts/cairo1/test_contract_entrypoint_b.cairo new file mode 100644 index 0000000000..6a7eb578e8 --- /dev/null +++ b/crates/blockifier/feature_contracts/cairo1/test_contract_entrypoint_b.cairo @@ -0,0 +1,61 @@ +// Basic contract with an external entrypoint function. +// Used for comparison to its counterpart. +// `test_contract_entrypoint_a.cairo` : Has an external entrypoint for function: `number_a`. +// `test_contract_entrypoint_b.cairo` : Has an external entrypoint for function: `number_b`. +// These two contracts both have the same `sierra_program`, and both have an entrypoint with the same signature, +// However, they are different contracts because the function names used for the entrypoints are different. + +// Compiled with: scarb build +// scarb --version +// scarb 2.8.0 (09590f5fc 2024-08-27) +// cairo: 2.8.0 (https://crates.io/crates/cairo-lang-compiler/2.8.0) +// sierra: 1.6.0 + +#[starknet::contract] +mod TestContract { + #[storage] + struct Storage { + my_storage_var: felt252, + two_counters: starknet::storage::Map, + ec_point: (felt252, felt252), + } + + #[constructor] + fn constructor(ref self: ContractState, arg1: felt252, arg2: felt252) -> felt252 { + self.my_storage_var.write(arg1 + arg2); + arg1 + } + + #[external(v0)] + fn get_num( + ref self: ContractState + ) -> felt252 { + let val_a = number_a(ref self); + let val_b = number_b(ref self); + self.my_storage_var.write(val_a); + val_a + val_b + } + + // Functions for external entrypoints. + // Reference: https://book.cairo-lang.org/ch14-02-contract-functions.html#external-functions + + // Note that although the function signatures are identical, the selector will be different. + // Reference: https://book.cairo-lang.org/ch15-01-contract-class-abi.html?highlight=abi#function-selector + // In the blockifier: `selector_from_name` uses `starknet_keccak` on `entry_point_name`. + + // First contract entrypoint. + // #[external(v0)] + fn number_a( + ref self: ContractState + ) -> felt252 { + 73 + } + + // Second contract entrypoint. + #[external(v0)] + fn number_b( + ref self: ContractState + ) -> felt252 { + 73 + } +} diff --git a/crates/blockifier/src/execution/contract_class.rs b/crates/blockifier/src/execution/contract_class.rs index c10cef7ae8..ab8a6a7a0b 100644 --- a/crates/blockifier/src/execution/contract_class.rs +++ b/crates/blockifier/src/execution/contract_class.rs @@ -5,24 +5,16 @@ use std::sync::Arc; use cairo_lang_casm; use cairo_lang_casm::hints::Hint; use cairo_lang_sierra::ids::FunctionId; -use cairo_lang_starknet_classes::casm_contract_class::{ - CasmContractClass, - CasmContractEntryPoint, - StarknetSierraCompilationError, -}; +use cairo_lang_starknet_classes::casm_contract_class::{CasmContractClass, CasmContractEntryPoint}; use cairo_lang_starknet_classes::contract_class::{ - ContractClass as SierraContractClass, - ContractEntryPoint, + ContractClass as SierraContractClass, ContractEntryPoint, ContractEntryPoints as SierraContractEntryPoints, }; use cairo_lang_starknet_classes::NestedIntList; use cairo_lang_utils::bigint::BigUintAsHex; use cairo_native::executor::AotNativeExecutor; use cairo_vm::serde::deserialize_program::{ - ApTracking, - FlowTrackingData, - HintParams, - ReferenceManager, + ApTracking, FlowTrackingData, HintParams, ReferenceManager, }; use cairo_vm::types::builtin_name::BuiltinName; use cairo_vm::types::errors::program_errors::ProgramError; @@ -32,15 +24,14 @@ use cairo_vm::vm::runners::cairo_runner::ExecutionResources; use itertools::Itertools; use serde::de::Error as DeserializationError; use serde::{Deserialize, Deserializer}; +use starknet_api::block::BlockHash; use starknet_api::core::EntryPointSelector; use starknet_api::deprecated_contract_class::{ - ContractClass as DeprecatedContractClass, - EntryPoint, - EntryPointOffset, - EntryPointType, + ContractClass as DeprecatedContractClass, EntryPoint, EntryPointOffset, EntryPointType, Program as DeprecatedProgram, }; use starknet_types_core::felt::Felt; +use starknet_types_core::hash::{Poseidon, StarkHash}; use super::entry_point::EntryPointExecutionResult; use super::errors::EntryPointExecutionError; @@ -158,7 +149,7 @@ impl ContractClassV0 { + self.n_builtins() + self.bytecode_length() + 1; // Hinted class hash. - // The hashed data size is approximately the number of hashes (invoked in hash chains). + // The hashed data size is approximately the number of hashes (invoked in hash chains). let n_steps = constants::N_STEPS_PER_PEDERSEN * hashed_data_size; ExecutionResources { @@ -611,21 +602,6 @@ impl NativeContractClassV1 { Ok(Self(Arc::new(contract))) } - pub fn to_casm_contract_class( - self, - ) -> Result { - let sierra_contract_class = SierraContractClass { - // Cloning because these are behind an Arc. - sierra_program: self.sierra_program_raw.clone(), - entry_points_by_type: self.fallback_entry_points_by_type.clone(), - abi: None, - sierra_program_debug_info: None, - contract_class_version: String::default(), - }; - - CasmContractClass::from_contract_class(sierra_contract_class, false, usize::MAX) - } - /// Returns an entry point into the natively compiled contract. pub fn get_entrypoint( &self, @@ -648,9 +624,8 @@ impl NativeContractClassV1 { pub struct NativeContractClassV1Inner { pub executor: AotNativeExecutor, entry_points_by_type: NativeContractEntryPoints, - // Storing the raw sierra program and entry points to be able to fallback to the vm - sierra_program_raw: Vec, - fallback_entry_points_by_type: SierraContractEntryPoints, + // Used for PartialEq + sierra_program_hash: BlockHash, } impl NativeContractClassV1Inner { @@ -681,18 +656,25 @@ impl NativeContractClassV1Inner { &lookup_fid, &sierra_contract_class.entry_points_by_type, )?, - sierra_program_raw: sierra_contract_class.sierra_program, - fallback_entry_points_by_type: sierra_contract_class.entry_points_by_type, + sierra_program_hash: calculate_sierra_program_hash( + sierra_contract_class.sierra_program, + ), }) } } +fn calculate_sierra_program_hash(sierra: Vec) -> BlockHash { + let sierra_felts: Vec = + sierra.iter().map(|big_uint| &big_uint.value).map_into().collect(); + BlockHash(Poseidon::hash_array(&sierra_felts)) +} + // The location where the compiled contract is loaded into memory will not // be the same therefore we exclude it from the comparison. impl PartialEq for NativeContractClassV1Inner { fn eq(&self, other: &Self) -> bool { self.entry_points_by_type == other.entry_points_by_type - && self.sierra_program_raw == other.sierra_program_raw + && self.sierra_program_hash == other.sierra_program_hash } } diff --git a/crates/blockifier/src/execution/execution_utils.rs b/crates/blockifier/src/execution/execution_utils.rs index 6aa1e48a8c..c61fb86ee9 100644 --- a/crates/blockifier/src/execution/execution_utils.rs +++ b/crates/blockifier/src/execution/execution_utils.rs @@ -1,5 +1,4 @@ use std::collections::HashMap; -use std::env; use cairo_lang_runner::casm_run::format_next_item; use cairo_vm::serde::deserialize_program::{ @@ -19,9 +18,8 @@ use starknet_api::deprecated_contract_class::Program as DeprecatedProgram; use starknet_api::transaction::Calldata; use starknet_types_core::felt::Felt; -use super::contract_class::ContractClassV1; use super::entry_point::ConstructorEntryPointExecutionResult; -use super::errors::{ConstructorEntryPointExecutionError, EntryPointExecutionError}; +use super::errors::ConstructorEntryPointExecutionError; use crate::execution::call_info::{CallInfo, Retdata}; use crate::execution::contract_class::ContractClass; use crate::execution::entry_point::{ @@ -68,7 +66,6 @@ pub fn execute_entry_point_call( ContractClass::V1Native(contract_class) => { // Wrap the state into a DynStateWrapper to be transactional let mut state_wrapped = DynStateWrapper::new(state); - let fallback = env::var("FALLBACK_ENABLED").unwrap_or(String::from("0")) == "1"; match native_entry_point_execution::execute_entry_point_call( call.clone(), @@ -83,26 +80,6 @@ pub fn execute_entry_point_call( Ok(res) } - Err(EntryPointExecutionError::NativeUnexpectedError { .. }) if fallback => { - // Fallback to VM execution in case of an Error - let casm_contract_class = - contract_class.to_casm_contract_class().map_err(|e| { - EntryPointExecutionError::FailedToConvertSierraToCasm(e.to_string()) - })?; - let contract_class_v1: ContractClassV1 = - casm_contract_class.try_into().unwrap(); - // Use old state if native execution failed - entry_point_execution::execute_entry_point_call( - call, - contract_class_v1, - state, - resources, - context, - ) - .map_err(|e| { - EntryPointExecutionError::NativeFallbackError { info: Box::new(e) } - }) - } Err(e) => Err(e), } } diff --git a/crates/blockifier/tests/test_native_contract.rs b/crates/blockifier/tests/test_native_contract.rs new file mode 100644 index 0000000000..5171cb82bf --- /dev/null +++ b/crates/blockifier/tests/test_native_contract.rs @@ -0,0 +1,21 @@ +// Test command: cargo test --test test_native_contract --features testing + +#[cfg(test)] +mod native_contract_tests { + use blockifier::execution::contract_class::NativeContractClassV1; + + #[test] + fn test_partial_eq() { + let contract_a = NativeContractClassV1::from_file( + format!("feature_contracts/cairo1/compiled/test_contract_entrypoint_a.sierra.json") + .as_str(), + ); + let contract_b = NativeContractClassV1::from_file( + format!("feature_contracts/cairo1/compiled/test_contract_entrypoint_b.sierra.json") + .as_str(), + ); + assert_eq!(contract_b, contract_b); + assert_eq!(contract_a, contract_a); + assert_ne!(contract_a, contract_b, "Contracts should be considered different because they have different entry points. Specifically, the selectors are different due to having different names."); + } +}