performance(sierra-to-casm): Changed felt252 deseralization to be based on an iterator.#9465
Conversation
5 tasks
This was referenced Jan 13, 2026
Collaborator
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
…ed on an iterator. Vastly reducing the number of BigInt clones performed. SIERRA_UPDATE_PATCH_CHANGE_TAG=Internal change only.
5bdde35 to
c943c75
Compare
e397122 to
86e315e
Compare
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
Refactored the
Felt252Serdetrait to use iterators instead of slices for deserialization. This changes the trait'sdeserializemethod signature from returning a tuple of(Self, &[BigUintAsHex])to just returningSelfand taking a mutable iterator of&BigUintreferences. Also updated thedecompressfunction to return a vector of&BigUintinstead of mutating an output vector.Type of change
Why is this change needed?
The current implementation of deserialization passes slices around and returns the remaining slice after each deserialization step. This approach is less efficient and more error-prone than using iterators. The iterator-based approach simplifies the code and makes it more maintainable while potentially improving performance.
What was the behavior or documentation before?
The
Felt252Serdetrait'sdeserializemethod took a slice ofBigUintAsHexand returned a tuple containing the deserialized value and the remaining slice. Thedecompressfunction took an output vector parameter that it would mutate with the decompressed values.What is the behavior or documentation after?
The
Felt252Serdetrait'sdeserializemethod now takes a mutable iterator of&BigUintreferences and returns just the deserialized value. Thedecompressfunction now returns a vector of&BigUintreferences instead of mutating an output parameter.Additional context
A TODO comment was added to validate that changing the
version_id_from_felt252sfunction is acceptable and to make it iterator-based as well in the future.