Add a “Max Extension” Parameter to TTL Extension to Improve Extension Fee #1825
Replies: 2 comments
-
|
+1 to this request! It might seem like a small change but I believe this would greatly expand the ways in which contract builders optimize their storage strategies to improve the average cost of transactions for most users. |
Beta Was this translation helpful? Give feedback.
-
|
I think this seems very reasonable, and I'm honestly a bit surprised that this hasn't come up sooner. The current TTL extension interface is not perfect by any means, and it was based on our intuition of what would be the minimal usable way to manage TTL from within the contract. It definitely can be improved. Another idea that I've got is to provide a limit for the maximum extension fee, either in addition to the maximum extension proposed here, or instead of it. Or even provide a purely fee-based extension function, in order to spread out the fees among users in a more even fashion. Does anyone have any thoughts on this? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
In the current TTL extension flow, many contracts implement self-extension using fixed parameters such as:
This approach introduces a significant cost issue:
When a contract entry (instance or code) has very low remaining TTL — for example, 1 day — any user interacting with the contract will trigger an extension from 1 day → 30 days, forcing that user to pay rent for roughly 29 days.
For large contracts, this can be unexpectedly expensive and creates unfair cost allocation among users.
This becomes especially problematic for contracts that are used infrequently.
Limitations of Current Workarounds
1. Small threshold & small extension window
Developers can set:
This limits fee spikes, but introduces a new risk:
Thus, the tradeoff becomes unacceptable for certain applications.
2. Idea: Set
extend_to = current_ttl + 1 dayThis would spread rent cost across users by allowing small incremental extensions.
However, this approach is not feasible today: Contracts cannot read TTL on-chain, so they cannot compute
current_ttl + 1 day.Proposed Solution: Add a “Max Extension” Parameter
Introduce a new parameter in the TTL extension host function:
Behavior Example
If a contract specifies:
And the current TTL is only 1 day:
Request
I’d like to propose adding a
max_extensionparameter to the TTL extension host function and include this enhancement in protocol development.This feature would greatly improve:
Beta Was this translation helpful? Give feedback.
All reactions