EIPs Explained

EIP-1682 · Withdrawn · Core · 2018-11-10

EIP-1682: Storage Rent

A withdrawn proposal to charge accounts ongoing rent for the state they occupy, deactivating those that stop paying and letting anyone restore them later.

What problem does it solve?

Every account and storage slot ever written to Ethereum must be kept by every full node forever. Users pay once, when they write data, but the network bears the storage cost indefinitely. The authors argued that this unbounded growth is not sustainable and that the protocol needed a hard upper bound on state size.

EIP-1682 proposed storage rent: accounts pay continuously for the space they use, and accounts that stop paying are removed from active state but can be resurrected.

How it works

Accounts gain three fields:

account = [nonce, balance, storageroot, codehash, rentbalance, rentblock, storagesize]
  • rentbalance: ether set aside specifically for rent.
  • rentblock: last block at which rent was settled.
  • storagesize: number of storage slots in use.

Charging rent. When a block modifies an account, rent is computed for the blocks since rentblock in proportion to storagesize, taken first from rentbalance then from the regular balance, and burned. The per-slot fee rises as total state approaches a constant MAX_STORAGE_SIZE = 2**32 trie nodes, so rent gets steeper as the chain fills up.

Inactive accounts. An account that cannot pay becomes inactive: its code and storage are removed and it behaves as if it has no code.

New opcodes:

Opcode Effect
PAYRENT amount addr Move ether from the caller into addr's rent balance (anyone can pay for anyone)
RENTBALANCE addr Push addr's rent balance
SSIZE addr Push addr's storage size
RESTORETO addr codeaddr Restore an inactive account from a contract whose storage root matches it

To restore account A, you deploy a new contract B, rebuild A's exact storage with SSTOREs, then call RESTORETO. The cost of restoring therefore equals the cost of recreating the data.

A separate rent balance exists because some contracts reject plain ether transfers, or track their balance precisely (e.g. crowdfunding), and must not have rent deducted from it.

Sample code

The rent calculation from the spec (Python pseudocode):

MAX_STORAGE_SIZE = 2**32

def storagefee_factor(block):
    ramp = MAX_STORAGE_SIZE / (MAX_STORAGE_SIZE - total_storage_size(block))
    return 2**22 * ramp

def charge_rent(prestate, poststate, addr, currentblock):
    fee = rent(prestate, poststate, addr, currentblock)
    if fee <= poststate[addr].rentbalance:
        poststate[addr].rentbalance -= fee
    else:
        fee -= poststate[addr].rentbalance
        poststate[addr].rentbalance = 0
        poststate[addr].balance -= min(poststate[addr].balance, fee)
    poststate[addr].rentblock = currentblock

Things to know

  • Status: Withdrawn. Storage rent was never adopted on Ethereum, and several gas costs (PAYRENT, RESTORETO) were left "TBD".
  • Rent breaks a basic expectation that contract storage persists forever; restoration was meant to soften this, but restoring requires someone to still have the full data.
  • Accounts are only charged when touched, so idle accounts would not be removed automatically; the spec accepts this to avoid tracking every account.
  • Ethereum's state-growth work later moved in other directions, such as history expiry (EIP-4444) and stateless clients with Verkle-style gas changes (EIP-4762).

#state #rent #storage #core #withdrawn

Details

Authors
Felix J Lange (@fjl), Martin Holst Swende (@holiman)
Status
Withdrawn
Type
Standards Track / Core
Created
2018-11-10

Machine-readable: Markdown · JSON