Testing
Lucent needs tests across smart contracts, economic behavior, Stellar-specific mechanics, and offchain replay.
Contract Tests
- Soroban unit tests for each contract module.
- Integration tests for open, adjust, close, mint, repay, liquidation, redemption, delegation, and shutdown.
- Authorization matrix tests for owners, delegates, managers, controllers, and registered modules.
- Upgrade timelock tests for proposed Wasm hashes and execution windows.
Economic Invariants
- starUSD supply must correspond to protocol debt.
- Troves below MCR can be liquidated.
- Redemptions reduce debt and collateral in the intended order.
- Stability Pool offsets burn starUSD and distribute collateral gains correctly.
- Redistribution preserves collateral and debt accounting.
- No user can mint starUSD directly.
Stellar-Specific Tests
- SAC and trustline tests for XLM and starUSD flows.
- Issuer flag and controller authority checks.
- 7-decimal rounding and dust tests across mint, repay, redemption, liquidation, close, and Stability Pool yield.
- TTL restore and extend tests for contract code, contract instances, and important persistent storage.
Resource Profiling
Profile bounded operations before launch:
- Redemption traversal.
- Liquidation batches.
- Sorted-index insert, remove, and traversal.
- Getter pagination.
- Migration batches.
Indexer Replay
Event replay tests must prove the indexer can reconstruct:
- Trove state.
- Owner portfolios.
- Stability Pool positions.
- Liquidations and redemptions.
- Parameter changes.
- Revenue and oracle state.
- Contract versions.
Acceptance Criteria
A release candidate should pass contract tests, invariant tests, resource profiling, indexer replay tests, frontend transaction simulation tests, bot dry-runs, and monitoring checks before deployment.