Skip to content
Open
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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Deterministic fuzz / property suite for share↔asset conversion, BPS
(fee/rate) bounds, overflow rejection, and deposit/withdraw conservation
(`src/fuzz.rs`, issue #74). Fixed seed `FUZZ_SEED`; failures report seed
and minimized inputs for CI-reproducible counterexamples.

### Changed

- Aggregate totals (`total_shares`, `total_assets`, user balances) now use
Expand Down
32 changes: 27 additions & 5 deletions docs/property-tests.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,31 @@
# Property Tests

This note documents the **property-tests** of the yieldvault-contract contract.
Deterministic fuzz / property coverage for the YieldVault math and state
transitions lives in `src/fuzz.rs` (issue #74).

yieldvault-contract is a Soroban smart contract on the Stellar network. This page is part of the
project's reference documentation and describes the property-tests in detail, covering the relevant
entrypoints, storage layout, and invariants where applicable.
## Harness

See the README and the sources under src/ for the authoritative implementation.
- Fixed seed: `fuzz::FUZZ_SEED` (`0x0059_5646_3734_2026`).
- PRNG: Numerical Recipes LCG; same seed → same inputs in CI.
- On failure, assertions include `seed`, label, and minimized inputs so a
regression fixture can be cut without re-searching.

## Invariants covered

| Suite | Property |
| --- | --- |
| `fuzz_mul_div_floor_or_safe_reject` | Floored `a*b/d`, or `DivisionByZero` / `MathOverflow` |
| `fuzz_convert_round_trip_conserves_value` | assets→shares→assets never mints value |
| `fuzz_convert_shares_round_trip_conserves` | shares→assets→shares never inflates shares |
| `fuzz_convert_to_shares_monotonic` | more assets ⇒ ≥ shares (fixed vault state) |
| `fuzz_convert_to_assets_monotonic` | more shares ⇒ ≥ assets |
| `fuzz_share_fraction_bps_bounded` | holder ≤ total shares ⇒ fraction ≤ `bps` (fee/rate bound) |
| `fuzz_price_per_share_monotonic_in_assets` | more assets ⇒ ≥ price per share |
| `fuzz_empty_vault_bootstrap_and_zero_totals` | empty-vault 1:1 bootstrap / zero redeem |
| `fuzz_regression_fixtures_overflow_and_bounds` | pinned overflow, floor, and 100% BPS edges |
| `fuzz_vault_deposit_withdraw_conserves_under_yield` | full redeem ≤ deposit + yield (solo depositor) |

No invariant is weakened to obtain a green run. Existing example-based tests
in `src/test.rs` remain the readable regression layer alongside this suite.

See the README and the sources under `src/` for the authoritative implementation.
Loading