Conversation
Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d3f00-3838-7357-870f-e511f80eb152
Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d3f00-3838-7357-870f-e511f80eb152
dankrad
reviewed
Mar 30, 2026
dankrad
reviewed
Mar 30, 2026
Overwrites to slots already nonzero in the current epoch use SSTORE-equivalent hot/cold pricing instead of the flat 40k. A nonzero value in the previous epoch only does not qualify — still incurs the 40k new-slot cost. Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d3f00-3838-7357-870f-e511f80eb152
Storage key is uint16(epoch) ++ keccak256(sender || key)[0:30] in the precompile's own storage trie. Adds a full reference Solidity mock demonstrating the key derivation and epoch fallback logic. Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d3f00-3838-7357-870f-e511f80eb152
EVM convention is to keep the low-order (rightmost) bytes when truncating hashes (e.g. address = keccak256(pubkey)[12:32]). Updated spec text from [0:30] to [2:32] to match — the Solidity mock was already correct. Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d3f00-3838-7357-870f-e511f80eb152
uint16 wraps after 2^16 epochs (2^32 blocks). uint32 supports 2^32 epochs (2^48 blocks) before wrap-around, removing any practical lifetime concern. Hash truncation goes from 30 to 28 bytes (224 bits), still more than enough. Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d3f00-3838-7357-870f-e511f80eb152
Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d3f00-3838-7357-870f-e511f80eb152
Replaces the prefixed-key-in-single-account layout with separate accounts per epoch (PRECOMPILE_ADDRESS + n + 1). This lets nodes prune expired epochs by dropping entire accounts instead of scanning individual slots. Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d3fed-b1f0-71ac-bbe2-1caeabc2bf51
dankrad
reviewed
Mar 30, 2026
dankrad
reviewed
Mar 30, 2026
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.
Adds TIP-1040: a precompile for epoch-scoped temporary key-value storage. Values are available for 2^16 to 2^17 blocks then automatically expire. Nodes can prune anything older than the previous epoch.
Key design points:
keccak256(sender || key)scoped peruint16(epoch)— sender-isolated, no cross-contract collisions.Prompted by: dankrad