Skip to content

blake2s: BLAKE2s-256 on the round-function delegation for ZKsync OS guests - #14

Merged
maximmenshikov merged 2 commits into
mainfrom
feat/blake2s-delegation
Nov 28, 2026
Merged

maximmenshikov merged 2 commits into
mainfrom
feat/blake2s-delegation

Conversation

@LukaszRozmej

Copy link
Copy Markdown
Member

Changes

  • New src/blake2s.c with two entry points for ZKsync OS guests:
    • airbender_blake2s256(data, len, out): BLAKE2s-256 of a buffer.
    • airbender_blake2s_compress(state, block, counter, final): one compression.
  • Both run the compression on Airbender's BLAKE2s round-function delegation (CSR 0x7c7), ten rounds per compression, which is the round count the 7a147da transpiler accepts.
  • build/build.sh builds and exports both; tests/harness.c and tests/run.py add vectors for both entry points; README lists them.

Measured on the Nethermind ZKsync OS Airbender guest (Airbender CLI 7a147da, raw cycles), with the guest's Blake2s256 moved from managed code to these entry points. Public input is unchanged on every block:

Block Managed BLAKE2s This PR Change
transfers 4.41M 1.63M -63%
erc20 5.92M 2.59M -56%
opcodes 5.69M 2.42M -57%
storage 5.50M 2.51M -54%
storage-second-block 5.19M 2.16M -58%
invalid-txs 4.75M 1.94M -59%

The guest's BLAKE2s round counts are within 1% of zksync-os's own program on the same blocks.

Testing

  • build/ci.sh: all 1569 vectors and the existing host, platform and ISA checks pass.
  • The guest gives the reference public input on all ZKsync OS reference blocks.

Remarks

The Nethermind side (Blake2s256 zkevm variant and its binding) waits for a release with these entry points.

🤖 AI agent (Claude Code / Opus 5.5) on behalf of @LukaszRozmej

…uests

Adds airbender_blake2s256 and airbender_blake2s_compress, which run ten rounds per delegation call on CSR 0x7c7 (the round count the current transpiler accepts). Host harness vectors cover both entry points.
@maximmenshikov
maximmenshikov merged commit 6ce3887 into main Nov 28, 2026
5 checks passed
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.

2 participants