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.
- 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
- StellarService: Added
getDecodedAccountTransactionswhich decodes raw XDR envelopes into human-readable operation details. - StellarController: Exposed
GET /stellar/account/:publicKey/transactions/decoded. - DTOs: Added
DecodedTransactionDtoandDecodedOperationDtofor structured API responses.
- New Interface:
IOracle.soldefines standard price and staleness check methods. - New Contract:
PriceOracle.solimplements heartbeat-based staleness logic. - Controller Update:
doHardWorkinController.solnow verifies price freshness before rebalancing, preventing execution on stale or malicious data.
- Vault.sol:
- Replaced high-gas string
requirestatements with Solidity Custom Errors. - Optimized storage access by caching
_totalAssetsduring state updates. - Used
uncheckedmath for balance updates where overflow is impossible.
- Replaced high-gas string
- SorobanStorageService: Backend service to monitor and extend contract storage TTL.
- Stress Test:
ttl-stress-test.spec.tssimulates long-term contract inactivity to verify that the system proactively prevents state archival.
- Backend Tests:
cd harvest-finance/backend npm run test
- Contract Tests:
cd contracts forge test
- Call the new decoded history API to verify Stellar operation transparency.
- Set a stale price in the
PriceOracleand verifyController.doHardWorkreverts. - Compare gas consumption of
Vault.depositbefore and after this PR usingforge test --gas-report.
Generated by Antigravity