Skip to content

Commit

Permalink
make our fuzzer infra run bolero fuzzers instead of cargo-fuzz fuzze…
Browse files Browse the repository at this point in the history
…rs (#9603)

Note that this should not land before #9602, as our bolero fuzzers will
not be ready before that.

However, this is a separate PR, as it touches the CI pipeline and thus
will probably need handholding in order to land.
  • Loading branch information
Ekleog-NEAR authored Nov 1, 2023
2 parents da8393b + cedc3f5 commit 5ce82b3
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 261 deletions.
1 change: 0 additions & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ steps:
python3 scripts/check_nightly.py
python3 scripts/check_pytests.py
python3 scripts/check_fuzzing.py
python3 scripts/fix_nightly_feature_flags.py
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ jobs:

- run: python3 scripts/check_nightly.py
- run: python3 scripts/check_pytests.py
- run: python3 scripts/check_fuzzing.py

- run: python3 scripts/fix_nightly_feature_flags.py

Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/master_fuzzer_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ jobs:
sudo mkswap $SWAP_FILE
sudo swapon $SWAP_FILE
- name: Install cargo fuzz subcommand crate
run: cargo install cargo-fuzz
- uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941
with:
crate: cargo-bolero

- run: rustup target add --toolchain nightly wasm32-unknown-unknown

Expand All @@ -47,6 +48,8 @@ jobs:

- uses: actions/checkout@master

- run: pip install -r scripts/build_fuzzers_requirements.txt

- run: python3 scripts/build_fuzzers.py ${{ github.ref_name }}
- name: "Compile fuzzers and upload to GCS"
- run: |
NAME="nearcore-${{ github.ref_name }}-$(env TZ=Etc/UTC date +"%Y%m%d%H%M%S")"
cargo +nightly bolero build-clusterfuzz --all-features --profile fuzz
gsutil cp -Z target/fuzz/clusterfuzz.tar "gs://fuzzer_targets/${{ github.ref_name }}/$NAME.tar.gz"
19 changes: 12 additions & 7 deletions .github/workflows/ondemand_fuzzer_binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ jobs:
sudo mkswap $SWAP_FILE
sudo swapon $SWAP_FILE
- name: Install cargo fuzz subcommand crate
run: cargo install cargo-fuzz
- uses: baptiste0928/cargo-install@21a18ba3bf4a184d1804e8b759930d3471b1c941
with:
crate: cargo-bolero

- run: rustup target add --toolchain nightly wasm32-unknown-unknown

Expand All @@ -69,16 +70,20 @@ jobs:
with:
ref: ${{ github.event.inputs.branch_ref }}

- run: pip install -r scripts/build_fuzzers_requirements.txt

- name: Build Release branch fuzz targets
if: ${{ github.event.action == 'released'}}
run: python3 scripts/build_fuzzers.py release
run: echo "branch_type=release" >> "$GITHUB_ENV"

- name: Build RC branch fuzz targets
if: ${{ github.event.action == 'prereleased'}}
run: python3 scripts/build_fuzzers.py rc
run: echo "branch_type=rc" >> "$GITHUB_ENV"

- name: Build fuzz targets from ${{ github.event.inputs.branch_ref }}" branch
if: ${{ github.event_name == 'workflow_dispatch'}}
run: python3 scripts/build_fuzzers.py ${{ github.event.inputs.branch_type }}
run: echo "branch_type=${{ github.event.inputs.branch_type }}" >> "$GITHUB_ENV"

- name: "Compile fuzzers and upload to GCS"
- run: |
NAME="nearcore-$branch_type-$(env TZ=Etc/UTC date +"%Y%m%d%H%M%S")"
cargo +nightly bolero build-clusterfuzz --all-features --profile fuzz
gsutil cp -Z target/fuzz/clusterfuzz.tar "gs://fuzzer_targets/$branch_type/$NAME.tar.gz"
11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ bencher = "0.1.5"
bitflags = "1.2"
blake2 = "0.9.1"
bn = { package = "zeropool-bn", version = "0.5.11" }
# TODO: revert to upstream bolero once https://github.com/camshaft/bolero/pull/186 lands and gets released
bolero = { version = "0.9.0", git = "https://github.com/camshaft/bolero", rev = "7d955a67fbd06f61ffaf28178e976280c33c045a", features = [
"arbitrary",
] }
bolero = { version = "0.10.0", features = ["arbitrary"] }
borsh = { version = "1.0.0", features = ["derive", "rc"] }
bs58 = "0.4"
bytes = "1"
Expand Down Expand Up @@ -397,6 +394,12 @@ inherits = "release"
lto = false
codegen-units = 16

# Used for fuzzing, LTO is ill-supported as of 2023-09 and so should not be enabled.
[profile.fuzz]
inherits = "dev"
opt-level = 3
incremental = false
codegen-units = 1

# Compile some dependencies with optimizations to speed up tests.
[profile.dev.package.hex]
Expand Down
52 changes: 0 additions & 52 deletions nightly/fuzz.toml

This file was deleted.

74 changes: 0 additions & 74 deletions scripts/build_fuzzers.py

This file was deleted.

1 change: 0 additions & 1 deletion scripts/build_fuzzers_requirements.txt

This file was deleted.

116 changes: 0 additions & 116 deletions scripts/check_fuzzing.py

This file was deleted.

0 comments on commit 5ce82b3

Please sign in to comment.