runtime: Inline solana_sha256_hasher::extend_and_hash#7028
Merged
joncinque merged 2 commits intoanza-xyz:masterfrom Jul 21, 2025
Merged
runtime: Inline solana_sha256_hasher::extend_and_hash#7028joncinque merged 2 commits intoanza-xyz:masterfrom
solana_sha256_hasher::extend_and_hash#7028joncinque merged 2 commits intoanza-xyz:masterfrom
Conversation
#### Problem `solana_sha256_hasher::extend_and_hash` requires dynamic allocation because of the vec creation, which means adding a `std` feature to the crate. However, the function is only used in one place, so it would be easier to remove it and simplify the hasher crate. #### Summary of changes Inline the usage of `extend_and_hash` so it can be safely removed from the hasher crate.
This is a good reason for doing this change. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #7028 +/- ##
=========================================
- Coverage 83.2% 83.2% -0.1%
=========================================
Files 853 853
Lines 374950 374950
=========================================
- Hits 312093 312091 -2
- Misses 62857 62859 +2 🚀 New features to boost your workflow:
|
febo
reviewed
Jul 17, 2025
febo
approved these changes
Jul 18, 2025
puhtaytow
pushed a commit
to puhtaytow/agave
that referenced
this pull request
Jul 24, 2025
* runtime: Inline `extend_and_hash` #### Problem `solana_sha256_hasher::extend_and_hash` requires dynamic allocation because of the vec creation, which means adding a `std` feature to the crate. However, the function is only used in one place, so it would be easier to remove it and simplify the hasher crate. #### Summary of changes Inline the usage of `extend_and_hash` so it can be safely removed from the hasher crate. * Simplify extend_and_hash impl
joncinque
added a commit
to joncinque/solana-sdk
that referenced
this pull request
Jul 25, 2025
#### Problem As noted in anza-xyz/agave#7028, the `extend_and_hash` function is unnecessary and creates another allocation, so we inlined it in Agave. #### Summary of changes Deprecate it formally in the crate. This PR will be backported to v2.x and published, so we can remove the function in a follow-up PR.
joncinque
added a commit
to anza-xyz/solana-sdk
that referenced
this pull request
Jul 25, 2025
#### Problem As noted in anza-xyz/agave#7028, the `extend_and_hash` function is unnecessary and creates another allocation, so we inlined it in Agave. #### Summary of changes Deprecate it formally in the crate. This PR will be backported to v2.x and published, so we can remove the function in a follow-up PR.
joncinque
added a commit
to joncinque/solana-sdk
that referenced
this pull request
Jul 25, 2025
#### Problem As noted in anza-xyz/agave#7028, the `extend_and_hash` function is unnecessary and creates another allocation, so we inlined it in Agave. #### Summary of changes Deprecate it formally in the crate. This PR will be backported to v2.x and published, so we can remove the function in a follow-up PR.
joncinque
added a commit
to joncinque/solana-sdk
that referenced
this pull request
Jul 25, 2025
#### Problem As noted in anza-xyz/agave#7028, the `extend_and_hash` function is unnecessary and creates another allocation, so we inlined it in Agave. #### Summary of changes Deprecate it formally in the crate. This PR will be backported to v2.x and published, so we can remove the function in a follow-up PR.
joncinque
added a commit
to anza-xyz/solana-sdk
that referenced
this pull request
Jul 25, 2025
#251) sha256-hasher: Deprecate `extend_and_hash` #### Problem As noted in anza-xyz/agave#7028, the `extend_and_hash` function is unnecessary and creates another allocation, so we inlined it in Agave. #### Summary of changes Deprecate it formally in the crate. This PR will be backported to v2.x and published, so we can remove the function in a follow-up PR.
joncinque
added a commit
to joncinque/solana-sdk
that referenced
this pull request
Jul 25, 2025
#### Problem As mentioned in anza-xyz/agave#7028, the `extend_and_hash` function is unnecessary and creates another allocation, so we inlined it in Agave. #### Summary of changes Since it's been properly marked as deprecated, remove it.
joncinque
added a commit
to anza-xyz/solana-sdk
that referenced
this pull request
Jul 25, 2025
#### Problem As mentioned in anza-xyz/agave#7028, the `extend_and_hash` function is unnecessary and creates another allocation, so we inlined it in Agave. #### Summary of changes Since it's been properly marked as deprecated, remove it.
febo
pushed a commit
to febo/solana-sdk
that referenced
this pull request
Sep 21, 2025
#### Problem As noted in anza-xyz/agave#7028, the `extend_and_hash` function is unnecessary and creates another allocation, so we inlined it in Agave. #### Summary of changes Deprecate it formally in the crate. This PR will be backported to v2.x and published, so we can remove the function in a follow-up PR.
febo
pushed a commit
to febo/solana-sdk
that referenced
this pull request
Sep 21, 2025
#### Problem As mentioned in anza-xyz/agave#7028, the `extend_and_hash` function is unnecessary and creates another allocation, so we inlined it in Agave. #### Summary of changes Since it's been properly marked as deprecated, remove it.
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.
Problem
solana_sha256_hasher::extend_and_hashrequires dynamic allocation because of the vec creation, which means adding astdfeature to the crate.However, the function is only used in one place, so it would be easier to remove it and simplify the hasher crate.
Summary of changes
Inline the usage of
extend_and_hashso it can be safely removed from the hasher crate.For reference, here is the current implementation of
extend_and_hash: https://github.com/anza-xyz/solana-sdk/blob/020e730cdac5806447aafefe5e53afb049c18a3d/sha256-hasher/src/lib.rs#L62-L66