This document tracks the implementations completed to resolve issues #289, #285, #283, and #288.
We added three Mermaid diagrams to ARCHITECTURE.md to describe system topology and key sequence flows.
A top-down (graph TD) layout showing the flow of communication:
- Browser/Client UI connects to the Next.js Frontend (Vercel) via HTTPS.
- Next.js Frontend connects to the Express API (Render) via HTTPS / JWT.
- Express API connects to the PostgreSQL Database (CRM mirror) via SQL.
- Express API invokes the SDK (
TariffShieldClient), which calls the Soroban Contract via Soroban RPC JSON-RPC protocols. - A clear line style legend was added at the bottom: solid lines represent synchronous calls, while dashed lines represent asynchronous event emissions and indexing.
A diagram showing how the system acts when a tariff spike occurs:
CBP Webhookpushes CSV/estimates to theExpress API.Express APIsaves thetariff_uploadtoPostgreSQL.Express APIcalculates and invokessetRequiredCollateralon-chain using theTariffShieldClientSDK.- If a collateral shortfall is detected, the
Express APIinvokesautoTopUpon-chain. - The
TariffShieldContractmoves funds from reserve to collateral, emits thetopupevent, which theExpress APIcaptures and mirrors into thecontract_eventsdatabase log.
A diagram showing the emergency clawback procedure:
- The
Surety Admin UIrequests a clawback action. - The
Express APIperforms role-based authorization verification (surety_admin). - The API invokes the
clawbackmethod on theTariffShieldClientSDK. - The SDK calls
clawbackonTariffShieldContract, draining balances to the surety wallet and freezing the account. - The contract emits a
clawbackevent, which is mirrored by theExpress APIto the database audit logs. - A response is returned back to the UI.
We created a linting gate for contract Rust code.
- Format Configuration: Created rustfmt.toml in the repository root to specify strict format limits (
max_width = 100andedition = "2021"). - CI Integration: Modified .github/workflows/ci.yml to include parallel
fmtandclippyjobs. Both jobs utilize the same cargo cache keys as the test job to avoid rebuilding dependencies. - Pre-commit Hook Suggestion: Added explicit guidelines on configuring a local git
pre-commithook to automatically check Rust formatting locally in CONTRIBUTING.md.
We integrated the Conventional Commit standard with automated changelog updates.
- Dependencies: Added
conventional-changelog-clitodevDependenciesin package.json. - Script: Added a
"changelog"script:"conventional-changelog -p angular -i CHANGELOG.md -s". - Baseline Changelog: Generated a retroactive, complete history from commit history in CHANGELOG.md using
npx conventional-changelog -p angular -i CHANGELOG.md -s -r 0. - Readme Reference: Linked the changelog within README.md under the "Changelog" heading.
We wrote a detailed step-by-step deploy runbook in docs/deployment.md.
- Prerequisites: Clearly listed tools and version bounds for Node.js 20, Rust target wasm32, Stellar CLI, Docker, and Render/Vercel platforms.
- Env Config Reference: Mapped out a table of all environment variables for both API and Web configurations with example values, validation types, and risk levels.
- Soroban Commands: Documented commands for compiling (
cargo build), optimizing (stellar contract optimize), deploying (stellar contract deploy), and initializing (stellar contract invoke) on testnet/mainnet. - Render & Vercel: Provided templates for
render.yamlservice settings, instructions to deploy containerized APIs on Render, and linking/deploying web assets usingvercel --prod. - Post-Deploy Smoke Tests: Outlined three checks to verify API health (
/health), sign up (/auth/signup), and inspect on-chain account state (get_account). - Rollback Actions: Outlined rollback steps for Vercel, Render revisions, and multi-sig Soroban contract upgrades via
propose_upgrade.