Skip to content

Commit 29de878

Browse files
starknet_os_flow_tests: fuzz test library call scenario
1 parent 5c86ae3 commit 29de878

10 files changed

Lines changed: 1585 additions & 642 deletions

File tree

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

Lines changed: 196 additions & 51 deletions
Large diffs are not rendered by default.

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
from starkware.cairo.common.cairo_builtins import HashBuiltin
44
from starkware.cairo.common.math import assert_not_zero
5-
from starkware.starknet.common.syscalls import call_contract
5+
from starkware.starknet.common.syscalls import call_contract, library_call
66

77
// Scenarios.
88
// The RETURN scenario *must* be zero, as the zero value also indicates end of scenario stream.
99
const SCENARIO_RETURN = 0;
1010
const SCENARIO_CALL = 1;
11+
const SCENARIO_LIBRARY_CALL = 2;
1112

1213
// selector_from_name("pop_front").
1314
const POP_FRONT_SELECTOR = 0x289c2d7d6351cd03d4f928bde75fa14d5f52e32bdbc750d5296e1b48c12f1c3;
@@ -105,6 +106,22 @@ func test_revert_fuzz{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_chec
105106
tempvar range_check_ptr = range_check_ptr;
106107
}
107108

109+
if (scenario == SCENARIO_LIBRARY_CALL) {
110+
library_call(
111+
class_hash=pop_front(orchestrator),
112+
function_selector=FUZZ_TEST_SELECTOR,
113+
calldata_size=0,
114+
calldata=new(),
115+
);
116+
tempvar syscall_ptr = syscall_ptr;
117+
tempvar pedersen_ptr = pedersen_ptr;
118+
tempvar range_check_ptr = range_check_ptr;
119+
} else {
120+
tempvar syscall_ptr = syscall_ptr;
121+
tempvar pedersen_ptr = pedersen_ptr;
122+
tempvar range_check_ptr = range_check_ptr;
123+
}
124+
108125
test_revert_fuzz();
109126
return ();
110127
}

0 commit comments

Comments
 (0)