Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 2.31 KB

File metadata and controls

54 lines (43 loc) · 2.31 KB

PR: Harvest Finance Stability & Optimization Suite

Summary

This PR implements a comprehensive suite of stability, observability, and optimization features for Harvest Finance. It addresses critical needs in transaction transparency, oracle reliability, gas efficiency, and long-term state persistence.

Related Issues

  • Closes #138: Gas Usage Optimization & Testing
  • Closes #144: Oracle Failure Resilience Implementation
  • Closes #151: State Archival / TTL Stress Test
  • Closes #159: XDR-based Transaction History Decoding

Changes

📡 XDR-based Transaction History (#159)

  • StellarService: Added getDecodedAccountTransactions which decodes raw XDR envelopes into human-readable operation details.
  • StellarController: Exposed GET /stellar/account/:publicKey/transactions/decoded.
  • DTOs: Added DecodedTransactionDto and DecodedOperationDto for structured API responses.

🛡️ Oracle Failure Resilience (#144)

  • New Interface: IOracle.sol defines standard price and staleness check methods.
  • New Contract: PriceOracle.sol implements heartbeat-based staleness logic.
  • Controller Update: doHardWork in Controller.sol now verifies price freshness before rebalancing, preventing execution on stale or malicious data.

⚡ Gas Usage Optimization (#138)

  • Vault.sol:
    • Replaced high-gas string require statements with Solidity Custom Errors.
    • Optimized storage access by caching _totalAssets during state updates.
    • Used unchecked math for balance updates where overflow is impossible.

⏳ TTL Management & Stress Test (#151)

  • SorobanStorageService: Backend service to monitor and extend contract storage TTL.
  • Stress Test: ttl-stress-test.spec.ts simulates long-term contract inactivity to verify that the system proactively prevents state archival.

Verification

Automated Tests

  • Backend Tests:
    cd harvest-finance/backend
    npm run test
  • Contract Tests:
    cd contracts
    forge test

Manual Verification

  1. Call the new decoded history API to verify Stellar operation transparency.
  2. Set a stale price in the PriceOracle and verify Controller.doHardWork reverts.
  3. Compare gas consumption of Vault.deposit before and after this PR using forge test --gas-report.

Generated by Antigravity