Adds stellar-lend/contracts/ARCHITECTURE.md to document contract boundaries between the legacy hello-world crate, the canonical lending deployment crate, and the auxiliary amm crate.
The note makes the deployment recommendation explicit:
contracts/lendingis the canonical lending deployment targetcontracts/ammis an optional secondary deployment for AMM featurescontracts/hello-worldis legacy and should not be treated as the current deployment target
stellar-lend/contracts/ARCHITECTURE.md- deployment matrix for
hello-worldvslendingvsamm - trust boundaries and ownership boundaries
- admin and guardian powers
- token transfer flow notes
- external call and reentrancy review
- checked-arithmetic and parameter-bound notes
- deployment matrix for
stellar-lend/contracts/lending/SECURITY_NOTES.md- Explicit documentation of Trust Boundaries.
- Authorization Model verification for all external paths.
- Reentrancy protections matrix and Checked-Arithmetic enforcement rules.
lendingis the safest canonical target in the current tree:- user and admin entrypoints consistently require auth
- pause and recovery gates are enforced on high-risk paths
- most arithmetic uses
checked_*orI256 - flash loans include a reentrancy guard and post-callback repayment check
ammshould remain an auxiliary deployment until further hardening:- its admin helper checks stored admin equality but does not call
require_auth() - swap/liquidity execution helpers are still mock protocol integrations
- its admin helper checks stored admin equality but does not call
hello-worldis excluded from the active workspace and should be treated as legacy/reference code rather than the canonical deployment artifact- Oracle paths (
configure_oracle,set_primary_oracle,set_fallback_oracle,update_price_feed,get_price) do not perform external token transfers, so they do not introduce a token-transfer reentrancy surface. - Oracle inputs are treated as untrusted and validated on-chain with staleness checks and deviation bounds before being accepted.
Executed from stellar-lend/:
cargo testSummarized result for multi-user contention scenarios (cargo test multi_user_contention_test):
- Successfully passed
test_contention_interleaved_deposits_borrows(validated serial mixed-user bounds). - Successfully passed
test_contention_edge_cases_zero_amounts_overflow(validated structured errors on 0 amounts and type bounds). - Successfully passed
test_contention_paused_operations(validated isolation when admin pauses protocol globally). All global arithmetic totals (borrows vs collateral deposits) assertions maintained exact parity.
- No contract exports or WASM interfaces changed, so no contract build step was required beyond test verification
- This change is documentation-only; no Rust modules were materially changed
- Team review is recommended before merge, especially around the documented AMM auth caveat
- Re-run
cargo testafter freeing disk space onC:
Full cargo test is currently blocked by pre-existing compile errors in unrelated modules
(e.g., repay.rs, risk_params.rs, amm tests).
To validate oracle coverage, tests were executed in isolation:
cargo test oracle_testValidation rationale:
- Compile blockers are unrelated to oracle admin/read logic and originate from legacy/non-oracle modules.
- Oracle tests are isolated to oracle entrypoints and remain the correct validation target for issue #429.
Current status: isolated oracle test execution is also blocked at compile time by pre-existing crate errors (for example crate::constants unresolved in contracts/lending/src/* and legacy type/API mismatches in contracts/hello-world/src/*).
Current status update:
contracts/lendingconstants module drift was fixed and isolated oracle tests now execute successfully.contracts/hello-worldstill has unrelated legacy compile failures outside oracle scope.
Observed isolated output (contracts/lending):
running 32 tests
...
test result: ok. 32 passed; 0 failed;