Skip to content

Commit 1d9e737

Browse files
starknet_os_flow_tests: fuzz test emit event scenario
1 parent c5906e9 commit 1d9e737

10 files changed

Lines changed: 4938 additions & 3936 deletions

File tree

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

Lines changed: 445 additions & 157 deletions
Large diffs are not rendered by default.

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ const SCENARIO_KECCAK = 12;
2929
const SCENARIO_CALL_UNDEPLOYED = 13;
3030
const SCENARIO_CALL_NON_EXISTING_ENTRY_POINT = 14;
3131
const SCENARIO_LIBRARY_CALL_NON_EXISTING_ENTRY_POINT = 15;
32+
const SCENARIO_EMIT_EVENT = 16;
3233

3334
// selector_from_name("pop_front").
3435
const POP_FRONT_SELECTOR = 0x289c2d7d6351cd03d4f928bde75fa14d5f52e32bdbc750d5296e1b48c12f1c3;
@@ -41,6 +42,10 @@ func orchestrator_address() -> (address: felt) {
4142
func counter() -> (value: felt) {
4243
}
4344

45+
@event
46+
func FuzzEvent(value: felt) {
47+
}
48+
4449
/// If this contract is deployed as part of the fuzz test "deploy" scenario, the orchestrator
4550
/// address must be provided (the fuzz test will run automatically). Otherwise, deploy with [0] as
4651
/// args.
@@ -244,6 +249,13 @@ func test_revert_fuzz{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_chec
244249
return ();
245250
}
246251

252+
if (scenario == SCENARIO_EMIT_EVENT) {
253+
let value = pop_front(orchestrator);
254+
FuzzEvent.emit(value);
255+
test_revert_fuzz();
256+
return ();
257+
}
258+
247259
with_attr error_message("Unknown scenario: {scenario}.") {
248260
assert 1 = 0;
249261
}

0 commit comments

Comments
 (0)