Repository navigation
fix(vault): harden solvency, TTL and vesting; redeploy Testnet - #36
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Hardening pass following the Drips Wave rejection. The repository was already a native Soroban contract (
soroban-sdk28,#[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.mddocuments every change, the verification steps, and the ABI-compatibility argument.Defects fixed (each with a regression test)
execute_sweepignored credited balances and outstanding vesting. Added a liability ledger (CreditedTotal,VestingReserved) and capped sweeps atbalance - liabilities(InsufficientFreeFunds, error 18).claimedmadevested - claimedunderflow; withoverflow-checks = truethat panics the wasm. Now rejected at creation and saturating at claim.deposit,post_cycle_root,credit_claim,withdraw, both distributions andclaim_vestednever bumped the instance TTL, so an actively used vault could become permanently unreachable. All state-changing paths bump it now.total_amount. AddedCycleClaimedTotal(cycle_id)andCycleTotalExceeded(error 19).Toolchain
README/rust-toolchain said
soroban-sdk27.0.6 while Cargo resolved 28.0.0, and CI pinnedstellar-cli27.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)property_test.rs): random 1–32-leaf Merkle manifests with tamper rejection; randomised vesting walks asserting the linear formula, monotonicity, the total ceiling, andbalance == available + credited + vesting_reserved.cargo clippy --all-targets -- -D warnings: cleancargo fmt --all -- --check: cleanstellar contract build: 22,606-byte wasmTestnet redeploy
Hardened contract deployed and initialized:
CB456KGXH4233BHW5BUEJMN6OJ4ZMWMPP3OXJU5HVQ2T2F7A7XHWLTATSmoke 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 indocs/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 Wavelabel: #30–#35.