# EIP-170 as a measured gate: every guard is paid for in bytes, and the build counts them

> Canonical: https://blazephoenix.xyz/learn/eip-170-as-a-measured-gate/
> License: CC BY-NC-ND 4.0 (attribution + link) · © 2026 BlazePhoenix
> Updated: 2026-11-16

The V2 contract size limit is enforced by the build, not by care: EIP-170 caps runtime code at 24,576 bytes, the release-profile CI job fails a contract at 24,000 bytes, and a test enforces the same line. The Router has the smallest measured margin, 866 bytes, so every added guard has to fit.

Short answer: the limit is enforced by the build, not by care. EIP-170 caps deployed runtime code at 24,576 bytes. The release-profile CI job fails a contract at 24,000 bytes, which is 576 bytes before the protocol limit, and `test/DeployedSizeGate.t.sol` enforces the same line. The margins below are measured, and the Router's is the smallest.

The point is not the limit itself. It is that a limit this tight turns every added check into a visible cost. A guard that does not fit does not ship, so each guard has to earn its bytes.

## The measured sizes

At the commit the whitepaper cites, the runtime sizes and the margin to 24,576 bytes are as follows. The same figures appear in the repository's README table and in its size snapshot file.

## Two limits, not one

Runtime size is one limit. Deployment has another: EIP-3860 caps initcode at 49,152 bytes. The largest initcode in the set is the Solver's, at 32,324 bytes, well under that line. The eight adapters run from 3,026 to 6,666 bytes.

Reading the table, the Router stands apart. It is the one contract that moves funds, and it has 866 bytes left. That is the margin that decides what can still be added to it.

## How the gate is run

The gate does not depend on a person remembering to look. It is a CI job named for the release profile, and a test in the repository enforces the same limit locally.

## Why the budget shapes the design

The whitepaper's rule is that every guard comes with its mutant, a deliberate break that must turn a test red. The whitepaper points out that this rule is also a size budget: the Router has 866 bytes left, so every guard added is paid for in bytes.

## What this does not claim

It does not say that a small contract is a correct contract; the size gate is a budget check and nothing more. It does not promise the margins stay as they are: they are a snapshot at one commit, and the next change will move them. The CI job and the snapshot file are where the current numbers live.

**Verify it yourself:** Run the repository's release-profile size report (forge build --sizes src with FOUNDRY_PROFILE=release and solc 0.8.36) at commit 969bcc6 and compare each runtime size with the table above: Router 23,710 and Hub 23,360, for example. Then compare with `.sizes-snapshot` and the README table, and check 24,576 - 23,710 = 866. CI job 133367307770 is the recorded run. Reading: section 26.1 of the 2.4 whitepaper.

Related: https://blazephoenix.xyz/learn/byte-gas-exchange-rate/ · https://blazephoenix.xyz/learn/contract-architecture/ · https://blazephoenix.xyz/learn/two-hops-five-legs/
