- Author: MrStahlfelge
- Status: Proposed
- Created: 05-Oct-2022
- Implemented: Implemented
- Last edited: 12-Oct-2022
- License: CC0
- Forking: Soft-fork
Storage rent is applied to boxes with an age of 4 years or more. The age of the box is determined by current block height and the boxes self-reported creation height. The box can be spent by miners when the following expression is true:
preHeader.height - box.creationHeight > 30 * 24 * 365 * 4
Boxes self-report their creation height. While there is an upper limit set by the current block height, boxes reporting a lower creation height are allowed to be used in transactions. That means that boxes with creationHeight 0 can be created, and can be spent by miners immediately after block 1,051,200. This is especially a problem for contracts anyone can spend and create transactions on. Outboxes can be created with a creation height far in the past unintentional or maliciously, leading to a complete spending and token burn in worst case.
Contracts can be hardened to disallow this by checking their outboxes creation height. However, this had to be done for every single contract on its own. That's why we suggest to add a check on protocol level.
Suggestion to solve this problem on protocol level is to introduce a monotonic creation height rule as follows:
For every transaction that is submitted to the network, it should be validated if the following expression is satisfied:
val highestInputBoxHeight = INPUTS.maxOf { input: Box => input.creationHeight }
OUTPUTS.allOf { output: Box => output.creationHeight >= highestInputBoxHeight }
or in spoken words
All creation heights of output boxes of a transaction must be equal or higher than the highest creation height of the transaction's input boxes.