EIP-2035 Repricing gas costs for stateless clients (Stateless Clients - Repricing SLOAD and SSTORE to pay for block proofs)
No call decision · Fees & gas · EIP status Stagnant · created 2019-05-16
A proposal to raise the gas cost of SLOAD and SSTORE, which read or write contract storage, in order to compensate miners for the bandwidth cost of transmitting block proofs.
Why it is needed
Currently, the gas costs of SLOAD and SSTORE reflect only database access latency. But under the stateless client design, a node can validate a transaction using only the block proof delivered alongside the block, without holding the contract storage directly. In that case, database access latency disappears, but instead the bandwidth burden of generating and propagating proof data increases. Empirical analysis shows that a single uncached SLOAD or SSTORE adds up to 1KB to the block proof, and since it is miners who bear this cost, it needs to be compensated through gas fees.
What changes
Today
- The gas costs of SLOAD and SSTORE account only for database access latency.
- For a node to process a transaction, it must directly hold the contract storage state.
- The cost miners incur to generate and propagate block proofs is not reflected in gas fees.
After EIP-2035
- The cost of transmitting block proofs is added to the gas costs of SLOAD and SSTORE.
- Only the first access to a storage slot within the same transaction, via SLOAD or SSTORE, incurs the extra gas cost X.
- Nodes become able to process transactions using only the block proof, without storage state.
- Miners are compensated via gas fees for the burden of generating and transmitting proofs.
Who is affected
- General users / dApp users: Gas fees may rise for transactions that heavily read and write contract storage.
- Smart contract developers: Contracts that hardcode the gas costs of SLOAD and SSTORE directly in their code may behave differently.
- Miners: They are compensated via gas fees for the extra work of generating and transmitting block proofs.
- Full node operators: Memory burden decreases, since transactions can be processed with only the block proof and no storage state.
In depth
What changes
This EIP is part of the State Rent roadmap and is a change that prepares for the introduction of stateless clients. A stateless client is a scheme in which a node can verify and execute transactions using only the block proof delivered along with the block header and block body, without holding Ethereum's entire state directly. In phase 1, only contract storage is subject to proofs, so account information must still be read from state, but storage access becomes optional. That is why only the two opcodes that read and write storage, SLOAD and SSTORE, have their gas costs raised.
Why reprice only SLOAD and SSTORE
According to holiman's empirical analysis in vmstats, SLOAD is currently underpriced relative to the execution latency (database access latency) it adds to block processing. SSTORE is excluded from this analysis because many implementations can defer its effect until the end of the block. Under the stateless client approach, database access latency almost disappears, but instead bandwidth consumption for transmitting proof data increases. According to as-yet unpublished empirical analysis, a single uncached SLOAD or SSTORE adds up to 1KB to the block proof, and applying the current data transmission cost of 68 gas per byte, both opcodes' gas costs would increase by about 69,000 gas. However, applying the model proposed by EIP-2028 could make this increase much smaller.
Gas cost increase rule
The original text explicitly states that the specification is not yet formal. The rule currently proposed is that gas cost only rises by X when a storage slot not yet accessed within the same transaction is read or written for the first time via SLOAD or SSTORE. Reading or writing a slot that has already been accessed once within the same transaction incurs no additional cost. The specific value of X is to be determined through further research and prototyping.
Relationship to EIP-1884
EIP-1884 also proposed raising the gas cost of SLOAD, but on different grounds. EIP-1884 cited execution latency itself as the basis, whereas this EIP cites the bandwidth cost of transmitting block proofs. Since the increase proposed by this EIP is larger, the other increases proposed by EIP-1884 remain, but this EIP partially supersedes the SLOAD increase portion.
Relationship to EIP-2028
EIP-2028 presents a model for setting gas costs based on data transmission cost. Under a stateless client regime, SLOAD and SSTORE increase the data that must be transmitted and the proof verification computation required, so this EIP references EIP-2028's model in calculating its gas costs.
Alternative considered and discarded
The main alternative considered was charging rent proportional to contract storage size. However, this approach is vulnerable to griefing attacks, and avoiding that would require redesigning smart contracts from the ground up around their storage structure. While technically feasible, this would impose a large cost on the entire ecosystem, so this EIP instead chose per-opcode gas cost increases.
Backwards compatibility concerns
This change is not backwards compatible and requires a hard fork. Contracts that hardcode the gas costs of SLOAD and SSTORE directly in their code may be affected. There is also a possibility that some dApps relying on such storage interactions could become economically unviable as interaction costs rise. The original text notes that after this EIP and EIP-2026 (prepaid account rent) are both applied, a recommendation to raise the block gas limit is expected to follow, which could mitigate the side effects to some extent. However, it states that further analysis of affected contracts is still needed.
Specification completeness and status
The original text states that this EIP's status is Stagnant, that the specification itself is not yet formal, and that test cases and an implementation are to be added once a reference implementation emerges. Follow-up variants, such as determining the value of the gas increase X and differential gas based on contract size using gross contract size accounting, also remain subjects requiring further research.