Skip to content

perf(utils): slice calldata arrays in Yul without dynamic memory copies - #902

Merged
mijinummi merged 1 commit into
MDTechLabs:mainfrom
Agbasimere:feat/yul-calldata-slicer
Aug 22, 2026
Merged

perf(utils): slice calldata arrays in Yul without dynamic memory copies#902
mijinummi merged 1 commit into
MDTechLabs:mainfrom
Agbasimere:feat/yul-calldata-slicer

Conversation

@Agbasimere

Copy link
Copy Markdown
Contributor

Summary

  • Add CalldataSlicer, a Yul utility that extracts dynamically sized calldata arrays via calldataload (offset pointer + length word) and returns zero-copy slices.
  • Slices can be passed straight into low-level verifier loops without allocating a dynamic memory buffer; bounds checks revert with SliceOutOfBounds.
  • Covered by Hardhat tests for bytes / bytes32[] / address[] slices, nested ABI extraction, free-memory-pointer invariance, verifier pass-through, and array-bounds reverts.

Test plan

  • cargo test (CI) — passed
  • pnpm run build (CI) — passed
  • hardhat test test/utils/CalldataSlicer.test.ts — 28 passing

Closes: #845

@mijinummi
mijinummi merged commit 207edb3 into MDTechLabs:main Aug 22, 2026
1 check passed
@mijinummi

Copy link
Copy Markdown
Collaborator

LGTM

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.

[PERF] Build Yul Calldata Array Slicer for Batch Message Proofs

2 participants