Skip to content

feat: implement direct soroban read layer and verification surface (#… - #87

Merged
EmeditWeb merged 2 commits into
StepFi-app:mainfrom
sublime247:feat/soroban-read-verification
Jul 22, 2026
Merged

feat: implement direct soroban read layer and verification surface (#…#87
EmeditWeb merged 2 commits into
StepFi-app:mainfrom
sublime247:feat/soroban-read-verification

Conversation

@sublime247

@sublime247 sublime247 commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Closes #85

Features & Enhancements

Direct Soroban Smart Contract Read Layer

  • Built a direct, read-only Soroban service (src/services/soroban.service.ts) using @stellar/stellar-sdk rpc.Server.
  • Fetches real deployed contract WASM bytecode via getContractWasmByContractId and calculates actual SHA-256 hashes client-side.
  • Performs read-only transaction simulations for:
    • get_pool_stats (Liquidity Pool contract)
    • get_score (Reputation contract)
    • get_loan (Creditline contract)
  • Added reconciliation logic (reconcilePoolStats) to compare API-reported values against direct Soroban contract state and compute mismatch flags.

Trust-Minimized Verification Surface (Contracts Page)

  • Replaced fabricated mock SHA-256 hashes on Contracts.tsx with live on-chain WASM hashes.
  • Added an On-Chain vs API Reconciliation section comparing API-served pool metrics against Soroban contract state.
  • Highlights Mismatch warning flags if API numbers diverge from on-chain state.
  • Graceful loading spinners, error alerts with a Retry Read button, and empty fallback handling.

Dynamic Pool Overview (Home Page)

  • Replaced hardcoded static pool stats on Home.tsx with live reads fetched via sorobanService and poolService.

Verification & Testing

  • Unit Tests: Added src/services/__tests__/soroban.service.test.ts. npm test passes with 27 tests (6 new tests added).
  • Linting: npm run lint passes with 0 errors and 0 warnings.
  • Production Build: npm run build compiles with 0 errors.
  • Mobile Responsiveness: Verified layout on 375px mobile viewports.
  • Code Standards: No hardcoded hex colors, icons from lucide-react only, no direct API/RPC calls in page components.

Related Issues

Closes #85

@sublime247
sublime247 requested a review from EmeditWeb as a code owner July 20, 2026 11:16

@EmeditWeb EmeditWeb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review verdict: ✅ APPROVE with a minor correction

Good transparency feature. Verified locally: build passes, lint clean, tests pass (27). The new soroban.service.ts is read-only (no signing, submit, secret, or Keypair usage), so exposing a direct on-chain verification surface here is safe and appropriate. No hardcoded hex, no API calls in pages.

Minor correction: one any at src/services/soroban.service.ts:75const rawSim = simResult as any. Please give it a proper type (or cast to unknown and narrow) to satisfy the no-any standard; it's the only violation in the PR.

Otherwise merge-ready.

@sublime247

Copy link
Copy Markdown
Contributor Author

@EmeditWeb any update as regards reviewing?

@EmeditWeb

Copy link
Copy Markdown
Member

@EmeditWeb any update as regards reviewing?

I'm currently auditing it

@EmeditWeb EmeditWeb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-audited after today's update: the any cast at soroban.service.ts:75 is removed (commit 787f326), soroban read layer is read-only (no signing/submit), build passes, eslint . clean, 27 tests pass, CI green. Approving and merging. (Note: #88 was built on top of this branch and will be rebased onto main after this lands.)

@EmeditWeb
EmeditWeb merged commit 7d90c10 into StepFi-app:main Jul 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants