feat(storage): add TTL/rent-bumping logic for contract storage (Closes #1923)#2079
Open
Carlys17 wants to merge 2 commits into
Open
feat(storage): add TTL/rent-bumping logic for contract storage (Closes #1923)#2079Carlys17 wants to merge 2 commits into
Carlys17 wants to merge 2 commits into
Conversation
Contributor
|
Hi well done on the job done so far! |
- Remove unused imports (StellarAssetClient, TokenClient, LedgerInfo) - Prefix unused params in extend_entry_ttl with underscores - Use const assertions for compile-time constant checks - Replace len() >= 0 with !is_empty() for usize comparison - Remove empty line after doc attribute in initialize() - Align test_snapshots with main
Carlys17
force-pushed
the
feat/ttl-rent-bumping-1923
branch
from
July 23, 2026 14:47
0e0f309 to
7045eea
Compare
Contributor
|
Well done on the job done so far! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements explicit TTL/rent-bumping management for all contract storage (issue #1923).
This contract stores ALL state via
env.storage().instance(). Since instance storage is a single logical entry, a single instance-TTL bump keeps every key alive together. We now bump the instance TTL at the start of every state-mutating entrypoint.Changes
src/ttl.rs(new): TTL helpers + constants (DEFAULT_TTL_THRESHOLD= ~30 days,DEFAULT_TTL_EXTEND_TO= ~120 days)src/lib.rs:bump_instance_ttl()called at start of each write entrypointSNAPSHOT_MANAGEMENT.md: documents the TTL modeltests/test_storage.rs: 7 new tests covering extension and contract flowsgas_baselines.json: updated (TTL extension adds ~10-40% gas per write, expected)Acceptance Criteria
Test Plan
cargo fmtpassescargo testpasses (all 400+ tests green)Closes #1923