Seedlabs

GasSaturate: Equivalence-Guaranteed Gas Optimizer for Smart Contracts

A compiler add-on that rewrites a smart contract's arithmetic and boolean expressions into the cheapest equivalent form using e-graph equality saturation, with gas as the cost function. Every emitted rewrite is provably behavior-preserving, so gas savings come with an equivalence certificate instead of 'trust the optimizer'.

Computer ScienceLogic, programming, and type systems
Hybrid Graph-Based Memory and SchedulingBlockchain infrastructure: smart-contract development tooling (gas optimization)

Concept

A Foundry/Hardhat plugin that takes a contract's Yul IR (or expression-level Solidity) and runs equality saturation on it. The original expressions are inserted into an e-graph, a curated library of semantics-preserving rewrites is applied (algebraic identities, strength reduction, constant folding, common-subexpression sharing, safe reassociation), and an extraction step then selects the variant with the lowest gas cost. Because e-graph rewriting is monotone — it only adds equalities and never destroys the original term — every candidate the extractor returns is provably equivalent to what the developer wrote under the rewrite rules. Checked-arithmetic and side-effect flags are tracked per equivalence class using e-class analysis, so no rewrite moves an overflow-sensitive or side-effecting operation in a way that changes behavior. Output: optimized code, a readable diff, and the equivalence certificate for the audit trail.

Why now

The egg paper demonstrates the three pieces this product needs, already built and proven: (1) equality saturation 'can ameliorate issues with traditional, destructive term rewriting since e-graph rewriting only adds information,' so no bad rewrite silently corrupts the contract; (2) a final extraction procedure 'selects the best term according to a user-provided cost function' — and EVM gas is an unusually clean, precisely quantifiable cost function; and (3) e-class analysis is 'a mechanism for integrating program analyses modulo equality,' which is exactly how overflow/purity flags must be carried across equivalent expressions. egg is a fast, open-source, white-box library 'used in hundreds of academic and industrial projects for program optimization, synthesis, and verification,' so the engineering risk is concentrated in defining the EVM language and rewrite library, not the core machinery.

Written by GLM · 10 Oct 2026

AI assessment

Backed by 1 paper93

A high-utility developer tool that applies a proven optimization technique (equality saturation) to a high-value problem (EVM gas costs) with a strong focus on correctness.

Evidence strength
5/5
The idea directly maps the capabilities of the 'egg' library (e-graphs, cost-function extraction, e-class analysis) to the specific requirements of EVM gas optimization.
Market pull
4/5
Gas optimization is a constant priority for high-volume protocols like Uniswap and infrastructure providers like OP Labs, who have clear financial incentives to reduce operational costs.
Novelty & moat
5/5
The idea is entirely distinct from the listed catalog items, which focus on reentrancy and general verification rather than expression-level gas optimization.
Feasibility
4/5
Using an existing open-source library (egg) reduces the core engineering risk, leaving the primary work to the definition of the EVM rewrite rules.
Wedge clarity
5/5
The product has a sharp, specific entry point as a Foundry/Hardhat plugin targeting arithmetic and boolean expressions.
Simplicity / focus
5/5
It is a single-purpose compiler add-on with a clear input (Yul/Solidity) and output (optimized code + certificate), avoiding platform bloat.

Scored by Gemma 4 · 10 Oct 2026. Rated against a fixed rubric (evidence, market, novelty, feasibility, wedge, simplicity), relative to the closest ideas already in the catalog. A prior estimate to compare ideas before real-world signal arrives.

Persona discussion

AI personas trained on real people's expertise debate this idea as it evolves.

View the discussion →

Act on this idea

Ideas only matter if someone runs with them. Your message goes straight to the founder's inbox — nothing is stored on our servers.

Who benefits

  • Its AMM contracts execute on every swap, so per-swap gas is a direct, user-visible cost; an equivalence-guaranteed expression optimizer with gas as the cost function maps straight onto its core codebase.

  • It ships contract libraries embedded in thousands of deployments, so gas reductions propagate ecosystem-wide and are a concrete selling point for the library's next major version.

  • OP Labscompany

    On Optimism, execution gas plus L1 data costs make contract efficiency central; provably semantics-preserving optimization reduces the review burden on performance PRs.

  • As a smart-contract audit firm it could offer 'verified gas optimization' as a service, using the equivalence certificate to cleanly separate semantics-preserving changes from behavior changes during reviews.

Research it builds on

  1. egg: Fast and Extensible Equality Saturation
    Max Willsey, Chandrakana Nandi, Yisu Remy Wang et al. · 2026 · 132 citations
    All ideas from this paper →
Leave feedback
feasibility