Skip to content

feat: Add Gas Consumption Tracking for Contract Operations (#107)#138

Merged
ayomideadeniran merged 3 commits intoSoroLabs:mainfrom
AdityaK9822:feat/107-gas-tracking
Mar 29, 2026
Merged

feat: Add Gas Consumption Tracking for Contract Operations (#107)#138
ayomideadeniran merged 3 commits intoSoroLabs:mainfrom
AdityaK9822:feat/107-gas-tracking

Conversation

@AdityaK9822
Copy link
Copy Markdown
Contributor

Closes #107

This PR implements a systemic gas metric tracking suite and CI workflow integration to monitor execution costs of smart contract operations.

Changes Made

  • Gas Test Module: Added contract/src/test_gas.rs running automated native gas measurements on key contract functions (init, register, deposit_gas, withdraw_gas, execute, and cancel_task).
  • Parsing Scripts: Added scripts/track_gas.sh and scripts/compare_gas.py to seamlessly extract ENV metrics and compare JSON reports between base and active branches.
  • CI Pipeline: Integrated scripts/* execution natively into our .github/workflows/rust.yml workflow pipeline. The pipeline now automatically comments on PRs with a clean breakdown comparing new contract gas overhead against the main baseline branch.

Expected CI Output

Reviewers will now see automated PR comments structured like this:

Function CPU Instructions Diff (CPU) Memory Bytes Diff (Mem)
cancel_task 134298 +134298 (+∞%) 10245 +10245 (+∞%)

(Metrics are derived from native Soroban rust execution approximations designed uniquely to track relative performance scale).

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 29, 2026

@AdityaK9822 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

@ayomideadeniran
Copy link
Copy Markdown
Contributor

Pr under review.

@ayomideadeniran ayomideadeniran merged commit 932701e into SoroLabs:main Mar 29, 2026
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.

[Performance] Add Gas Consumption Tracking for Contract Operations

2 participants