Skip to content
Draft
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
5 changes: 5 additions & 0 deletions TESTING_EVIDENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ Coverage policy consistency check passed (threshold: 95%)
- `artifacts/fuzz_aspec_verify.log`
- `artifacts/fuzz_etl_read_entry.log`
- `artifacts/fuzz_structured_claim_validate.log`
- `artifacts/fuzz_ledger_ops.log`
- `artifacts/fuzz_oracle_roundtrip.log`
- `artifacts/fuzz_etl_ops.log`
- `artifacts/fuzz_probe_detector.log`
- `artifacts/fuzz_daemon_decode_limits.log`

## Gates

Expand Down
9 changes: 9 additions & 0 deletions fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# cargo-fuzz build artifacts
target/
# Crash/timeout artifacts produced by libfuzzer
artifacts/
# Fuzzing corpus (may contain large inputs; not needed in source control)
corpus/
# Cargo.lock is intentionally excluded here; reproducibility is handled by
# the workspace-level Cargo.lock
Cargo.lock
2 changes: 2 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ edition = "2021"
[package.metadata]
cargo-fuzz = true

[workspace]

[dependencies]
libfuzzer-sys = "0.4"
evidenceos-core = { path = "../crates/evidenceos-core" }
Expand Down
10 changes: 5 additions & 5 deletions fuzz/fuzz_targets/fuzz_ledger_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fuzz_target!(|data: &[u8]| {
.map(|l| l.with_budgets(input.k_budget, input.access_budget))
.unwrap_or_else(|_| ConservationLedger::new(0.5).expect("fixed alpha must be valid"));

let mut frozen = ledger.frozen;
let mut frozen = ledger.is_frozen();
for op in input.ops {
let result = match op {
Op::ChargeAll {
Expand All @@ -69,9 +69,9 @@ fuzz_target!(|data: &[u8]| {
frozen = true;
}

assert!(ledger.k_bits_total >= 0.0 || ledger.k_bits_total.is_nan());
assert!(ledger.access_credit_spent >= 0.0 || ledger.access_credit_spent.is_nan());
assert!(ledger.wealth.is_finite());
assert!(ledger.wealth > 0.0 || ledger.wealth == 0.0);
assert!(ledger.k_bits_total() >= 0.0 || ledger.k_bits_total().is_nan());
assert!(ledger.access_credit_spent() >= 0.0 || ledger.access_credit_spent().is_nan());
assert!(ledger.wealth().is_finite());
assert!(ledger.wealth() >= 0.0);
}
});
9 changes: 9 additions & 0 deletions fuzz/rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2026 Joseph Verdicchio and EvidenceOS Contributors
# SPDX-License-Identifier: Apache-2.0
#
# cargo-fuzz requires nightly for -Z flags (sanitizers, fuzzing instrumentation).
# This override is scoped to the fuzz/ sub-crate only.

[toolchain]
channel = "nightly"
profile = "minimal"
5 changes: 4 additions & 1 deletion scripts/test_evidence.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ mkdir -p artifacts target
: > artifacts/fuzz_oracle_roundtrip.log
: > artifacts/fuzz_etl_ops.log
: > artifacts/fuzz_probe_detector.log
: > artifacts/fuzz_daemon_decode_limits.log

trap 'echo "[FAIL] stage=$CURRENT_STAGE" | tee -a artifacts/test_output.txt' ERR

Expand Down Expand Up @@ -108,6 +109,7 @@ fi
cargo +nightly fuzz run fuzz_oracle_roundtrip -- -max_total_time=30 2>&1 | tee artifacts/fuzz_oracle_roundtrip.log
cargo +nightly fuzz run fuzz_etl_ops -- -max_total_time=30 2>&1 | tee artifacts/fuzz_etl_ops.log
cargo +nightly fuzz run fuzz_probe_detector -- -max_total_time=30 2>&1 | tee artifacts/fuzz_probe_detector.log
cargo +nightly fuzz run fuzz_daemon_decode_limits -- -max_total_time=30 2>&1 | tee artifacts/fuzz_daemon_decode_limits.log
else
echo "skipped (strict CI disabled or dependency resolution unavailable)" | tee artifacts/fuzz_aspec_verify.log
echo "skipped (strict CI disabled or dependency resolution unavailable)" | tee artifacts/fuzz_etl_read_entry.log
Expand All @@ -116,6 +118,7 @@ fi
echo "skipped (strict CI disabled or dependency resolution unavailable)" | tee artifacts/fuzz_oracle_roundtrip.log
echo "skipped (strict CI disabled or dependency resolution unavailable)" | tee artifacts/fuzz_etl_ops.log
echo "skipped (strict CI disabled or dependency resolution unavailable)" | tee artifacts/fuzz_probe_detector.log
echo "skipped (strict CI disabled or dependency resolution unavailable)" | tee artifacts/fuzz_daemon_decode_limits.log
fi
} 2>&1 | tee -a artifacts/test_output.txt

Expand All @@ -131,6 +134,6 @@ if [[ -n "$ignored" ]]; then
fi
fi

for f in artifacts/test_output.txt artifacts/coverage.lcov artifacts/clippy-report.txt artifacts/fuzz_aspec_verify.log artifacts/fuzz_etl_read_entry.log artifacts/fuzz_structured_claim_validate.log artifacts/fuzz_ledger_ops.log artifacts/fuzz_oracle_roundtrip.log artifacts/fuzz_etl_ops.log artifacts/fuzz_probe_detector.log artifacts/scenarios/summary.json; do
for f in artifacts/test_output.txt artifacts/coverage.lcov artifacts/clippy-report.txt artifacts/fuzz_aspec_verify.log artifacts/fuzz_etl_read_entry.log artifacts/fuzz_structured_claim_validate.log artifacts/fuzz_ledger_ops.log artifacts/fuzz_oracle_roundtrip.log artifacts/fuzz_etl_ops.log artifacts/fuzz_probe_detector.log artifacts/fuzz_daemon_decode_limits.log artifacts/scenarios/summary.json; do
[[ -s "$f" ]] || { echo "missing required artifact: $f"; exit 1; }
done