feat: Gas Optimization & Fee Analysis#93
Open
pugsley76 wants to merge 1 commit into
Open
Conversation
- Add transaction_fees, fee_estimates, fee_analytics_snapshots tables (migration 003) - Implement Soroban fee estimator with pre-submission simulation, resource footprint analysis, and optimization hint generation (feeEstimator.ts) - Add gas analytics engine with per-operation cost breakdown, storage usage analysis, efficiency scoring, and recommendations (lib/gas/analyzer.ts) - Upgrade deploy.ts from stub to fee-optimized real Soroban deployment; stub path preserved when SOROBAN_RPC_URL is unset - Add POST /api/contracts/fee-estimate for pre-deployment cost preview - Add GET /api/gas/analytics for platform-wide fee efficiency report - Capture actual fees in worker for every escrow deposit/release/refund - Add FeeAnalysis dashboard component and FeeEstimatePreview inline widget - Document new env vars in env.example Closes: Gas Optimization and Fee Analysis issue
|
@pugsley76 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Collaborator
|
@pugsley76 resolve the merge conflicts properly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #84
Summary
Implements gas cost measurement, storage optimization, and transaction fee analysis for Soroban escrow contracts on the Stellar network.
Changes
Database
transaction_fees,fee_estimates, andfee_analytics_snapshotstables with indexes for fast analytics queriesCore Engine
lib/soroban/feeEstimator.ts— pre-submission simulation via Soroban RPC, resource footprint analysis (CPU, memory, ledger I/O, tx size), optimization hint generation, and actual fee extraction from confirmed transactionslib/gas/analyzer.ts— per-operation cost breakdown, storage usage analysis, efficiency scoring (0–100), daily trend aggregation, and prioritized recommendationsAPI Routes
POST /api/contracts/fee-estimate— returns min/recommended/max fee estimate before deploymentGET /api/gas/analytics— full efficiency report (admin) or user fee summaryWorker
scripts/worker.ts— capturesfee_chargedfrom every Horizon payment event and persists it for analyticsDeployment
lib/soroban/deploy.ts— upgraded from stub to fee-optimized real deployment; stub path preserved whenSOROBAN_RPC_URLis unsetUI
components/dashboard/fee-analysis.tsx— efficiency score gauge, cost breakdown table, daily trend chart, storage usage chart, and recommendation cardsFeeEstimatePreviewinline widget for the contract creation formAcceptance Criteria