docs(tip-1040): epoch-scoped temporary storage precompile#3879
Open
decofe wants to merge 3 commits into
Open
Conversation
Reopened from #3366. Epoch-based expiring storage with automatic pruning. Values live for 2^16 to 2^17 blocks, scoped per epoch account. Amp-Thread-ID: https://ampcode.com/threads/T-019e12a5-b71d-72db-afef-0fcd16f065d5
Key changes from original: - temporaryStore now takes numEpochs (1-512) for configurable lifetime - Tiered gas pricing: 20k (1 epoch) -> 250k (181-512 epochs) - temporaryLoad scans backwards from current epoch to find live entries - New temporaryLoadExpiry returns value + remaining lifetime - MAX_EXPIRY_EPOCHS=512 covers ~1 year at 1s blocks - Pruning remains deterministic: epoch account E droppable when current_epoch > E + MAX_EXPIRY_EPOCHS Motivated by MPP session duration flexibility. Amp-Thread-ID: https://ampcode.com/threads/T-019e12a5-b71d-72db-afef-0fcd16f065d5
This was referenced May 11, 2026
… (day/week/month/year) Replaces the variable numEpochs + backward-scanning design with four fixed epoch tiers. Each tier uses the original simple 2-epoch model (current + previous), eliminating: - Backward scan across up to 512 epoch accounts on load - Per-entry metadata slot for individual expiry tracking - Unpredictable load gas costs Tiers: day (~18h, 20k gas), week (~6d, 80k), month (~24d, 160k), year (~388d, 250k). At most 8 live epoch accounts total (2 per tier). Amp-Thread-ID: https://ampcode.com/threads/T-019e2218-8522-7664-9b02-c1f731c33f19
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.
Reopened from #3366 for renewed discussion.
TIP-1040: Epoch-Scoped Temporary Storage
Approach: Epoch-based expiring storage. Values written in epoch E are readable in epochs E and E+1, then automatically expire.
Key design points
keccak256(sender || key)in a per-epoch account — sender-isolated, no collisions.temporaryStore: 40k gas for new slots, SSTORE-equivalent for overwrites.temporaryLoad: EIP-2929 cold/warm model (2,100 / 100 gas), falls back to previous epoch.Tradeoffs vs TIP-1048 (MEV-based)
See thread discussion: https://tempoxyz.slack.com/archives/C0A761BDJ6P/p1774624334588709
cc @klkvr @dankrad