Skip to content

runtime: Inline solana_sha256_hasher::extend_and_hash#7028

Merged
joncinque merged 2 commits intoanza-xyz:masterfrom
joncinque:inline-extend-and-hash
Jul 21, 2025
Merged

runtime: Inline solana_sha256_hasher::extend_and_hash#7028
joncinque merged 2 commits intoanza-xyz:masterfrom
joncinque:inline-extend-and-hash

Conversation

@joncinque
Copy link
Copy Markdown

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.

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

#### 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.
febo
febo previously approved these changes Jul 17, 2025
Copy link
Copy Markdown

@febo febo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@febo
Copy link
Copy Markdown

febo commented Jul 17, 2025

However, the function is only used in one place, so it would be easier to remove it and simplify the hasher crate.

This is a good reason for doing this change.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.2%. Comparing base (a344d1e) to head (daeebf2).
Report is 10 commits behind head on master.

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread runtime/src/bank.rs Outdated
Copy link
Copy Markdown

@febo febo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@joncinque joncinque merged commit 57b252c into anza-xyz:master Jul 21, 2025
41 checks passed
@joncinque joncinque deleted the inline-extend-and-hash branch July 21, 2025 10:18
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants