Skip to content

Commit aa9da5b

Browse files
starknet_os_flow_tests: fuzz test call scenario
1 parent db6d914 commit aa9da5b

10 files changed

Lines changed: 1172 additions & 448 deletions

File tree

crates/blockifier_test_utils/resources/feature_contracts/cairo0/compiled/fuzz_revert_compiled.json

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
],
3939
"EXTERNAL": [
4040
{
41-
"offset": 177,
41+
"offset": 206,
4242
"selector": "0x8e64dfac867f301a439703710296f437e9f91d1bba17cfea5ad7f137a5acd"
4343
},
4444
{
@@ -230,15 +230,44 @@
230230
"0x48127ffc7fff8000",
231231
"0x48127ffc7fff8000",
232232
"0x48127ffc7fff8000",
233+
"0x4826800180018000",
234+
"0x800000000000011000000000000000000000000000000000000000000000000",
235+
"0x20680017fff7fff",
236+
"0x18",
237+
"0x48127ffc7fff8000",
238+
"0x48127ffc7fff8000",
239+
"0x48127ffc7fff8000",
240+
"0x480a80007fff8000",
241+
"0x1104800180018000",
242+
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffcc",
243+
"0x1104800180018000",
244+
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffff4a",
245+
"0x48127ff77fff8000",
246+
"0x48127ff97fff8000",
247+
"0x480680017fff8000",
248+
"0x8e64dfac867f301a439703710296f437e9f91d1bba17cfea5ad7f137a5acd",
249+
"0x480680017fff8000",
250+
"0x0",
251+
"0x48127ffb7fff8000",
233252
"0x1104800180018000",
234-
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffe6",
253+
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffff46",
254+
"0x48127ffd7fff8000",
255+
"0x48127fec7fff8000",
256+
"0x48127fec7fff8000",
257+
"0x10780017fff7fff",
258+
"0x5",
259+
"0x48127ffc7fff8000",
260+
"0x48127ffc7fff8000",
261+
"0x48127ffc7fff8000",
262+
"0x1104800180018000",
263+
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffc9",
235264
"0x208b7fff7fff7ffe",
236265
"0x402b7ffd7ffc7ffd",
237266
"0x480280007ffb8000",
238267
"0x480280017ffb8000",
239268
"0x480280027ffb8000",
240269
"0x1104800180018000",
241-
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffdf",
270+
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffc2",
242271
"0x40780017fff7fff",
243272
"0x1",
244273
"0x48127ffc7fff8000",
@@ -359,7 +388,7 @@
359388
}
360389
}
361390
],
362-
"183": [
391+
"212": [
363392
{
364393
"accessible_scopes": [
365394
"__main__",
@@ -370,7 +399,7 @@
370399
"code": "memory[ap] = segments.add()",
371400
"flow_tracking_data": {
372401
"ap_tracking": {
373-
"group": 20,
402+
"group": 21,
374403
"offset": 0
375404
},
376405
"reference_ids": {}
@@ -379,6 +408,10 @@
379408
]
380409
},
381410
"identifiers": {
411+
"__main__.FUZZ_TEST_SELECTOR": {
412+
"type": "const",
413+
"value": 15724280504397459906927412945650388641747292702364032215010569113747217101
414+
},
382415
"__main__.HashBuiltin": {
383416
"destination": "starkware.cairo.common.cairo_builtins.HashBuiltin",
384417
"type": "alias"
@@ -387,6 +420,10 @@
387420
"type": "const",
388421
"value": 1148028502779661890523359593720089131979067183173988258322045506921168040387
389422
},
423+
"__main__.SCENARIO_CALL": {
424+
"type": "const",
425+
"value": 1
426+
},
390427
"__main__.SCENARIO_RETURN": {
391428
"type": "const",
392429
"value": 0
@@ -804,7 +841,7 @@
804841
"decorators": [
805842
"external"
806843
],
807-
"pc": 177,
844+
"pc": 206,
808845
"type": "function"
809846
},
810847
"__wrappers__.test_revert_fuzz.Args": {

crates/blockifier_test_utils/resources/feature_contracts/cairo0/fuzz_revert.cairo

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@ from starkware.starknet.common.syscalls import call_contract
77
// Scenarios.
88
// The RETURN scenario *must* be zero, as the zero value also indicates end of scenario stream.
99
const SCENARIO_RETURN = 0;
10+
const SCENARIO_CALL = 1;
1011

1112
// selector_from_name("pop_front").
1213
const POP_FRONT_SELECTOR = 0x289c2d7d6351cd03d4f928bde75fa14d5f52e32bdbc750d5296e1b48c12f1c3;
14+
// selector_from_name("test_revert_fuzz").
15+
const FUZZ_TEST_SELECTOR = 0x8e64dfac867f301a439703710296f437e9f91d1bba17cfea5ad7f137a5acd;
1316

1417
@storage_var
1518
func orchestrator_address() -> (address: felt) {
@@ -72,6 +75,22 @@ func test_revert_fuzz{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_chec
7275
tempvar range_check_ptr = range_check_ptr;
7376
}
7477

78+
if (scenario == SCENARIO_CALL) {
79+
call_contract(
80+
contract_address=pop_front(orchestrator),
81+
function_selector=FUZZ_TEST_SELECTOR,
82+
calldata_size=0,
83+
calldata=new(),
84+
);
85+
tempvar syscall_ptr = syscall_ptr;
86+
tempvar pedersen_ptr = pedersen_ptr;
87+
tempvar range_check_ptr = range_check_ptr;
88+
} else {
89+
tempvar syscall_ptr = syscall_ptr;
90+
tempvar pedersen_ptr = pedersen_ptr;
91+
tempvar range_check_ptr = range_check_ptr;
92+
}
93+
7594
test_revert_fuzz();
7695
return ();
7796
}

0 commit comments

Comments
 (0)