Skip to content

Commit

Permalink
Better json generation (#1356)
Browse files Browse the repository at this point in the history
* Generate program with

* Simplify fuzz_json

* Fuzz config

* Test more args

* Declare STEPS_LIMIT; derive Clone

* Implement location arbitrary by hand

* Implement arbitrary by hand

* Use raw bytes for fuzz_json

* Specify arbitrary for CairoConfig

* Use  and  for json programs

* Add words to dict

* Run carg fix

* Remove unused crates

* Remove unused crates

* Reduce likeliness of programs triggering parsing errors

* Order crates and test input

* Clean comments

* Add hint code

* Make arbitrary location generation better

* Clean Cargo.toml

* Remove testing code

* Avoid serializing if None

* Update fuzzer.yml

* Run cargo fmt

* Run cargo fmt

---------

Co-authored-by: Juanma <[email protected]>
Co-authored-by: juan.mv <[email protected]>
  • Loading branch information
3 people committed Aug 10, 2023
1 parent e763cef commit fced122
Show file tree
Hide file tree
Showing 6 changed files with 386 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/fuzzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Initializing fuzzer with previous inputs
run: |
cd fuzzer
HFUZZ_RUN_ARGS="--dict=json.dict --run_time 10800 --timeout 60 -T" cargo hfuzz run fuzz_json
HFUZZ_RUN_ARGS="--dict=json.dict --run_time 10800 --timeout 60" cargo hfuzz run fuzz_json
# run the fuzzer with minimize to reduce inputs
- name: Initializing fuzzer with minimize
Expand Down
15 changes: 9 additions & 6 deletions fuzzer/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions fuzzer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ honggfuzz = "0.5.55"
libfuzzer-sys = "0.4"
cairo-vm = { path = "../vm", features = ["arbitrary"] }
cairo-felt = { path = "../felt", features = ["arbitrary"] }
serde = { version = "1.0.180", features = ["derive"] }
serde_json = "1.0.104"

[[bin]]
name = "fuzz_json"
Expand Down
Loading

1 comment on commit fced122

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.30.

Benchmark suite Current: fced122 Previous: e763cef Ratio
add_u64_with_felt/1 3 ns/iter (± 0) 2 ns/iter (± 0) 1.50
add_u64_with_felt/2 3 ns/iter (± 0) 2 ns/iter (± 0) 1.50
add_u64_with_felt/6 3 ns/iter (± 0) 2 ns/iter (± 0) 1.50
add_u64_with_felt/7 3 ns/iter (± 0) 2 ns/iter (± 0) 1.50
build runner 1792 ns/iter (± 104) 1327 ns/iter (± 1) 1.35
parse program 26099777 ns/iter (± 1327201) 18378123 ns/iter (± 82759) 1.42

This comment was automatically generated by workflow using github-action-benchmark.

CC: @unbalancedparentheses

Please sign in to comment.