State Fees (formerly State rent) pre-EIP proposal version 3

storage-fee-rent

#1

Version 3 is now up for discussion.
Main changes compared to version 2:

  • Replay protection for externally owned accounts changed from temporal to non-temporal to ensure that account nonces are never reused (reuse of nonces allow re-creation of contracts)
  • Lock-ups are replaced with rent prepayments. Prepayments provide protection from dust griefing vulnerability, though temporary rather than permanent. Prepayments cannot be released, which avoids issues of changing economics of some smart contracts, like DEXs
  • State counters are introduced to make the state size metrics trivially observable, as well as to provide future path for floating rent, if needed.
  • Transaction format is not modified
  • Functionally of gaslimit (field of a transaction) is extended so that gaslimit*gasprice limits prepayments
  • Floating rent and “clean” eviction of contracts are re-added for completeness as optional changes

https://github.com/ledgerwatch/eth_state/blob/b3cd6f9b9fd0455ad26462e4f69d1c6cfda727f8/State_Fees_3.pdf


#2

I love the idea of using existing storage slots to store these new variables! Will definitely reduce overhead and risk for implementers very significantly.

Is the idea that prepayments would cover N years of rent for some specific N?

If so, the combination of prepayments and rent basically means that existing contracts, or new contracts built according to current development patterns, are only guaranteed to be attack-resistant if they are intended to survive for less than N years; is that correct?

I am definitely lately a fan of prepayments over lockups as I’d say a $0.5 payment is better UX than a $7 lockup (or whatever the fees would end up being).


#3

Thank you very much for reading the proposal!

Yes, that is the idea!


#4

Thinking about what the proposed values for N and the absolute rent rate would look like…

I think we can safely assume that much less than 10m ETH will go into expanding the state; for reference, 422k ETH was spent on transaction fees to date.

Also, for reference, the current cost of filling storage, assuming the current average gasprice of 12 gwei is:

  • Storage key: 20000 gas -> 2.4 * 10^{-4} ETH
  • Account: 32000 gas -> 3.84 * 10^{-4} ETH
  • Code byte: 200 gas -> 2.4 * 10^{-6} ETH

If we want per-year prices, we can multiply per-block prices by 2 million; your proposals would give 4 * 10^{-3} ETH per account and 2 * 10^{-5} per code byte, so current prices would roughly equal prices for a month of lifetime in the new model.

I suppose that if we want to increase the gas limit to 40m eventually, while keeping storage size lower than it is today, something close to this level of repricing is the only way to do it…


#5

Now there’s the question of what N is…

The per-storage-slot rent, interpolated from the proposals in the slides, would be around 3 * 10^{-3} ETH per year, so the N that your slides imply would be 6.67 years, which seems unreasonably high. The reason is that if we mandate a prepayment, then that means that users of any application would have to pay enough to make their application survive at least N years, and most applications don’t need to survive that long.


#6

Yes, it is quite high. When I was updating the proposal, I did not know how to calculate these numbers yet. Thank you for your help doing it, I will rethink and update the proposal


#7
  • Replay protection for externally owned accounts changed from temporal to non-temporal to ensure that account nonces are never reused (reuse of nonces allow re-creation of contracts)

I see you try to use txCount to re-create the evicted account. Where do you store the txCount, or is it a global value to track all total tx count of the whole network?


#8

Thanks for reviewing!
txCount is a global value to track all total tx count of the whole network. And it is stored in the index 0 of the state counters contract (which is introduced in change A)


#9

I think that could work. Thanks.