gas-compare

Compare per-test gas usage between current and base branches using forge.

179|62|Updated Aug 11, 2023
One-click install
npx skills add https://github.com/propeller-heads/tycho-indexer --skill gas-compare
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gas-compare
Source: https://github.com/propeller-heads/tycho-indexer/tree/main/.claude/skills/gas-compare
Command: npx skills add https://github.com/propeller-heads/tycho-indexer --skill gas-compare

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Compare per-test gas usage between the current branch and a base branch to quantify swap costs.

Core Features & Use Cases

  • Per-test gas extraction using forge to isolate the gas cost of individual router functions.
  • Aggregated reports by router function and protocol to identify hotspots and regressions.
  • Workflow automation for PR readiness, baseline comparisons, and gas regression detection.

Quick Start

Run the gas-compare skill to produce a per-test gas delta report between your current branch and main.

Frequently Asked Questions about gas-compare

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I compare per-test gas usage between branches to catch regressions?

To compare per-test gas usage, run forge test --gas-report --json on both your current and base branches. The tool aggregates results by router function and protocol, outputting a side-by-side delta report to reveal gas regressions.

What's the best way to isolate router gas costs from non-swap overhead in Foundry?

Isolating router gas costs requires running forge test --gas-report --json and aggregating results by router function while excluding non-swap overhead. This reveals exact swap costs and identifies hotspots within your protocol contracts.

Do I need a local Foundry setup and RPC_URL to benchmark gas deltas?

Yes, benchmarking gas deltas requires a local Foundry setup, a git repository with Tycho contracts, and an RPC_URL. These dependencies are necessary to execute forge test --gas-report --json and compare branch results.

Can I automate gas regression detection for PR readiness checks?

Yes, you can automate gas regression detection by running the comparison between your current branch and main. It produces a per-test gas delta report quantifying swap costs to ensure PR readiness before merging.

How does aggregating gas reports by protocol help identify hotspots?

Aggregating gas reports by protocol groups per-test gas usage data by router function, highlighting specific areas with increased costs. This side-by-side comparison directly identifies gas hotspots and regressions across protocols.