Skip to content

test: add fuzzing harness and fee-payer property tests - #618

Merged
dev-jodee merged 3 commits into
mainfrom
test/kora-fuzzing
Jul 30, 2026
Merged

test: add fuzzing harness and fee-payer property tests#618
dev-jodee merged 3 commits into
mainfrom
test/kora-fuzzing

Conversation

@dev-jodee

Copy link
Copy Markdown
Collaborator

Summary

  • Add a standalone cargo-fuzz workspace (fuzz/) with two libFuzzer targets over Kora's untrusted transaction-input paths: parse_transaction (bytes → VersionedTransaction → the get_or_parse_* instruction parsers) and decode_b64_transaction (the RPC base64 decode entry point).
  • Add a proptest fee-payer drain invariant across the System-program policy matrix: the fee payer is gated in a role exactly when its policy flag is off, and non-fee-payer actors are never gated. Targets the pure, RPC-free validate_fee_payer_usage.
  • Raise kora-lib recursion_limit to 256 so the cargo-fuzz sanitizer build compiles (an async-block layout query overflows the default 128; harmless for normal builds).
  • Add just fuzz / fuzz-build / fuzz-list recipes and a fuzz/README.md.

Why not Crucible

Crucible fuzzes on-chain sBPF via LiteSVM edge tracing. Kora's validator, fee-payer policy, and instruction parsers are native off-chain Rust, so Crucible yields no coverage signal there. cargo-fuzz (byte-level) + proptest (structural invariants) fit the native surface.

Test Plan

  • cargo test -p kora-lib --lib fee_payer_policy_props — 512 cases pass.
  • cargo install cargo-fuzz && just fuzz-build — both targets build under the sanitizer.
  • just fuzz parse_transaction / just fuzz decode_b64_transaction — smoke-ran ~158k / ~122k executions at ~7.8k exec/s, no crashes.

Notes

  • fuzz/ is its own workspace so sanitizer RUSTFLAGS don't leak into the main build; target/, corpus/, artifacts/ are gitignored.
  • Follow-ups (not in this PR): extend the property test to SPL / Token-2022 roles, and add an economic-invariant property (max_allowed_lamports never exceeded) using the RPC mock harness.

Cover Kora's untrusted transaction-input paths with coverage-guided
fuzzing and property-based tests.

- fuzz/: standalone cargo-fuzz workspace with parse_transaction and
  decode_b64_transaction libFuzzer targets over the decode/parse path
- proptest fee-payer drain invariant across the System-program policy
  matrix in the kora-lib validator tests
- raise kora-lib recursion_limit to 256 so the sanitizer build compiles
- justfile fuzz / fuzz-build / fuzz-list recipes
Comment thread fuzz/fuzz_targets/parse_transaction.rs
Comment thread crates/lib/src/validator/transaction_validator.rs Outdated
@greptile-apps

greptile-apps Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds native transaction fuzzing and strengthens fee-payer policy property testing.

  • Adds standalone cargo-fuzz targets for transaction parsing and base64 decoding.
  • Adds property tests covering System-program fee-payer roles, including both CreateAccount account positions.
  • Adds fuzzing recipes, documentation, dependencies, and the compiler recursion-limit adjustment required by sanitizer builds.

Confidence Score: 4/5

The PR appears safe to merge, although the previously reported lookup-table fuzz coverage gap remains.

The CreateAccount property-test omission has been fixed, while the parser fuzz target still uses a static-key-only constructor that returns before parsing lookup-table-backed instructions; this limits test coverage but does not alter production behavior.

Files Needing Attention: fuzz/fuzz_targets/parse_transaction.rs

Important Files Changed

Filename Overview
fuzz/fuzz_targets/parse_transaction.rs Adds parser fuzzing, but the previously reported lookup-table coverage gap remains outstanding.
fuzz/fuzz_targets/decode_b64_transaction.rs Exercises the RPC transaction decoder with arbitrary lossy UTF-8 strings.
crates/lib/src/validator/transaction_validator.rs The updated property generator now independently exercises fee-payer use in both CreateAccount roles.
fuzz/Cargo.toml Defines an isolated cargo-fuzz workspace and both fuzz binaries.
justfile Adds recipes for running, building, and listing fuzz targets.

Reviews (3): Last reviewed commit: "test: cover fee-payer-as-new-account in ..." | Re-trigger Greptile

Add a module doc for the fee-payer policy property test and align the
proptest requirement with the already-resolved latest stable (1.11.0).
validate_fee_payer_usage gates CreateAccount on both the payer and the
new-account slot. The property test only placed the fee payer in the
payer slot, so a regression in new-account gating went undetected. Split
the role so both independently-gated positions are exercised.
@dev-jodee
dev-jodee requested a review from amilz July 30, 2026 13:04
@dev-jodee
dev-jodee merged commit 9f5fcaf into main Jul 30, 2026
22 checks passed
@dev-jodee
dev-jodee deleted the test/kora-fuzzing branch July 30, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants