sha256-hasher: Deprecate extend_and_hash#250
Merged
joncinque merged 1 commit intoanza-xyz:masterfrom Jul 25, 2025
Merged
Conversation
#### 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
reviewed
Jul 25, 2025
|
|
||
| /// Return the hash of the given hash extended with the given value. | ||
| #[deprecated(since = "2.3.0", note = "Use `hashv(&[hash.as_ref(), val])` directly")] | ||
| pub fn extend_and_hash(id: &Hash, val: &[u8]) -> Hash { |
Contributor
There was a problem hiding this comment.
Would it make sense to replace the implementation with hashv(&[id.as_ref(), &val]) given that it is what people should be doing directly?
Collaborator
Author
There was a problem hiding this comment.
That's a good point. If there were more users of this function, we probably should. But in this case, I'm happier to limit the API surface 😅
febo
approved these changes
Jul 25, 2025
Contributor
febo
left a comment
There was a problem hiding this comment.
Looks great! Just left a comment that might not be applicable.
Contributor
|
The backport to To backport manually, run these commands in your terminal: # Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-maintenance/v2.x maintenance/v2.x
# Navigate to the new working tree
cd .worktrees/backport-maintenance/v2.x
# Create a new branch
git switch --create backport-250-to-maintenance/v2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 75f6556dfdaad065e3077c4bd2f29390d0764aed
# Push it to GitHub
git push --set-upstream origin backport-250-to-maintenance/v2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-maintenance/v2.xThen, create a pull request where the |
Collaborator
Author
|
Eh, I'll just do the backport manually then. |
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.
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
As noted in anza-xyz/agave#7028, the
extend_and_hashfunction 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.