feat(runtime): implement SIMD-0512 enable_sha512_syscall#1575
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
26f1063 to
4e2bdad
Compare
4e2bdad to
1fbfd57
Compare
Adds sol_sha512 syscall, matching agave and firedancer: - Flip enable_sha512_syscall (s512oDwgx8hjMnaQjXfqqrZroVj4HvC6TkN3iSSWXCh) in features.zon from .unsupported to .supported. - Generalize hashSyscall to use H.Hasher.digest_length instead of a hard-coded [32]u8 result buffer (behavior-preserving for sha256, keccak256, and blake3; enables the 64-byte digest required by sha512). - Add hash.sha512 export wrapping std.crypto.hash.sha2.Sha512. - Register sol_sha512 in the Syscall enum, the syscall map, and the feature gate table (gated on enable_sha512_syscall). - Add a unit test mirroring agave's test_syscall_sha512 to cover the 64-byte digest path end-to-end through the VM memory map. Cost model reuses sha256_max_slices, sha256_base_cost, sha256_byte_cost and mem_op_base_cost as specified by SIMD-0512 and as implemented in both agave (compute_cost.sha256_*) and firedancer (FD_VM_SHA256_*).
ajw221
approved these changes
Jun 11, 2026
hamza-syndica
approved these changes
Jun 15, 2026
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.
Intent
sol_sha512as a new syscall to BPF programs, gated on theenable_sha512_syscallfeature.sha256,keccak256,blake3).Implementation
hashSyscall(comptime H: type)no longer hard-codes[32]u8for the result region; it now uses[H.Hasher.digest_length]u8so the same template produces both 32- and 64-byte hashers.sha512syscall, wrappingstd.crypto.hash.sha2.Sha512.sol_sha512in theSyscallenum, wires it into the dispatch table, and gates it on.enable_sha512_syscall.enable_sha512_syscallentry from.unsupported(with a "Not scheduled for activation" note) to.supportedand adds the SIMD-0512 description.The CU cost reuses the existing
sha256_base_cost/sha256_byte_costbudget knobs, matching agave'ssha512syscall, which doesn't introduce dedicated cost fields.Gating
sol_sha512is only visible to programs onceenable_sha512_syscall(s512oDwgx8hjMnaQjXfqqrZroVj4HvC6TkN3iSSWXCh) is active for the current slot, via the standard syscall-feature-gate mechanism. With the feature inactive the syscall is unregistered, matching agave's behaviour.References
programs/bpf_loader/src/syscalls/mod.rs(SyscallSha512)src/flamenco/runtime/program/fd_bpf_loader_program.c(sol_sha512)Tests
test sha512in hash.zig — hashes two scattered VM slices ("Gaggablaghblagh!"and"flurbos"), asserts the 64-byte digest matchesstd.crypto.hash.sha2.Sha512computed locally, and exercises the same access-violation matrix (mis-aligned source, out-of-bounds source length, mis-aligned destination, exhausted compute meter) as the existingsha256test.Fuzzing: TODO (need to tweak kunorpus to generate sol_sha512 fixtures)
Follow-ups
None.