diff --git a/CHANGE.md b/CHANGE.md index 51029c9..9c9eb83 100644 --- a/CHANGE.md +++ b/CHANGE.md @@ -1,384 +1,9 @@ -# SplitStream Core — Changes Since the Drips Wave Rejection +# SplitStream Core — Explanation of Changes -This document is the technical evidence package for the **Appeal** on our rejected -repository. It records what was wrong with the submission, what was changed, and how -every claim below can be re-verified from a clean checkout. +This document explains, in plain prose, what was changed in `SplitStream-Labs/splitstream-core` after the repository was rejected from the Stellar Wave program (Drips Wave), and why. The rejection was relayed to us internally as the instruction to "rebase this project fully on Soroban," so the first thing we did was verify that premise rather than act on it. The repository at the rejected baseline commit (`226fa4e`) was already a native Soroban project: it compiled against `soroban-sdk` 28.0.0, targeted `wasm32v1-none`, used `#[contract]`, `#[contractimpl]`, `#[contracttype]` and `#[contracterror]`, moved value through the SEP-41 `token::TokenClient`, and used Soroban's instance/persistent storage split with explicit `extend_ttl` management. There is no EVM contract, no second chain, and no porting layer to migrate away from, so no chain migration was possible or performed. We therefore treated the rejection as a code-quality and credibility problem and spent the effort on the risks that actually exist for a Soroban contract holding funds — correctness and solvency defects, plus a repository whose documentation did not match its own dependency versions. If the original rejection rested on a different, more specific concern, the changes below are substantive either way: four real defects were found and fixed, each with a regression test that fails against the rejected revision. -Repository: `SplitStream-Labs/splitstream-core` -Program applied to: Stellar Wave Program (Drips Wave) -Baseline commit: `226fa4e` (`main` at time of rejection) +The most serious defect was that `execute_sweep` moved an admin-requested amount without any awareness of the contract's outstanding obligations, so the admin could drain pull-payment balances already credited to contributors and unvested amounts already owned under vesting schedules; the 72-hour timelock only delayed that drain, and affected contributors would later fail at the token transfer on `withdraw` or `claim_vested` with no on-chain recovery path. The vault now maintains an explicit liability ledger in instance storage — `CreditedTotal`, the sum of all outstanding contributor balances, and `VestingReserved`, the outstanding `sum(total - claimed)` vesting liability — updated transactionally alongside the per-account writes they track via `storage::add_balance`, `storage::take_balance` and `storage::adjust_vesting_reserved`, so the two cannot drift apart. `execute_sweep` now computes free funds as `balance(vault) - (CreditedTotal + VestingReserved)` and rejects anything larger with the new `InsufficientFreeFunds` (error 18), and three new read-only views (`get_total_credited`, `get_vesting_reserved`, `get_available_funds`) expose the same position. Second, `claim_vested` subtracted `schedule.claimed` from the vested amount with plain arithmetic while `create_vesting` preserved `claimed` across re-creation, so an admin could re-create a schedule with a smaller total than had already been paid, underflowing the subtraction; because the release profile sets `overflow-checks = true`, the wasm panicked and trapped, leaving the contributor's position permanently unclaimable with no explaining error. `create_vesting` now rejects `total < existing_claimed` with `InvalidAmount` (error 12), `claim_vested` uses `saturating_sub` so an already-corrupt schedule degrades to "nothing to claim" instead of trapping, and `claimed` is updated with `checked_add`. Third, `Admin`, `Oracle` and `Token` live in instance storage, yet only seven admin-gated functions bumped the instance TTL at the baseline and none of the intended-usage paths did — `deposit`, `post_cycle_root`, `credit_claim`, `withdraw`, `distribute_fixed`, `admin_distribute_fixed` and `claim_vested` — meaning a vault used exactly as designed would never refresh its TTL and would eventually become unreachable at every entry point, including read-only views. Every state-changing entry point now bumps it, and the docs state that as a rule rather than a per-function inventory. Fourth, `credit_claim` verified the Merkle proof and credited whatever amount it committed to without comparing the running total against `CycleInfo::total_amount`, so a compromised or buggy oracle could post a root summing above the total that maintainers reviewed during the challenge window; a new persistent counter `CycleClaimedTotal(cycle_id)` now caps cumulative claims and rejects over-payment with `CycleTotalExceeded` (error 19) before any state is written. Two smaller fixes round this out: `initialize` now checks whether it has already run before calling `require_auth`, so a second call reports `AlreadyInitialized` instead of an auth trap (the only intentional change to an existing function's observable behaviour, and it touches no successful path), and `withdraw` now uses a single `storage::take_balance` helper that zeroes the balance and decrements `CreditedTotal` together, keeping the checks-effects ordering and the liability bookkeeping as one operation. -**Live evidence:** the hardened contract is deployed and initialized on Testnet at -[`CB456KGXH4233BHW5BUEJMN6OJ4ZMWMPP3OXJU5HVQ2T2F7A7XHWLTAT`](https://stellar.expert/explorer/testnet/contract/CB456KGXH4233BHW5BUEJMN6OJ4ZMWMPP3OXJU5HVQ2T2F7A7XHWLTAT) -— this is a real deployment, not a screenshot. +All of this is verified rather than asserted, from a clean checkout with Rust stable and `stellar-cli` 28.1.0. The suite went from 36 tests at the rejected baseline to 44 passing tests, adding four example-based tests that each fail on the old code — `credited_balances_are_reserved_against_sweeps`, `vesting_liability_is_reserved_against_sweeps`, `claims_are_capped_at_the_posted_cycle_total`, and `vesting_recreate_below_claimed_is_rejected`, the last including the `total == claimed` boundary that must remain legal — plus four deterministic, dependency-free property tests in `contracts/vault/src/property_test.rs`, driven by a seeded xorshift64 PRNG whose seed is printed on failure. Those property tests walk 48 random manifests of 1–32 leaves to confirm every leaf verifies, a one-unit amount change fails, every single-sibling substitution fails, and proofs never transfer between contributors; and they walk 24 random `(total, duration, start)` vesting schedules through random ledgers to confirm claims equal `floor(total * elapsed / duration)` exactly, are monotonic, never exceed `total`, keep the stored liability equal to `total - claimed`, and preserve the solvency identity `balance(vault) == available + credited + vesting_reserved` at every step, including at random re-creations. `cargo fmt --all -- --check` and `cargo clippy --all-targets -- -D warnings` both exit clean, and `stellar contract build` produces a 22,606-byte `splitstream_vault.wasm`. The hardened contract is not a screenshot: it is deployed and initialized on Testnet at `CB456KGXH4233BHW5BUEJMN6OJ4ZMWMPP3OXJU5HVQ2T2F7A7XHWLTAT`, both transactions are confirmed on-ledger, and a post-deploy smoke test of `deposit(10_000_000)` returned `get_available_funds` of `10_000_000` with both liabilities zero and no fixed shares. The exported surface is now 22 functions, up from 19, the additions being the three read-only views. ---- - -## 1. First, a correction to the framing - -The review feedback that reached us was summarised internally as *"rebase this project -fully on Soroban."* We investigated before changing anything, and the finding is -important for the appeal: - -**This repository was already a native Soroban contract.** There is no other chain, no -EVM contract, and no porting layer to rebase away. At the baseline commit it already: - -- compiled against `soroban-sdk` 28.0.0 (`contracts/vault/Cargo.toml`); -- targeted `wasm32v1-none` and built a deployable contract artifact; -- used `#[contract]` / `#[contractimpl]` / `#[contracttype]` / `#[contracterror]`; -- moved value with the SEP-41 `token::TokenClient` (native XLM SAC on Testnet); -- used the Soroban instance/persistent storage split with explicit - `extend_ttl` TTL management. - -So we did not perform a chain migration. Instead we treated the rejection as a code -quality and credibility problem and spent the effort where the risk actually was: -**Soroban-specific correctness and security defects, and a repository whose docs did -not match its own dependency reality.** If the original rejection was based on a -different specific concern, please tell us which — the changes below are substantive -either way, and this document is structured so the relevant section can be quoted -directly into the appeal. - -The rest of this document is grouped by what a reviewer can independently check. - ---- - -## 2. Real defects that were found and fixed - -Every item below is a genuine bug in the rejected revision, not a refactor. The -baseline suite (36 tests) passed both before and after, which is precisely why these -were not caught: none of them was covered by a test. - -### 2.1 `execute_sweep` could strand funds the vault already owed - -**Severity: high. This was the most serious flaw.** - -`execute_sweep` transferred an admin-requested amount with no awareness of the -contract's outstanding obligations. A vault could be holding: - -- credited pull-payment `Balance` entries that contributors had not withdrawn yet, and -- unvested (but already owned) amounts under vesting schedules, - -and the admin could sweep all of it. The 72-hour timelock only delayed that drain; it -did not prevent it. Contributors' later `withdraw` / `claim_vested` calls would then -fail at the token transfer, with no on-chain way to recover. - -Our own `docs/for-maintainers.md` documented the hole as an operating hazard -("The sweep is not balance-aware"). Documenting a hazard is not fixing it. - -**Fix.** The vault now keeps an explicit liability ledger in instance storage: - -| Key | Meaning | -|---|---| -| `CreditedTotal` | sum of every outstanding `Balance(contributor)` | -| `VestingReserved` | outstanding vesting liability, `sum(total - claimed)` | - -They are maintained transactionally with the pack of balance writes they track -(`storage::add_balance`, `storage::take_balance`, `storage::adjust_vesting_reserved`), -so they cannot drift from the per-account entries. `execute_sweep` now computes - -``` -free = balance(vault) - (CreditedTotal + VestingReserved) -``` - -and rejects `amount > free` with the new `InsufficientFreeFunds` (error 18). A sweep -can only ever move money nobody is owed. Three new views expose the same numbers: -`get_total_credited`, `get_vesting_reserved`, `get_available_funds`. - -Tests: `test::solvency::credited_balances_are_reserved_against_sweeps`, -`test::solvency::vesting_liability_is_reserved_against_sweeps`. - -### 2.2 Vesting underflow / trap on schedule re-creation - -`claim_vested` computed `vested - schedule.claimed` with plain subtraction. Because -`create_vesting` preserves `claimed` across re-creation, an admin could re-create a -schedule with a **smaller** total than had already been paid out, leaving -`claimed > vested` and making the subtraction underflow. - -This is not a silent wrap: the workspace release profile sets -`overflow-checks = true`, so the wasm **panics and traps**. The contributor's vesting -position became permanently unclaimable until an admin re-created the schedule again, -with no error message explaining why. - -**Fix, two layers.** - -1. `create_vesting` rejects `total < existing_claimed` with `InvalidAmount` - (error 12), so the bad state can no longer be created. -2. `claim_vested` uses `saturating_sub` for `vested - claimed`, so a schedule that is - already in the bad state from the deployed revision degrades to "nothing new to - claim" (`Ok(0)`) instead of trapping. `claimed` is now also updated with - `checked_add`. - -Test: `test::fixed_vesting_sweep::vesting_recreate_below_claimed_is_rejected` -(including the boundary case `total == claimed`, which must remain legal). - -### 2.3 Instance TTL lapsed on the hot paths - -`Admin`, `Oracle` and `Token` all live in **instance** storage. At the baseline, only -seven admin-gated functions called `storage::bump_instance`; the busiest paths did not: - -`deposit`, `post_cycle_root`, `credit_claim`, `withdraw`, `distribute_fixed`, -`admin_distribute_fixed`, `claim_vested`. - -A vault used only for its intended purpose — deposit, post, claim, withdraw — would -therefore never refresh its instance TTL, and would eventually become **unreachable at -every entry point, including read-only views**. This is the Soroban equivalent of -losing the contract's keys through inactivity, and it is a classic mainnet failure -mode. Our own reference docs listed the omission as a table of which functions do and -do not bump, again treating a bug as a design note. - -**Fix.** Every state-changing entry point now bumps the instance TTL, and the docs -state the rule as a rule ("no hot path may skip the bump") instead of a per-function -inventory. - -### 2.4 Cumulative claims were not bounded by the posted total - -`credit_claim` verified a Merkle proof and credited whatever amount the proof -committed to, but never compared the running total against `CycleInfo::total_amount`. -A compromised or buggy oracle key could post a root whose leaves sum to more than the -`total_amount` it declared, and the vault would pay the excess. - -`total_amount` is the number maintainers review during the 24-hour challenge window, -so it needs to be the enforced ceiling, not a hint. - -**Fix.** New persistent counter `CycleClaimedTotal(cycle_id)`, updated in -`credit_claim`. A claim that would push the cumulative sum above `total_amount` is -rejected with the new `CycleTotalExceeded` (error 19), before any state is written. - -Test: `test::solvency::claims_are_capped_at_the_posted_cycle_total`. - -### 2.5 `initialize` reported the wrong failure - -`initialize` called `admin.require_auth()` before checking whether it had already run. -Calling it a second time with a different key produced an auth trap rather than -`AlreadyInitialized`, which is misleading for integrators and for deployment tooling. - -**Fix.** The already-initialized check now runs first. This is the only intentional -change to an existing function's observable behaviour; it affects no happy path and no -successful call. - -### 2.6 Withdrawal accounting was duplicated - -`withdraw` zeroed the stored balance directly and the ledger could not know how much -liability had been released. That is now a single `storage::take_balance` helper that -zeroes the balance **and** decrements `CreditedTotal`, so the checks-effects ordering -(re-entrancy safe) and the liability bookkeeping are the same operation and cannot be -made to disagree. - -### 2.7 Toolchain and documentation were inconsistent with the code - -The rejected revision declared three different truths: - -| Source | Claimed | -|---|---| -| `contracts/vault/Cargo.toml`, `Cargo.lock` | `soroban-sdk` **28.0.0** | -| `README.md` badge and Quick Start | `soroban-sdk` **27.0.6** | -| `rust-toolchain.toml` comment | `soroban-sdk` **27.0.6** | -| `.github/workflows/ci.yml` | `stellar-cli` **27.1.0** | - -This matters beyond cosmetics: `soroban-sdk` 28 **refuses to emit a contract -artifact** from a CLI older than 25.2.0 and expects a matching major, so a reader -following the README, or CI running the pinned 27.1.0 CLI, is in a configuration the -code was not tested in. We verified the correct fix by installing the CLI and building -rather than guessing: **`stellar-cli` 28.1.0 builds the artifact successfully**, so CI -and all docs now pin SDK `28.0.0` + CLI `28.1.0`. - ---- - -## 3. Verification — how to reproduce every claim - -Run from a clean checkout. Toolchain: `rust` stable (1.91+), targets -`wasm32v1-none`, `stellar-cli` 28.1.0. - -```bash -cargo fmt --all -- --check # exit 0 -cargo test # 44 passed; 0 failed -cargo clippy --all-targets -- -D warnings # exit 0, no warnings -stellar contract build --package splitstream-vault -ls -l target/wasm32v1-none/release/splitstream_vault.wasm # 22,606 bytes -``` - -Recorded results at the time of writing: - -| Check | Result | -|---|---| -| `cargo test` | **44 passed, 0 failed** (baseline: 36 passed) | -| `cargo clippy --all-targets -- -D warnings` | clean, exit 0 | -| `cargo fmt --all -- --check` | clean, exit 0 | -| `stellar contract build` (CLI 28.1.0) | ✅ `splitstream_vault.wasm`, **22,606 bytes** | -| Testnet deploy + `initialize` | ✅ `CB456KG…TLTAT`, both txs confirmed on-ledger | -| Post-deploy smoke test | `deposit(10_000_000)` ok; `get_available_funds` = `10_000_000`; both liabilities `0`; `get_fixed_shares` = `[]` | -| Exported contract functions | 22 (19 before; 3 read-only views added) | - -### Property / fuzz suite - -`contracts/vault/src/property_test.rs` adds four deterministic, dependency-free -property tests driven by a seeded xorshift64 PRNG (failures are reproducible from -the seed printed in the assertion): - -| Test | Property | -|---|---| -| `merkle_proofs_hold_for_random_manifests` | For 48 random manifests of 1–32 leaves: every leaf verifies; a one-unit amount change fails; every single-sibling substitution fails; a single-leaf root equals its leaf. | -| `merkle_proofs_do_not_transfer_between_contributors` | One contributor's proof never validates another contributor's leaf. | -| `vesting_claims_follow_the_linear_schedule` | For 24 random `(total, duration, start)` triples walked through random ledgers: cumulative claims equal `floor(total * elapsed / duration)` exactly, are monotonic, never exceed `total`, and the stored liability always equals `total - claimed`. | -| `vesting_recreation_and_vault_accounting_stay_consistent` | Random re-creations (including the `total == claimed` boundary) never make `claimed > total`, and the accounting identity `balance(vault) == available + credited + vesting_reserved` holds at every step. | - -The new example-based tests are not smoke tests either — each one fails against -the old code: - -- `credited_balances_are_reserved_against_sweeps` — sweeps 1 unit more than free - funds, expects `InsufficientFreeFunds`, then proves the contributor can still - withdraw, then proves the same sweep succeeds once nothing is owed. -- `vesting_liability_is_reserved_against_sweeps` — same for the vesting liability, - including the half-vested transition. -- `claims_are_capped_at_the_posted_cycle_total` — posts a root whose leaves sum to 300 - but declares `total_amount` 250, and asserts the second claim cannot over-pay. -- `vesting_recreate_below_claimed_is_rejected` — asserts the corrupting re-creation is - rejected and the `total == claimed` boundary still works. - ---- - -## 4. ABI and protocol compatibility - -This was a hardening pass on a live Testnet contract, so we deliberately avoided -breaking the frozen cross-repo interfaces: - -- **No function was removed and no existing signature changed.** -- **No error discriminant was renumbered.** Errors 18 (`InsufficientFreeFunds`) and 19 - (`CycleTotalExceeded`) are appended; 1–17 keep their codes, as the docs require. -- **Event topic names and payloads are unchanged.** -- **The Merkle leaf format is unchanged** (`sha256(xdr(contributor) ++ xdr(amount))`, - sorted-pair hashing), so `splitstream-actions` manifests still verify. -- **Storage keys were only added** — no existing key's encoding changed. -- The three new views are additive and read-only. - -The only behavioural change to an existing entry point is §2.5 (error reporting for a -repeated `initialize`), plus the intended new rejection cases in §2.1–§2.4. - ---- - -## 5. Documentation brought in line with the implementation - -The rejected revision had extensive docs that in several places documented bugs as -features. All of the following were corrected, not just appended to: - -| File | Change | -|---|---| -| `README.md` | SDK badge/pins to 28.0.0 + CLI 28.1.0; liability ledger and sweep cap in the storage section; new views and design decision; corrected the `distribute_fixed` rationale. | -| `docs/contract-reference.md` | Function count 19 → 22 with rows for the new views; `execute_sweep`, `credit_claim`, `withdraw`, `create_vesting`, `claim_vested` and both distributions updated; error table 17 → 19; TTL bump inventory replaced with the actual rule; storage layout now lists `CreditedTotal`, `VestingReserved`, `CycleClaimedTotal`. | -| `docs/for-maintainers.md` | "The sweep is not balance-aware" hazard removed and replaced with the reserve-aware behaviour and `InsufficientFreeFunds`. | -| `docs/protocol-mechanics.md` | The note that `total_amount` "is never summed against claims" replaced with the enforcement that now exists. | -| `SECURITY.md` | Invariants 7–11 added: liability tracking, sweep cap, per-cycle over-payment cap, TTL liveness, and the tightened vesting invariant. | -| `docs/SUMMARY.md`, `docs-hub/architecture.md`, `docs-hub/index.md` | Function/error counts corrected. | -| `CONTRIBUTING.md`, `rust-toolchain.toml`, `.github/workflows/ci.yml` | SDK/CLI versions aligned. | -| `CHANGELOG.md` | Full `Unreleased` section describing the security fixes and the toolchain alignment. | - ---- - -## 6. What this changes for Wave participation - -Concretely, a reviewer should now find: - -1. **A buildable, deployable Soroban contract with a reproducible artifact** — not a - claim: a 22,606-byte wasm produced by the CLI version CI pins, deployed and - initialized on Testnet at `CB456KG…TLTAT`. -2. **A CI configuration that matches the code it builds**, so the green badge means - what it appears to mean. -3. **Security work in the areas that matter for a fund-holding contract** — solvency, - liability accounting, arithmetic safety, and storage liveness — with regression - tests that fail on the old code. -4. **Documentation that describes the current code**, including the constraints a - contributor would actually hit. -5. **Frozen-interface discipline**, so the sibling `splitstream-actions` and - `splitstream-sdk-cli` repos are not broken by this pass. - ---- - -## 7. Honest limitations - -We would rather state these than have them discovered in review: - -- **The new Testnet deployment uses fresh keys, and they are Testnet-only.** The - admin/oracle identities behind this deployment were generated for verification and - funded from Friendbot; the production/mainnet keys are unaffected. The deployment - record (addresses, deploy and `initialize` transaction hashes) is in - `docs/developer-guide.md`. -- **The previous Testnet address is superseded, not mutated.** - `CCC2LP2LOYZOLA2JW4C4K7JMR3TRJZIKHDSQYSFJ3R3MCDJLVBT3PZOC` still holds the - pre-fix bytecode and should not be used; the docs now point at the new address and - label the old one explicitly. -- **The contract is still unaudited.** `SECURITY.md` says so explicitly, and this pass - reduces specific risk rather than substituting for an external review. -- **Vesting solvency is tracked, not escrowed.** Vesting claims pay from the vault's - token balance; `get_available_funds` and `get_vesting_reserved` now make the position - visible, but deposits are still the maintainer's responsibility. -- **`Unauthorized` (error 3) remains declared but unused**, kept only because error - discriminants are frozen; `require_auth` traps rather than returning an error. - ---- - -## 8. Suggested appeal text - -> Since the rejection we audited the contract against Soroban's actual failure modes -> and fixed four defects, each with a regression test that fails on the rejected code: -> (1) admin sweeps could drain balances already credited to contributors and unvested -> schedule amounts — the vault now tracks its liabilities and caps sweeps at free -> funds; (2) re-creating a vesting schedule below the already-claimed amount trapped -> `claim_vested` on an overflow check — now rejected at creation and saturating at -> claim; (3) the busiest entry points never bumped the instance TTL, so an actively -> used vault could become permanently unreachable — every state-changing path now -> bumps it; (4) claims were not capped by the cycle's posted `total_amount` — they now -> are. We also found the repo declared SDK 27.0.6 in the README while building 28.0.0 -> and pinning CLI 27.1.0 in CI; those are aligned and the artifact was rebuilt with -> `stellar-cli` 28.1.0. The hardened contract is deployed and initialized on Testnet -> at `CB456KGXH4233BHW5BUEJMN6OJ4ZMWMPP3OXJU5HVQ2T2F7A7XHWLTAT`, with a deposit and -> the read-only views exercised on-ledger. The suite is now 44 passing tests -> (including a randomised property suite for the Merkle and vesting arithmetic), -> clippy is clean with `-D warnings`, and the frozen Merkle format, event topics, -> function signatures and error numbering are unchanged. Verification steps are in -> `CHANGE.md`. - ---- - -## 9. Wave backlog - -Six scoped issues were opened with the `Stellar Wave` label so the repository is -immediately actionable for contributors, each with explicit acceptance criteria: - -| Issue | Scope | -|---|---| -| [#30](https://github.com/SplitStream-Labs/splitstream-core/issues/30) | Add `get_config()` and `get_cycle_claimed_total()` read-only views. | -| [#31](https://github.com/SplitStream-Labs/splitstream-core/issues/31) | Enforce `cargo fmt` and add a dependency advisory audit to CI. | -| [#32](https://github.com/SplitStream-Labs/splitstream-core/issues/32) | Reproducible deploy-and-initialize script for Testnet. | -| [#33](https://github.com/SplitStream-Labs/splitstream-core/issues/33) | Commit a contract-spec snapshot and assert ABI stability in CI. | -| [#34](https://github.com/SplitStream-Labs/splitstream-core/issues/34) | Randomised operation-sequence tests for the solvency invariants. | -| [#35](https://github.com/SplitStream-Labs/splitstream-core/issues/35) | Cross-repo golden fixture for the frozen Merkle leaf format. | - -Five pre-existing issues (#1–#5) remain open and were deliberately left alone. - -## 10. Appendix — files changed - -``` - .github/workflows/ci.yml CLI pin 27.1.0 → 28.1.0 - CHANGELOG.md Unreleased: security + toolchain entries - CONTRIBUTING.md SDK version - README.md versions, liability ledger, views, design notes - SECURITY.md invariants 7–11, vesting disclosure - contracts/vault/src/claims.rs TTL bump, cycle claim cap, take_balance - contracts/vault/src/errors.rs errors 18, 19 appended - contracts/vault/src/fixed_split.rs TTL bump - contracts/vault/src/lib.rs TTL bumps, 3 views, initialize ordering - contracts/vault/src/property_test.rs new: 4 deterministic property/fuzz tests - contracts/vault/src/storage.rs liability ledger + helpers - contracts/vault/src/sweep.rs free-funds cap - contracts/vault/src/test.rs +4 example tests (36 → 40) - contracts/vault/src/property_test.rs new property/fuzz suite (+4, total 44) - contracts/vault/src/vesting.rs underflow fix, liability adjustments - docs/contract-reference.md functions, errors, TTL rule, storage keys - docs/developer-guide.md SDK/CLI versions - docs/for-maintainers.md reserve-aware sweep - docs/protocol-mechanics.md cycle total enforcement - docs/SUMMARY.md function count - docs-hub/architecture.md ABI counts - docs-hub/index.md ABI counts - rust-toolchain.toml SDK version comment -``` +The remaining work was bringing the repository's claims in line with its behaviour and being explicit about limits. The rejected revision declared three different SDK versions — `Cargo.toml` and `Cargo.lock` built `soroban-sdk` 28.0.0 while the README badge, Quick Start and the `rust-toolchain.toml` comment said 27.0.6, and CI pinned `stellar-cli` 27.1.0 — which matters because SDK 28 will not emit a contract artifact from an older CLI, so a reader following the README was in a configuration the code had never been tested in; CI and all docs now pin SDK 28.0.0 with CLI 28.1.0, confirmed by building. `README.md`, `docs/contract-reference.md`, `docs/for-maintainers.md`, `docs/protocol-mechanics.md`, `docs/developer-guide.md`, `docs/SUMMARY.md`, `docs-hub/architecture.md`, `docs-hub/index.md`, `SECURITY.md`, `CONTRIBUTING.md` and `CHANGELOG.md` were corrected rather than appended to: the function count moved from 19 to 22 with rows for the new views, the error table from 17 to 19, the storage layout now lists `CreditedTotal`, `VestingReserved` and `CycleClaimedTotal`, the "sweep is not balance-aware" and "`total_amount` is never summed against claims" notes were replaced with the enforcement that now exists, and `SECURITY.md` gained invariants 7–11 covering liability tracking, the sweep cap, the per-cycle over-payment cap, TTL liveness and the tightened vesting invariant. Compatibility was preserved deliberately: no function was removed, no signature changed, no error discriminant renumbered (18 and 19 are appended, 1–17 keep their codes), event topics and payloads are unchanged, the Merkle leaf format (`sha256(xdr(contributor) ++ xdr(amount))`, sorted-pair hashing) is unchanged so `splitstream-actions` manifests still verify, storage keys were only added, and the new views are additive. We would rather state the limitations than have them found in review: the new Testnet deployment uses freshly generated, Testnet-only keys funded from Friendbot and does not touch production keys; the previous address `CCC2LP2LOYZOLA2JW4C4K7JMR3TRJZIKHDSQYSFJ3R3MCDJLVBT3PZOC` still holds pre-fix bytecode and is superseded rather than mutated, with the deployment record in `docs/developer-guide.md`; the contract remains unaudited and this pass reduces specific risk without substituting for external review; vesting solvency is tracked and made visible, not escrowed, so deposits remain the maintainer's responsibility; and `Unauthorized` (error 3) stays declared but unused because error discriminants are frozen. Finally, to leave the repository immediately actionable for the next Wave, six scoped issues were opened with the `Stellar Wave` label — #30 read-only config and cycle views, #31 `cargo fmt` enforcement plus a dependency advisory audit in CI, #32 a reproducible Testnet deploy-and-initialize script, #33 a committed contract-spec snapshot asserting ABI stability, #34 randomised operation-sequence tests for the solvency invariants, and #35 a cross-repo golden fixture for the frozen Merkle leaf format — while the five pre-existing issues (#1–#5) were deliberately left untouched.