Skip to content

Commit 0a49942

Browse files
starknet_os_flow_tests: fuzz test get block hash scenario
1 parent 4f1916d commit 0a49942

14 files changed

Lines changed: 7500 additions & 5182 deletions

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

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
],
5050
"EXTERNAL": [
5151
{
52-
"offset": 716,
52+
"offset": 728,
5353
"selector": "0x8e64dfac867f301a439703710296f437e9f91d1bba17cfea5ad7f137a5acd"
5454
},
5555
{
@@ -157,18 +157,36 @@
157157
"__main__",
158158
"__main__.test_revert_fuzz"
159159
],
160-
"end_pc": 712,
160+
"end_pc": 716,
161161
"flow_tracking_data": {
162162
"ap_tracking": {
163163
"group": 27,
164-
"offset": 73
164+
"offset": 74
165+
},
166+
"reference_ids": {}
167+
},
168+
"name": "error_message",
169+
"start_pc": 712,
170+
"value": "get_block_hash_cairo0"
171+
},
172+
{
173+
"accessible_scopes": [
174+
"__main__",
175+
"__main__",
176+
"__main__.test_revert_fuzz"
177+
],
178+
"end_pc": 724,
179+
"flow_tracking_data": {
180+
"ap_tracking": {
181+
"group": 27,
182+
"offset": 74
165183
},
166184
"reference_ids": {
167185
"__main__.test_revert_fuzz.scenario": 9
168186
}
169187
},
170188
"name": "error_message",
171-
"start_pc": 708,
189+
"start_pc": 720,
172190
"value": "Unknown scenario: {scenario}."
173191
}
174192
],
@@ -886,20 +904,32 @@
886904
"0x1104800180018000",
887905
"0x800000000000010fffffffffffffffffffffffffffffffffffffffffffffe42",
888906
"0x208b7fff7fff7ffe",
907+
"0x4826800180018000",
908+
"0x800000000000010fffffffffffffffffffffffffffffffffffffffffffffff0",
909+
"0x20680017fff7fff",
910+
"0xa",
911+
"0x480680017fff8000",
912+
"0x1",
913+
"0x400680017fff7fff",
914+
"0x0",
915+
"0x48127fe97fff8000",
916+
"0x48127fe97fff8000",
917+
"0x48127fe97fff8000",
918+
"0x208b7fff7fff7ffe",
889919
"0x480680017fff8000",
890920
"0x0",
891921
"0x400680017fff7fff",
892922
"0x1",
893-
"0x48127fea7fff8000",
894-
"0x48127fea7fff8000",
895-
"0x48127fea7fff8000",
923+
"0x48127fe97fff8000",
924+
"0x48127fe97fff8000",
925+
"0x48127fe97fff8000",
896926
"0x208b7fff7fff7ffe",
897927
"0x402b7ffd7ffc7ffd",
898928
"0x480280007ffb8000",
899929
"0x480280017ffb8000",
900930
"0x480280027ffb8000",
901931
"0x1104800180018000",
902-
"0x800000000000010fffffffffffffffffffffffffffffffffffffffffffffe33",
932+
"0x800000000000010fffffffffffffffffffffffffffffffffffffffffffffe27",
903933
"0x40780017fff7fff",
904934
"0x1",
905935
"0x48127ffc7fff8000",
@@ -1126,7 +1156,7 @@
11261156
}
11271157
}
11281158
],
1129-
"722": [
1159+
"734": [
11301160
{
11311161
"accessible_scopes": [
11321162
"__main__",
@@ -1256,6 +1286,10 @@
12561286
"type": "const",
12571287
"value": 16
12581288
},
1289+
"__main__.SCENARIO_GET_BLOCK_HASH": {
1290+
"type": "const",
1291+
"value": 17
1292+
},
12591293
"__main__.SCENARIO_INCREMENT_COUNTER": {
12601294
"type": "const",
12611295
"value": 7
@@ -1906,7 +1940,7 @@
19061940
"decorators": [
19071941
"external"
19081942
],
1909-
"pc": 716,
1943+
"pc": 728,
19101944
"type": "function"
19111945
},
19121946
"__wrappers__.test_revert_fuzz.Args": {

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const SCENARIO_CALL_UNDEPLOYED = 13;
3030
const SCENARIO_CALL_NON_EXISTING_ENTRY_POINT = 14;
3131
const SCENARIO_LIBRARY_CALL_NON_EXISTING_ENTRY_POINT = 15;
3232
const SCENARIO_EMIT_EVENT = 16;
33+
const SCENARIO_GET_BLOCK_HASH = 17;
3334

3435
// selector_from_name("pop_front").
3536
const POP_FRONT_SELECTOR = 0x289c2d7d6351cd03d4f928bde75fa14d5f52e32bdbc750d5296e1b48c12f1c3;
@@ -256,6 +257,13 @@ func test_revert_fuzz{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_chec
256257
return ();
257258
}
258259

260+
if (scenario == SCENARIO_GET_BLOCK_HASH) {
261+
with_attr error_message("get_block_hash_cairo0") {
262+
assert 0 = 1;
263+
}
264+
return ();
265+
}
266+
259267
with_attr error_message("Unknown scenario: {scenario}.") {
260268
assert 1 = 0;
261269
}

0 commit comments

Comments
 (0)