aptos-core
aptos-core copied to clipboard
[Bug] Gas schedule disincentivizes global storage deallocation
Presently, storage_gas.move charges for creating, reading, and overwriting items in global storage, but offers no refund, rebate, etc. for deallocation. Similarly, instr.rs charges for move_from() operations and borrow operations. Hence:
- Users are strictly charged for deallocating table entries,
- Users are strictly charged for deallocating vector elements, including options, and
- Users are strictly charged for deallocating resources having the
keyattribute,
Which means that a rational economic actor will never deallocate from global storage.
@lightmark @vgao1996 @davidiw @wrwg @CapCap @chen-robert @runtian-zhou
@msmouse
Yeah I agree with you in principle. Been wondering if we can at least set the gas costs of move_from to 0, but still need to think a little bit harder about potential attack vectors.
Summary of our follow-up discussion from yesterday:
Refunding storage costs to the extent of negative gas fees introduces:
- Inflationary events: if enough storage were to be freed up, then the result would be a negative gas cost on the transaction, which would require the generation of new
APT. - Land grab incentivization: if storage costs increase with utilization, the rational economic actor will buy storage when cheap then sell it back once utilization has hit a threshold.
Hence paying out negative transaction fees is impractical.
Refunding storage costs to the point where transaction gas drops to 0 is practical, however, because actors are incentivized to free storage, as it may diminish the cost per transaction to 0. E.g. move_from<T>() pays a rebate of 100 gas, for instance, but if the transaction would otherwise only cost 80 gas, the transaction cost simply becomes 0 rather than -20.
Notably, this incentive may result in amortized deallocations: if an actor will get a rebate of 2000 total, they will save more by deallocating over the course of 5 transactions that would otherwise cost 400 gas units, rather than during one transaction that would otherwise cost 600 gas units.
This issue is stale because it has been open 45 days with no activity. Remove the stale label or comment - otherwise this will be closed in 15 days.
We have these high level efforts road mapped wrt gas costs https://medium.com/aptoslabs/the-path-to-10x-lower-gas-fees-on-aptos-with-community-driven-feedback-7cca875a513f And details for storage specifically will come out in the coming months.