Repository navigation
test(patch-testing): add sha2 0.11.0 - #2971
Merged
fakedev9999 merged 4 commits intoSep 21, 2026
Merged
Conversation
This was referenced Sep 14, 2026
revm-precompile 42 requires sha2 0.11, and a `[patch.crates-io]` entry only applies to the version it names, so 0.10.9's patch leaves 0.11 unaccelerated. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
sebastianst
force-pushed
the
sha2-0.11-patch-test
branch
from
September 14, 2026 15:40
3dbc782 to
b4b24b4
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.
Why
revm-precompile42 requiressha2 = "0.11". SP1 accelerates SHA-256 by replacing thesha2crate through
[patch.crates-io], and a patch only applies to the exact version it names — sopatch-sha2-0.10.9-sp1-6.2.0does nothing for a graph that resolvessha2to 0.11. Programs thatpull in revm 42 silently drop to the soft backend and stop emitting
SHA_EXTEND/SHA_COMPRESS.The 0.11 patch itself landed as sp1-patches/RustCrypto-hashes#10 and is
tagged
patch-sha2-0.11.0-sp1-6.2.0. This PR adds thepatch-testingcoverage for it, so 0.11 isvalidated the same way every other
sha2version already is. Tracking issue on our side:ethereum-optimism/optimism#22890.
What
A
sha2_v0_11_0case mirroringsha2_v0_10_9:sha/program/Cargo.toml: optionalsha2-v0-11-0dep,v0-11-0feature,[[bin]], and the[patch.crates-io]entry that swaps in the patched crate for the guest.sha/program/bin/sha2.rs: theextern crate … as sha2alias behindv0-11-0.sha/build.rs: build the guest for the new feature.sha/src/lib.rs:#[sp1_test("sha2_v0_11_0", syscalls = [SHA_COMPRESS, SHA_EXTEND], gpu, prove)].Cargo.toml/build-host/Cargo.toml:sha2-v0-11-0-patched, so the patch is also compiled forthe host target alongside the other patched crates.
Both patch sources point at the released
patch-sha2-0.11.0-sp1-6.2.0tag, written the same way asthe neighbouring 0.10.9 entries.
sha20.11 moves todigest0.11, but the surface this test uses is unchanged —Digest::new,update, andfinalize().into()to[u8; 32]all still work — sobin/sha2.rsneeded nothingbeyond the new alias, and the host-side expected-digest helper is shared verbatim with the 0.10.9
case.
Validation
Run locally against this branch, SP1 toolchain from
sp1up(cargo-prove sp1 58c4aea,succinctrustc 1.96.0-dev), CPU executor, no proving:
6 passed, 0 failed, as does
cargo check -p build-host --release. The new case emits bothprecompiles and matches the host digests (cycle counts vary slightly run to run, since part of the
corpus is random):
test_sha2_v0_11_0_expected_digest_lte_100_timestest_sha2_v0_10_9_expected_digest_lte_100_timesAn extra ad-hoc run over a corpus covering the empty input, one-block, multi-block, and inputs
sliced at odd offsets (to hit the unaligned-first-block branch of the patch) gave byte-identical
digests to host
sha20.11 and identical syscall counts for 0.11 and 0.10.9:SHA_COMPRESS = 117,SHA_EXTEND = 117.🤖 Co-created with Claude Fable 5.1