Fixes to expiration time handling#32
Open
zie1ony wants to merge 1 commit into
Open
Conversation
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.
This pull request updates how expiration timestamps are handled and stored for name tokens, ensuring that the original precision provided by off-chain components (potentially in microseconds) is preserved in metadata, while all on-chain logic and comparisons consistently operate in milliseconds. The changes improve clarity, maintain data fidelity, and update tests to reflect the new behavior.
Expiration timestamp handling and storage:
The
NameTokenMetadatastruct now stores the expiration timestamp verbatim as provided (which may be in microseconds), and only normalizes to milliseconds when the value is read for on-chain logic or comparison. This change applies to both registration and renewal flows, ensuring metadata always preserves the original precision. [1] [2] [3] [4] [5]The normalization of expiration timestamps is now performed only in the
expiration()getter method, and not during construction, mutation, or deserialization ofNameTokenMetadata. This ensures that serialization and storage always reflect the raw value provided by off-chain components. [1] [2]Test updates and improvements:
Tests for registration and renewal have been updated to verify that the raw microsecond timestamp is preserved in metadata, and that normalization occurs only on read for on-chain checks. Additional assertions ensure that serialization round-trips the original value. [1] [2] [3] [4]
Test names and comments have been updated for clarity, reflecting the new behavior regarding metadata preservation and normalization on read. [1] [2] [3] [4]