Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add fuzz jobs #3662

Draft
wants to merge 31 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
ed776d5
init a fuzz target with cargo-fuzz
tzemanovic Jun 26, 2024
3b3bc44
tx: impl Arbitrary for Tx
tzemanovic Jun 26, 2024
e50d693
fuzz mempool with arb txs
tzemanovic Jun 26, 2024
a1e5fc4
Makefile: add `cargo-fuzz` dep and `fuzz-txs-mempool` recipe
tzemanovic Jun 28, 2024
952d3a2
node/init_chain: no wasm pre-compile for fuzzing
tzemanovic Jul 1, 2024
4b9a613
fuzz: set dev opt-level = 3
tzemanovic Jul 1, 2024
c0a4ffe
fuzz_txs_mempool: re-use TestShell between runs
tzemanovic Jul 1, 2024
4ef8594
core/key: fix arbitrary impls
tzemanovic Jul 2, 2024
c94a2f5
tx: fix manual impl Arbitrary for Section
tzemanovic Jul 2, 2024
bf39d55
shell/mempool: skip chain ID check for fuzzing
tzemanovic Jul 3, 2024
5b03693
make/fuzz-txs-mempool: run with `--dev` to avoid OOM
tzemanovic Jul 12, 2024
d9f7a5d
tx: add arbitrary masp tx section
tzemanovic Jul 12, 2024
24754f1
tx: add non-panicking serialization method
tzemanovic Jul 12, 2024
9ba0cf1
fuzz_txs_mempool: use non-panicking tx serialization method
tzemanovic Jul 12, 2024
b00fd08
fuzz_txs_mempool: catch panics in serialization
tzemanovic Jul 12, 2024
12c6707
use updated jubjub that prevents invalid arb ExtendedPoint
tzemanovic Jul 12, 2024
7109967
impl Arbitrary for MaspBuilder to derive tx sections
tzemanovic Jul 16, 2024
dad2536
fuzz_txs_mempool: rm unused import
tzemanovic Jul 16, 2024
b1db22f
tx: prevent overflow in arbitrary masp builder
tzemanovic Jul 16, 2024
559cb2d
fix clippy
tzemanovic Jul 16, 2024
1e6fb5f
fuzz: use a shorter target name
tzemanovic Jul 16, 2024
bd8f414
fuzz: add txs_prepare_proposal
tzemanovic Jul 16, 2024
a67f6db
prepare_proposal: make tx fee checks pass for fuzzing
tzemanovic Jul 17, 2024
cfae523
token: avoid trying to read denom when fuzzing
tzemanovic Jul 18, 2024
0762355
fuzz: add README.md
tzemanovic Jul 18, 2024
1939f38
fuzz: add txs_process_proposal
tzemanovic Jul 18, 2024
4fcb25b
add conditional fuzzing sig acceptance at lower level
tzemanovic Jul 23, 2024
d06f4cc
fuzz: add txs_finalize_block target
tzemanovic Jul 24, 2024
0d57648
fuzz: add txs_wasm_run
tzemanovic Jul 30, 2024
a7866bf
changelog: add #3445
tzemanovic Aug 16, 2024
c8cc6e3
ci: add fuzzing jobs
Fraccaman Aug 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changelog/unreleased/testing/3445-fuzz-tx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Added fuzz testing targets for txs in mempool, block proposals and finalize
block. ([\#3445](https://github.com/anoma/namada/pull/3445))
82 changes: 82 additions & 0 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Fuzz 🪲

on:
schedule:
- cron: "0 0 * * *"

env:
RUSTC_WRAPPER: sccache
SCCACHE_S3_USE_SSL: false
GIT_LFS_SKIP_SMUDGE: 1
CARGO_INCREMENTAL: 0
RUST_BACKTRACE: full
CACHE_BUCKET: github-runners-remote-cache-shared
SCCACHE_BUCKET: github-runners-remote-cache-shared
AWS_REGION: us-west-2
NIGHTLY: nightly-2024-05-15
NAMADA_MASP_PARAMS_DIR: /masp/.masp-params

jobs:
fuzz:
container:
image: ghcr.io/heliaxdev/namada-ci:namada-main
runs-on: [self-hosted, 16vcpu-32ram-ubuntu22-namada-x86]
timeout-minutes: 300
strategy:
fail-fast: false
matrix:
fuzz:
- command: txs-mempool
- command: txs-prepare-proposal
- command: txs-process-proposal
- command: txs-finalize-block
- command: txs-wasm-run

steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: main
- name: Configure AWS
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ secrets.AWS_ROLE }}
- name: Cache cargo
id: cache
uses: runs-on/cache@v4
env:
RUNS_ON_S3_BUCKET_CACHE: ${{ env.CACHE_BUCKET }}
with:
path: /usr/local/cargo
key: /cache/${{ runner.os }}-${{ github.job }}-${{ hashFiles('**/Cargo.lock') }}
- name: Start sccache server
id: sccache
run: sccache --start-server
- name: Run fuzzing target fuzz-${{ matrix.fuzz.command }}
run: make fuzz-${{ matrix.fuzz.command }}
env:
RUSTFLAGS: "-C linker=clang -C debug_assertions=true -C link-arg=-fuse-ld=/usr/local/bin/mold"
- name: Generate coverage report
run: |
cargo +$(cat rust-nightly-version) fuzz coverage ${{ github.fuzz.command }} --dev
RUST_TOOLCHAIN_SYSROOT=$(rustc +$(cat rust-nightly-version) --print sysroot)
$RUST_TOOLCHAIN_SYSROOT/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov \
show \
target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/debug/txs_mempool \
--format=html \
--ignore-filename-regex="(/rustc|\.cargo)" \
-Xdemangler=rustfilt \
-instr-profile=fuzz/coverage/txs_mempool/coverage.profdata \
> index.html
- name: Upload coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report-${{ github.event.pull_request.head.sha || github.sha }}
path: index.html
- name: Clean cargo cache
if: steps.cache.outputs.cache-hit != 'true'
run: cargo cache --autoclean-expensive
- name: Stop sccache
if: always() && steps.sccache.conclusion == 'success'
run: sccache --stop-server || true
Loading
Loading