THE SAME RULES. LESS GAS. THE RECEIPTS TO CHECK.
Make the change.
Measure the difference.
An authority check should stop the wrong caller—not make every correct call pay for an unnecessary storage read. We made fixed authorities immutable, then ran the same programs, inputs and refusal paths before and after.
EVM / PREVIOUS SHIPPED SOURCE → IMMUTABLE AUTHORITY
A small source change.
A measurable result.
Both versions use Solidity 0.8.30, optimizer 200, Paris bytecode and the same Anvil 1.8.6 runner. Each was executed on three fresh synthetic chains. This compares our previous examples with our improved examples.
Same update. 2,100 less gas.
Receipt gas includes the transaction’s base and calldata costs. The first zero-to-nonzero increment also saves 2,100 gas: 45,767 → 43,667 (4.59%).
- Deployment receipt
- 148,938 → 136,950
8.05% less - Runtime bytecode
- 339 → 389 bytes
- Behavior checked
- 7 calls × 2 versions × 3 runs
- Result
- Same tested return values,
reverts and state outcomes
TRADE-OFF / Runtime grows 50 bytes. This is a new-deployment example, not a proxy storage upgrade.
// Before: authority lives in a storage slot address public owner; // After: constructor fixes it in runtime code address public immutable owner;
These figures are recorded measurements. Open the example, restore it if you have an older draft, and choose Build & run EVM to produce a fresh result.
| CALL | PREVIOUS GAS | IMPROVED GAS | DIFFERENCE |
|---|
SOLANA / TYPESCRIPT → C → NATIVE SBF
High-level source.
Native results.
Write the authority, account types and rule in TypeScript. Inspect the generated checks, then run the compiled SBF program in Agave 2.3.13. The increment below consumes 111 CU in its own program invocation; the complete initialize-and-increment transaction consumes 2,028 CU.
export function increment(
authority: Signer, counter: Mut<Counter>, by: u64,
): void {
require(counter.authority === authority.key,
CounterError.Unauthorized);
counter.count += by;
}| PROGRAM | INVOCATION CU, IN ORDER | SUCCESSFUL TRANSACTION CU | SBF SIZE | DIRECT BUILD |
|---|---|---|---|---|
| Counter | [1917, 111] | 2028 | 12,480 B | Exact C / IDL / SBF match |
| Escrow | [2262, 1364, 159] | 3785 | 15,736 B | Exact C / IDL / SBF match |
| Vault | [2260, 1364, 314, 162] | 4100 | 16,944 B | Exact C / IDL / SBF match |
Counter: initialize → increment. Escrow: initialize → deposit → release. Vault: open → deposit → withdraw → close. The same synthetic keys, source and public program address were retained across three fresh runs per program. Failed authority or destination scenarios also passed their expected refusals.
The studio adapter and a direct invocation of the pinned upstream compiler produced identical C, IDL and native binary hashes for all three programs. This demonstrates adapter fidelity; it does not establish a faster compiler or an advantage over another runtime.
REPRODUCE THE CLAIM
Keep the method
with the number.
What was held constant?
The two EVM editions differ only in the immutable declaration of the constructor-fixed authority. Compiler version, optimizer, EVM code target, arguments, deterministic synthetic actors and scenarios stay fixed. Constructor, per-call and bytecode measurements are reported separately. Matching outcomes cover the listed inputs, not every possible input.
What does the hook result mean?
The hook deployment receipt falls from 303,410 to 291,054 gas (4.07%). Its successful callback transaction receipt rises from 27,050 to 27,080 gas in this runner; no callback receipt-gas saving is claimed. Different CREATE2 addresses change calldata bytes. Runtime bytecode grows from 1,026 to 1,075 bytes. Both fee branches, neighboring thresholds, caller/pool/hook checks, exact-output refusal, zero input and signed-minimum overflow were exercised. The callback is tested; a full PoolManager swap and liquidity lifecycle are outside this fixture.
What do these runs establish?
21 fresh synthetic chain runs passed 156 checks. Paired EVM calls returned the same tested output, revert bytes and state outcomes. The original and improved bytecode are intentionally different; immutables alter storage layout and are not a drop-in proxy upgrade. Gas is the measured receipt cost in this exact Anvil version, not a mainnet quote. Solana simulations do not persist transactions. Build wall time is not used as a speed benchmark.