Skip to content

feat(gas-evaluator): implement real-time gas and fee delta estimation engine - #619

Merged
mijinummi merged 1 commit into
MDTechLabs:mainfrom
Vicky08100:feature/gas-fee-delta-estimator
Jul 27, 2026
Merged

feat(gas-evaluator): implement real-time gas and fee delta estimation engine#619
mijinummi merged 1 commit into
MDTechLabs:mainfrom
Vicky08100:feature/gas-fee-delta-estimator

Conversation

@Vicky08100

Copy link
Copy Markdown

Closes #588

PR Description

I implemented a real-time gas and fee delta estimation engine for Solidity/EVM and Stellar/Soroban contracts. This tool helps developers assess the exact monetary savings of applying optimizations by evaluating gas differences ($\Delta$Gas) in USD and native gas tokens (ETH and XLM).

I created a model that maps Solidity optimization rules to EVM opcode gas differentials (like SLOAD cold vs warm, checked math vs unchecked block, call caching, logging, and loop limits). I also built a Soroban resource calculator that maps rules to Stellar CPU instructions and Ledger read/write byte costs according to the 2026/Protocol 20+ schedules.

To convert gas/resource units into USD, I integrated a cached pricing service that retrieves current ETH and XLM prices from CoinGecko, caches the values via the Redis CacheService, and handles connection fallbacks gracefully. Using historical transaction execution volume, the engine estimates the annual native token and USD savings.

Changes Made

  • Created the @gasguard/gas-evaluator package inside libs/gas-evaluator/
  • Implemented libs/gas-evaluator/src/evm-opcode-calculator.ts for mapping Solidity optimization rules to EVM opcode gas differentials
  • Implemented libs/gas-evaluator/src/soroban-resource-calculator.ts for mapping Soroban rules to Stellar CPU and Ledger byte schedules
  • Implemented libs/gas-evaluator/src/gas-delta-evaluator.ts to orchestrate calculation flow, fetch token prices, cache them, and compute annual savings
  • Added export entry points in libs/gas-evaluator/src/index.ts
  • Updated root tsconfig.json with path mapping for @gas-evaluator/*
  • Updated root package.json Jest config with moduleNameMapper path alias
  • Added unit test suite in libs/gas-evaluator/tests/gas-delta-evaluator.spec.ts

@drips-wave

drips-wave Bot commented Jul 26, 2026

Copy link
Copy Markdown

@Vicky08100 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! 🚀

Learn more about application limits

@mijinummi
mijinummi merged commit 407abbd into MDTechLabs:main Jul 27, 2026
3 of 7 checks 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

Development

Successfully merging this pull request may close these issues.

[CORE] Implement Real-Time Gas & Fee Delta Estimation Engine

2 participants