Skip to content

fix(vault): harden solvency, TTL and vesting; redeploy Testnet - #36

Merged
Oyinkans0la12 merged 1 commit into
mainfrom
chore/wave-appeal-hardening
Nov 22, 2026
Merged

Oyinkans0la12 merged 1 commit into
mainfrom
chore/wave-appeal-hardening

Conversation

@Oyinkans0la12

Copy link
Copy Markdown
Collaborator

Summary

Hardening pass following the Drips Wave rejection. The repository was already a native Soroban contract (soroban-sdk 28, #[contract], wasm32v1-none, SEP-41 token client), so there was no chain migration to do. Instead this fixes the real Soroban defects and the repo's mismatch with its own dependency reality.

CHANGE.md documents every change, the verification steps, and the ABI-compatibility argument.

Defects fixed (each with a regression test)

  • Sweeps could drain money the vault already owed. execute_sweep ignored credited balances and outstanding vesting. Added a liability ledger (CreditedTotal, VestingReserved) and capped sweeps at balance - liabilities (InsufficientFreeFunds, error 18).
  • Vesting could trap. Re-creating a schedule below claimed made vested - claimed underflow; with overflow-checks = true that panics the wasm. Now rejected at creation and saturating at claim.
  • Instance TTL lapsed on hot paths. deposit, post_cycle_root, credit_claim, withdraw, both distributions and claim_vested never bumped the instance TTL, so an actively used vault could become permanently unreachable. All state-changing paths bump it now.
  • Claims were not capped by total_amount. Added CycleClaimedTotal(cycle_id) and CycleTotalExceeded (error 19).

Toolchain

README/rust-toolchain said soroban-sdk 27.0.6 while Cargo resolved 28.0.0, and CI pinned stellar-cli 27.1.0. SDK 28 refuses to emit an artifact from an older CLI. Aligned on SDK 28.0.0 + CLI 28.1.0 (verified by building and deploying).

Tests

  • cargo test: 44 passed (was 36)
  • New deterministic property/fuzz suite (property_test.rs): random 1–32-leaf Merkle manifests with tamper rejection; randomised vesting walks asserting the linear formula, monotonicity, the total ceiling, and balance == available + credited + vesting_reserved.
  • cargo clippy --all-targets -- -D warnings: clean
  • cargo fmt --all -- --check: clean
  • stellar contract build: 22,606-byte wasm

Testnet redeploy

Hardened contract deployed and initialized: CB456KGXH4233BHW5BUEJMN6OJ4ZMWMPP3OXJU5HVQ2T2F7A7XHWLTAT

Smoke test: deposit(10_000_000) succeeded; get_available_funds = 10_000_000; get_total_credited = 0; get_vesting_reserved = 0. Deploy/init tx hashes are recorded in docs/developer-guide.md.

ABI compatibility

No function removed, no signature changed, no error renumbered (18/19 appended), event topics and the frozen Merkle leaf format untouched, storage keys only added.

Follow-ups

Six scoped issues opened with the Stellar Wave label: #30–#35.

Fixes four defects found in review of the rejected revision, each with a
regression test: sweep could drain balances and vesting the vault already
owed (now capped by a liability ledger), vesting could underflow on schedule
re-creation, the busiest entry points never bumped the instance TTL, and
cumulative claims were not bounded by the posted cycle total.

Also aligns the toolchain on soroban-sdk 28.0.0 / stellar-cli 28.1.0 (the
docs said 27.0.6 while Cargo resolved 28), documents the changes, adds a
deterministic property suite, and records the new Testnet deployment.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@Oyinkans0la12
Oyinkans0la12 merged commit 2b09d4e into main Nov 22, 2026
1 check passed
@Oyinkans0la12
Oyinkans0la12 deleted the chore/wave-appeal-hardening branch November 22, 2026 12:58
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.

1 participant