Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[workspace]
members = ["protocol", "protocol/fuzz", "traffic"]
default-members = ["protocol", "traffic"]
members = ["protocol", "traffic"]
exclude = ["fuzz"]
resolver = "2"
File renamed without changes.
2 changes: 1 addition & 1 deletion protocol/fuzz/Cargo.toml → fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cargo-fuzz = true

[dependencies]
libfuzzer-sys = "0.4"
bip324 = { path = ".." }
bip324 = { path = "../protocol" }
rand = "0.8"
secp256k1 = "0.29"

Expand Down
File renamed without changes.
24 changes: 9 additions & 15 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Every commit on the master branch is expected to have working `check` and `test-*` recipes.
#
# The recipes make heavy use of `rustup`'s toolchain syntax (e.g. `cargo +nightly`). `rustup` is
# required on the system in order to intercept the `cargo` commands and to install and use the appropriate toolchain with components.
# required on the system in order to intercept the `cargo` commands and to install and use the appropriate toolchain with components.
#
# The root directory of this workspace is "virtual", it has no source code itself, just a holder of crates. This means
# the cargo commands generally run on all the child crates by default without the `--workspace` flag.
Expand Down Expand Up @@ -36,12 +36,12 @@ STABLE_TOOLCHAIN := "1.88.0"
# Adding --fix flag to apply suggestions with --allow-dirty.
cargo +{{NIGHTLY_TOOLCHAIN}} clippy --all-features --all-targets --fix --allow-dirty -- -D warnings

# Run a test suite: features, msrv, constraints, no-std, or all.
# Run a test suite: features, msrv, constraints, no-std, fuzz, or all.
@test suite="features":
just _test-{{suite}}

# Run all test suites.
@_test-all: _test-features _test-msrv _test-constraints _test-no-std
@_test-all: _test-features _test-msrv _test-constraints _test-no-std _test-fuzz

# Test library with feature flag matrix compatability.
@_test-features:
Expand All @@ -68,7 +68,7 @@ STABLE_TOOLCHAIN := "1.88.0"
# Clear any previously resolved versions and re-resolve to the minimums.
rm -f Cargo.lock
cargo +{{NIGHTLY_TOOLCHAIN}} check --all-features -Z direct-minimal-versions
# Clear again and check the maximums by ignoring any rust-version caps.
# Clear again and check the maximums by ignoring any rust-version caps.
rm -f Cargo.lock
cargo +{{NIGHTLY_TOOLCHAIN}} check --all-features --ignore-rust-version
rm -f Cargo.lock
Expand All @@ -78,21 +78,15 @@ STABLE_TOOLCHAIN := "1.88.0"
cargo install [email protected]
$HOME/.cargo/bin/cross build --package bip324 --target thumbv7m-none-eabi --no-default-features

# Check that fuzz targets compile.
@_test-fuzz:
cargo install [email protected]
cargo +{{NIGHTLY_TOOLCHAIN}} fuzz build

# Run benchmarks.
@bench:
cargo +{{NIGHTLY_TOOLCHAIN}} bench --package bip324 --bench cipher_session

# Run fuzz target: receive_key or receive_garbage.
@fuzz target seconds:
rustup component add --toolchain {{NIGHTLY_TOOLCHAIN}} llvm-tools-preview
cargo install [email protected]
# Generate new test cases and add to corpus. Bumping length for garbage.
cd protocol && cargo +{{NIGHTLY_TOOLCHAIN}} fuzz run {{target}} -- -max_len=5120 -max_total_time={{seconds}}
# Measure coverage of corpus against code.
cd protocol && cargo +{{NIGHTLY_TOOLCHAIN}} fuzz coverage {{target}}
# Generate HTML coverage report.
protocol/fuzz/coverage.sh {{NIGHTLY_TOOLCHAIN}} {{target}}

# Add a release tag and publish to the upstream remote. Requires write privileges.
@tag crate version remote="upstream":
# Guardrails: on a clean main with updated changelog and manifest.
Expand Down
44 changes: 0 additions & 44 deletions protocol/fuzz/coverage.sh

This file was deleted.