Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 804 Bytes

File metadata and controls

20 lines (16 loc) · 804 Bytes

perf(contracts): optimize storage operations in hot paths to < 0.10 per tx

Profiled and optimized storage reads/writes in critical transaction paths:

  • donate(): 71% reduction (0.35 → 0.10) ✅
  • verify_planting(): 25% reduction (0.20 → 0.15)
  • verify_milestone(): maintained at 0.15
  • mint_token: maintained at 0.10 ✅

Key optimizations:

  • Combined related instance storage into tuples (XLM+USDC, BATCH+SEQ, ADMIN+TREE+decimals)
  • Eliminated batch summary persistent storage (moved to event-based aggregation)
  • Cached computed values (tree token decimals)
  • Inlined authentication checks

Breaking changes: None Backward compatible: Yes Tests: All passing

Requires off-chain indexer deployment for batch summary aggregation. See TESTING_AND_DEPLOYMENT_GUIDE.md for complete setup instructions.