EIP-3521 Lowering the cost of tx.to in the access list (Reduce access list cost)

No call decision · Fees & gas · EIP status Stagnant · created 2021-04-15

Removes the address cost that previously had to be paid again when the recipient address (tx.to) was listed in a transaction's access list, charging only the lower calldata-level cost instead.

Why it is needed

When sending a transaction, the recipient address (tx.to) is already included by default in the list of 'accessed addresses' under EIP-2929. However, declaring a storage key in an EIP-2930 access list also requires listing the address that key belongs to, so listing tx.to in the access list means paying ACCESS_LIST_ADDRESS_COST again for an address that is already included by default. As a result, at least 25 storage slots currently have to be read under tx.to before using an access list becomes cheaper, which reduces the incentive to declare one. Removing this double charge makes access lists worthwhile even with fewer storage reads. An access list declares in advance which state a transaction will read, so this makes it a more attractive option.

What changes

Today

After EIP-3521

Who is affected

In depth

Problem: tx.to address is counted twice

EIP-2930 requires that when a storage key is declared in the access list, the address that key belongs to must also be explicitly listed, since it must be added to EIP-2929's accessed_addresses list. But tx.to is a special case that EIP-2929 already adds to accessed_addresses by default. So listing tx.to in the access list and paying ACCESS_LIST_ADDRESS_COST amounts to paying twice for the same address.

Current break-even point: 25 storage slots

The original sets up the equation ACCESS_LIST_ADDRESS_COST + (ACCESS_LIST_STORAGE_KEY_COST + WARM_STORAGE_READ_COST) * x = COLD_SLOAD_COST * x and solves for x=24. In other words, the point at which the cost of reading via a cold SLOAD without an access list equals the cost of pre-declaring via an access list and reading warm is 24 storage slots, and only above that (25 or more) does using an access list become cheaper. The motivation section states that removing the double charge would lower this break-even point to around 5 storage reads.

Specification: treat the first occurrence of tx.to as calldata

When the first occurrence of tx.to in the access list is counted for gas, it is treated as calldata, and ACCESS_LIST_ADDRESS_COST is not charged. Storage keys declared under tx.to are unaffected and are charged as before. When tx.to == nil (a contract creation transaction), tx.to is defined as the derived contract address that the transaction creates.

Rationale: why price it at the calldata rate instead of making it free

EIP-2930 was written with the intent of keeping access lists simple and easy to verify, so removing tx.to from the access list structure entirely is seen as violating that intent. Instead, the calldata cost analyzed in EIP-2028 to resist denial-of-service attacks is used as a cost floor. Since including tx.to in accessed_addresses carries no extra computational burden (it is already included by default under EIP-2929), there is no reason to charge more than this minimum cost.

Cost changes shown via test cases

The original test cases are as follows. With only the tx.to address and no storage keys (and no zero bytes), the cost is 320; if one byte of the address is zero, it is 308. Declaring two distinct addresses each costs 2720, and adding one storage key under one of those addresses raises it to 4620 and 6520 respectively. Only the cost of the address itself drops to the calldata level; the storage key cost is still added on top as before.

Backwards compatibility and security

The original states there are no backwards compatibility issues, and explicitly states there are no security considerations.

Progress status

The status of this EIP is Stagnant. No call discussion or further decision record addressing inclusion in a fork has been found since it was proposed in April 2021.

Original EIP · ← EIPs