Skip to content

Commit dc8e2e4

Browse files
starknet_os_flow_tests: fuzz test call scenario
1 parent 67ebf05 commit dc8e2e4

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": 179,
41+
"offset": 208,
4242
"selector": "0x8e64dfac867f301a439703710296f437e9f91d1bba17cfea5ad7f137a5acd"
4343
},
4444
{
@@ -232,15 +232,44 @@
232232
"0x48127ffc7fff8000",
233233
"0x48127ffc7fff8000",
234234
"0x48127ffc7fff8000",
235+
"0x4826800180018000",
236+
"0x800000000000011000000000000000000000000000000000000000000000000",
237+
"0x20680017fff7fff",
238+
"0x18",
239+
"0x48127ffc7fff8000",
240+
"0x48127ffc7fff8000",
241+
"0x48127ffc7fff8000",
242+
"0x480a80007fff8000",
243+
"0x1104800180018000",
244+
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffcc",
245+
"0x1104800180018000",
246+
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffff48",
247+
"0x48127ff77fff8000",
248+
"0x48127ff97fff8000",
249+
"0x480680017fff8000",
250+
"0x8e64dfac867f301a439703710296f437e9f91d1bba17cfea5ad7f137a5acd",
251+
"0x480680017fff8000",
252+
"0x0",
253+
"0x48127ffb7fff8000",
254+
"0x1104800180018000",
255+
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffff44",
256+
"0x48127ffd7fff8000",
257+
"0x48127fec7fff8000",
258+
"0x48127fec7fff8000",
259+
"0x10780017fff7fff",
260+
"0x5",
261+
"0x48127ffc7fff8000",
262+
"0x48127ffc7fff8000",
263+
"0x48127ffc7fff8000",
235264
"0x1104800180018000",
236-
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffe6",
265+
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffc9",
237266
"0x208b7fff7fff7ffe",
238267
"0x402b7ffd7ffc7ffd",
239268
"0x480280007ffb8000",
240269
"0x480280017ffb8000",
241270
"0x480280027ffb8000",
242271
"0x1104800180018000",
243-
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffdf",
272+
"0x800000000000010ffffffffffffffffffffffffffffffffffffffffffffffc2",
244273
"0x40780017fff7fff",
245274
"0x1",
246275
"0x48127ffc7fff8000",
@@ -361,7 +390,7 @@
361390
}
362391
}
363392
],
364-
"185": [
393+
"214": [
365394
{
366395
"accessible_scopes": [
367396
"__main__",
@@ -372,7 +401,7 @@
372401
"code": "memory[ap] = segments.add()",
373402
"flow_tracking_data": {
374403
"ap_tracking": {
375-
"group": 21,
404+
"group": 22,
376405
"offset": 0
377406
},
378407
"reference_ids": {}
@@ -381,6 +410,10 @@
381410
]
382411
},
383412
"identifiers": {
413+
"__main__.FUZZ_TEST_SELECTOR": {
414+
"type": "const",
415+
"value": 15724280504397459906927412945650388641747292702364032215010569113747217101
416+
},
384417
"__main__.HashBuiltin": {
385418
"destination": "starkware.cairo.common.cairo_builtins.HashBuiltin",
386419
"type": "alias"
@@ -389,6 +422,10 @@
389422
"type": "const",
390423
"value": 1148028502779661890523359593720089131979067183173988258322045506921168040387
391424
},
425+
"__main__.SCENARIO_CALL": {
426+
"type": "const",
427+
"value": 1
428+
},
392429
"__main__.SCENARIO_RETURN": {
393430
"type": "const",
394431
"value": 0
@@ -806,7 +843,7 @@
806843
"decorators": [
807844
"external"
808845
],
809-
"pc": 179,
846+
"pc": 208,
810847
"type": "function"
811848
},
812849
"__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) {
@@ -78,6 +81,22 @@ func test_revert_fuzz{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_chec
7881
tempvar range_check_ptr = range_check_ptr;
7982
}
8083

84+
if (scenario == SCENARIO_CALL) {
85+
call_contract(
86+
contract_address=pop_front(orchestrator),
87+
function_selector=FUZZ_TEST_SELECTOR,
88+
calldata_size=0,
89+
calldata=new(),
90+
);
91+
tempvar syscall_ptr = syscall_ptr;
92+
tempvar pedersen_ptr = pedersen_ptr;
93+
tempvar range_check_ptr = range_check_ptr;
94+
} else {
95+
tempvar syscall_ptr = syscall_ptr;
96+
tempvar pedersen_ptr = pedersen_ptr;
97+
tempvar range_check_ptr = range_check_ptr;
98+
}
99+
81100
test_revert_fuzz();
82101
return ();
83102
}

0 commit comments

Comments
 (0)