Catalyst icon indicating copy to clipboard operation
Catalyst copied to clipboard

Extend the Ethereum style accounts with the storage size information.

Open tkstanczak opened this issue 4 years ago • 0 comments

Each account should store a STORAGE_SIZE value which should be incremented each time the SSTORE operation is called so the value changes from zero to non-zero and decremented each time the SSTORE is called which changes the value from non-zero to zero.

Then we should also store the STORAGE_TIMESTAMP of the last STORAGE_SIZE change. Whenever STORAGE_SIZE changes the STORAGE_TIMESTAMP should be updated to the current value of timestamp.

Each time the STORAGE_SIZE is changed the account should be charged (CURRENT_TIMESTAMP - STORAGE_TIMESTAMP) * RENT_PRICE * STORAGE_SIZE. Then the STORAGE_TIMESTAMP should be updated with the CURRENT_TIMESTAMP and STORAGE_SIZE incremented or decremented.

If the contract cannot pay for the storage it should be marked as evicted and all its storage should be removed from the state and moved to DFS. The contract can be brought back from the DFS.

Each account should have a boolean value IS_EVICTED. Whenever the account is restored the STORAGE_ROOT of the account has to be compared with the STORAGE_ROOT of the restored data,

tkstanczak avatar Sep 09 '19 00:09 tkstanczak