stellar / rs-soroban-env

Rust environment for Soroban contracts.
Apache License 2.0
60 stars 39 forks source link

SAC should write balances with max expiration #1096

Open tomerweller opened 9 months ago

tomerweller commented 9 months ago

Currently balance bumps are hardcoded for 30 days: https://github.com/stellar/rs-soroban-env/blob/main/soroban-env-host/src/native_contract/token/storage_types.rs#L9

dmkozh commented 2 weeks ago

It's been a while since this has been filed and we've released Soroban with 30 days. However, the semantics is not as simple:

Increasing the initial TTL to the max value is not an obvious choice. Since balance entries belong to contracts, it is possible that the contract itself is not meant to be used for that long (think claimable balance style contract). Basically, from the fees standpoint it's always better to do the minimum extension only and let the users to bump the rent explicitly if necessary. Even the current default behavior might be too aggressive for some use cases.

I think the only potential improvement here is to allow the token admin to change the TTL settings, though even then it's not obvious that admin is in the right position to determine the rent/fee policy for all token users. Thus I'd like to see a case for that feature before implementing it.

As for this particular issue, I'm inclined to close it - @tomerweller please let me know if you have any objections.