Skip to content

Support for SHA512 and SHA384 syscalls - #260

Merged
piotmag769 merged 5 commits into
mainfrom
support-for-sha-512-384-syscalls
Jul 14, 2026
Merged

piotmag769 merged 5 commits into
mainfrom
support-for-sha-512-384-syscalls

Conversation

@wawel37

@wawel37 wawel37 commented Jul 3, 2026 •

Copy link
Copy Markdown
Member

Closes #255

Introduced changes

Checklist

  • Linked relevant issue
  • Updated relevant documentation (README.md)
  • Added relevant tests
  • Performed self-review of the code
  • Added changes to CHANGELOG.md

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds profiler support for the Cairo Sha512ProcessBlock syscall (and validates SHA-384 behavior via its SHA-512 syscall usage), aligning the profiler with newer Cairo/Sierra changes.

Changes:

  • Recognize Sha512ProcessBlock as a syscall in trace parsing and syscall-selector mapping.
  • Add Sha512ProcessBlock cost data to versioned constants (resource file + test fixtures).
  • Add an e2e test suite + Cairo test contract + synthetic traces to validate syscall usage/steps/sierra-gas reporting for SHA-512 (and SHA-384 via SHA-512).

Reviewed changes

Copilot reviewed 16 out of 19 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/cairo-profiler/src/trace_reader/function_trace_builder.rs Treat Sha512ProcessBlock as a syscall during function-level profiling collection.
crates/cairo-profiler/src/trace_reader/function_trace_builder/stack_trace.rs Map Sha512ProcessBlock libfunc to the corresponding syscall selector.
crates/cairo-profiler/resources/versioned_constants_0_14_1.json Add step/builtin costs for Sha512ProcessBlock.
crates/cairo-profiler/tests/e2e.rs Add e2e coverage for viewing SHA-512 syscall usage/steps/sierra-gas and SHA-384 emitting SHA-512 syscall usage.
crates/cairo-profiler/tests/data/test_versioned_constants.json Add Sha512ProcessBlock entry to the test constants fixture.
crates/cairo-profiler/tests/data/missing_syscall_versioned_constants.json Add Sha512ProcessBlock entry to the “missing syscall” fixture (still missing CallContract).
crates/cairo-profiler/tests/contracts/sha_hashes/src/lib.cairo Add a Starknet test contract exposing sha512_hash and sha384_hash.
crates/cairo-profiler/tests/contracts/sha_hashes/tests/test_contract.cairo Add snforge test invoking sha512_hash.
crates/cairo-profiler/tests/contracts/sha_hashes/Scarb.toml Add Scarb project definition for the test contract.
crates/cairo-profiler/tests/contracts/sha_hashes/Scarb.lock Add lockfile for the test contract dependencies.
crates/cairo-profiler/tests/contracts/sha_hashes/precompiled/trace_sha_hashes.json Add synthetic trace exercising Sha512ProcessBlock via syscall_counter.
crates/cairo-profiler/tests/contracts/sha_hashes/precompiled/trace_sha_hashes_multi_call.json Add synthetic trace validating call-count scaling for Sha512ProcessBlock.
crates/cairo-profiler/tests/contracts/sha_hashes/precompiled/trace_sha_hashes_sierra_gas.json Add synthetic trace validating sierra-gas reporting with gas tracking fields.
crates/cairo-profiler/tests/contracts/sha_hashes/precompiled/trace_sha384.json Add synthetic trace validating SHA-384 emits Sha512ProcessBlock syscall usage.
crates/cairo-profiler/tests/contracts/sha_hashes/precompiled/sha_hashes_integrationtest_ShaHashes.test.contract_class.json Add compiled Sierra artifact used as reference/fixture.
crates/cairo-profiler/tests/contracts/sha_hashes/precompiled/README.md Document how the synthetic traces and precompiled artifacts were created and how to regenerate.
Cargo.toml Bump Cairo-related workspace deps to versions that include SHA-512 syscall changes.
Cargo.lock Lockfile updates corresponding to dependency bumps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/cairo-profiler/tests/contracts/sha_hashes/precompiled/README.md Outdated
Comment thread crates/cairo-profiler/resources/versioned_constants_0_14_1.json
Comment thread crates/cairo-profiler/tests/e2e.rs Outdated
@wawel37
wawel37 requested a review from piotmag769 July 6, 2026 10:36
Comment thread crates/cairo-profiler/tests/e2e.rs Outdated
Comment thread crates/cairo-profiler/tests/e2e.rs Outdated
@piotmag769
piotmag769 force-pushed the support-for-sha-512-384-syscalls branch 4 times, most recently from a5a1437 to 98e8ba0 Compare July 14, 2026 14:09
@piotmag769
piotmag769 enabled auto-merge July 14, 2026 14:10
@piotmag769
piotmag769 added this pull request to the merge queue Jul 14, 2026
@piotmag769
piotmag769 removed this pull request from the merge queue due to a manual request Jul 14, 2026
@piotmag769
piotmag769 force-pushed the support-for-sha-512-384-syscalls branch from 98e8ba0 to b35f618 Compare July 14, 2026 14:28
@piotmag769
piotmag769 enabled auto-merge July 14, 2026 14:29
@piotmag769
piotmag769 disabled auto-merge July 14, 2026 14:31
@piotmag769
piotmag769 added this pull request to the merge queue Jul 14, 2026
@piotmag769
piotmag769 removed this pull request from the merge queue due to a manual request Jul 14, 2026
@piotmag769
piotmag769 force-pushed the support-for-sha-512-384-syscalls branch from b35f618 to bc19a2b Compare July 14, 2026 14:47
@piotmag769
piotmag769 added this pull request to the merge queue Jul 14, 2026
Merged via the queue into main with commit 7212643 Jul 14, 2026
4 checks passed
@piotmag769
piotmag769 deleted the support-for-sha-512-384-syscalls branch July 14, 2026 14:55
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.

Check compatibility with new cairo sierra changes regarding SHA512 and SHA382

4 participants