This guide covers local environment setup, build steps, and local CI validation for the StellarSettle smart contract workspace.
Before submitting a Pull Request targeting dev, run these checks locally to ensure your changes pass CI:
# 1. Format check
cargo fmt --all -- --check
# 2. Lint check with Clippy
cargo clippy --all-targets --all-features -- -D warnings
# 3. Run all unit and integration tests across all workspace contracts
cargo test --all --verbose
# 4. Audit dependency vulnerabilities against the RustSec advisory database
cargo audit
# 5. Build release WASM binaries for target wasm32-unknown-unknown
cargo build --release --target wasm32-unknown-unknownCI runs cargo audit on every Pull Request targeting dev and every push to dev. When an advisory is reported:
- Confirm the affected crate, version range, and advisory details in the RustSec database.
- Prefer upgrading the vulnerable dependency or its direct parent dependency in the same Pull Request.
- If no patched version is available, document the impact analysis, affected code paths, and mitigation plan in the Pull Request before requesting review.
- Do not add advisory ignores unless the advisory is demonstrably unreachable or a maintainer approves a temporary exception with a tracked follow-up issue.
Run cargo install cargo-audit --locked once locally if the cargo audit command is unavailable.
- Rust stable toolchain (
1.80+) with targetwasm32-unknown-unknown - Stellar CLI / Soroban CLI (
stellar-cli/soroban-clipinned to22.0.0) cargo-tarpaulin(optional, for code coverage reports)
# Build dev binaries
cargo build
# Run tests for specific contract
cargo test --package invoice-escrow
cargo test --package invoice-token
cargo test --package payment-distributor
# Run deployment script locally or against testnet
bash scripts/deploy.shTo automatically enforce formatting and linting before every commit:
bash scripts/install-hooks.shThis installs a git hook at .git/hooks/pre-commit that runs cargo fmt --all -- --check and cargo clippy --all-targets --all-features -- -D warnings.
To run end-to-end smoke tests against Stellar Testnet:
- Configure Environment Variables: Set
STELLAR_NETWORK=testnetand export your test account secret keySECRET_KEY=S.... - Execute Deploy Script: Run
bash scripts/deploy.shto compile WASM, deploy contract instances, and register test accounts. - Execute Smoke Test Recipe:
# Initialize escrow contract soroban contract invoke --id <ESCROW_ID> --source seller --network testnet -- initialize --admin <ADMIN> --payment_token <TOKEN_ID>
All Pull Requests MUST target the dev branch. Direct pushes to main or dev are prohibited. See CONTRIBUTING.md for details.