Labels / Complexity: testing, ci, soroban, rust · Extremely High — 500
Context
The Soroban contracts are effectively untested and CI cannot catch regressions in them. The only #[cfg(test)] module in the workspace is the common crate's proptest suite (quantara/soroban/contracts/common/src/math.rs); vault, looping, liquidation, and rewards (quantara/soroban/contracts/*/src/lib.rs) have no unit tests at all, even though they contain financial logic (vault balances, liquidation discount curves, looping position counters).
The CI workflow .github/workflows/soroban.yml runs cargo fmt, cargo clippy, cargo deny, and cargo build --target wasm32-unknown-unknown --release, but has no cargo test job. A change that breaks a contract's behaviour today passes CI silently. Property-based and fuzz tooling already exists in the repo (proptest in common/Cargo.toml, plus fuzz/ harnesses under looping, vault, and rewards), so the patterns and dependencies are in place and only need to be applied to the contract entry points.
Goal
Give each contract a deterministic unit/property test suite covering its entry points and edge cases, and wire cargo test into the Soroban CI workflow so regressions are caught on every PR.
Scope
1. Vault tests
Cover deposit/withdraw round-trips, insufficient-balance withdrawal, and (once arithmetic is fixed) overflow behaviour, using Env::default() and storage assertions.
2. Looping tests
Cover open_position counter monotonicity, leverage-range validation, and close behaviour once implemented.
3. Liquidation tests
Cover initialize idempotency, start_auction duplicate rejection, the discount curve at start/end/mid, and bid/expire state transitions.
4. Rewards tests
Cover accrue/claim accounting and pending-reset behaviour.
5. CI gate
Add a cargo test job (host target, not wasm) to .github/workflows/soroban.yml, after fmt/clippy and before or alongside build.
Downstream impact
No ABI change. The only CI change is the new cargo test job in .github/workflows/soroban.yml. If tests reveal contract bugs, those fixes may touch entry points, but the test suite itself is additive.
Acceptance criteria
Tests
CI
Out of scope
Do not add fuzz targets or property-based test infrastructure in this issue (the fuzz harnesses already exist); only deterministic unit tests and the CI gate.
Getting started
Files in scope: quantara/soroban/contracts/{vault,looping,liquidation,rewards}/src/lib.rs, .github/workflows/soroban.yml. Verify with:
cd quantara/soroban/contracts
cargo test
cargo build --target wasm32-unknown-unknown --release
Good first files to read: quantara/soroban/contracts/common/src/math.rs (the existing proptest style), quantara/soroban/contracts/vault/src/lib.rs, .github/workflows/soroban.yml.
Labels / Complexity: testing, ci, soroban, rust · Extremely High — 500
Context
The Soroban contracts are effectively untested and CI cannot catch regressions in them. The only
#[cfg(test)]module in the workspace is thecommoncrate's proptest suite (quantara/soroban/contracts/common/src/math.rs);vault,looping,liquidation, andrewards(quantara/soroban/contracts/*/src/lib.rs) have no unit tests at all, even though they contain financial logic (vaultbalances,liquidationdiscount curves,loopingposition counters).The CI workflow
.github/workflows/soroban.ymlrunscargo fmt,cargo clippy,cargo deny, andcargo build --target wasm32-unknown-unknown --release, but has nocargo testjob. A change that breaks a contract's behaviour today passes CI silently. Property-based and fuzz tooling already exists in the repo (proptestincommon/Cargo.toml, plusfuzz/harnesses underlooping,vault, andrewards), so the patterns and dependencies are in place and only need to be applied to the contract entry points.Goal
Give each contract a deterministic unit/property test suite covering its entry points and edge cases, and wire
cargo testinto the Soroban CI workflow so regressions are caught on every PR.Scope
1. Vault tests
Cover
deposit/withdrawround-trips, insufficient-balance withdrawal, and (once arithmetic is fixed) overflow behaviour, usingEnv::default()and storage assertions.2. Looping tests
Cover
open_positioncounter monotonicity, leverage-range validation, and close behaviour once implemented.3. Liquidation tests
Cover
initializeidempotency,start_auctionduplicate rejection, the discount curve at start/end/mid, andbid/expirestate transitions.4. Rewards tests
Cover
accrue/claimaccounting and pending-reset behaviour.5. CI gate
Add a
cargo testjob (host target, not wasm) to.github/workflows/soroban.yml, afterfmt/clippyand before or alongsidebuild.Downstream impact
No ABI change. The only CI change is the new
cargo testjob in.github/workflows/soroban.yml. If tests reveal contract bugs, those fixes may touch entry points, but the test suite itself is additive.Acceptance criteria
Tests
vault,looping,liquidation, andrewardshas a#[cfg(test)]suite covering the cases listed above.cd quantara/soroban/contracts && cargo testpasses.CI
.github/workflows/soroban.ymlrunscargo teston pull requests and fails the check on regression.Out of scope
Do not add fuzz targets or property-based test infrastructure in this issue (the fuzz harnesses already exist); only deterministic unit tests and the CI gate.
Getting started
Files in scope:
quantara/soroban/contracts/{vault,looping,liquidation,rewards}/src/lib.rs,.github/workflows/soroban.yml. Verify with:Good first files to read:
quantara/soroban/contracts/common/src/math.rs(the existing proptest style),quantara/soroban/contracts/vault/src/lib.rs,.github/workflows/soroban.yml.