Skip to content

Conversation

@AntonD3
Copy link
Contributor

@AntonD3 AntonD3 commented Oct 29, 2025

What ❔

This PR implements support for EIP-4844 blob-based data availability (DA) commitment scheme in ZKsync OS.

Key Changes:

  • New DA Commitment Scheme: Introduces DACommitmentScheme::BlobsZKsyncOS for blob-based data availability
  • Blob Commitment Generator: Implements BlobCommitmentGenerator that encodes pubdata into EIP-4844 blobs using 31-byte chunks
  • KZG Point Evaluation: the point evaluation logic system function was restructured to be reused during blob commitment verification
  • Oracle Integration: New blob commitment and proof oracle for external blob advice. It's used to get the commitment and the proof from the external source, to not spend cycles inside ZKsync OS on calculations
  • Testing: Test coverage including unit tests, fuzz testing, and integration tests

Key Features for BlobsZKsyncOS DA commitment scheme

  • Blob Encoding: Encodes pubdata into blobs with 31-byte chunks, supporting up to 9 blobs
  • EIP-4844 Versioned Hashes: Generates KZG versioned hashes with version byte 0x01
  • Cryptographic Verification: Full KZG proof verification using BLS12-381 curve
  • Performance Optimization: Pre-computed bit-reversed roots of unity for polynomial operations

Breaking changes:

  • Updated proof run interfaces to support different DA commitment schemes

Is this a breaking change?

  • Yes
  • No (backward compatible with previous versions)

Checklist

  • PR title corresponds to the body of PR (we generate changelog entries from PRs).
  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • Code has been formatted.

Base automatically changed from ad-support-blobs-p1 to dev October 30, 2025 13:04
Base automatically changed from dev to main November 3, 2025 04:07
@AntonD3 AntonD3 marked this pull request as ready for review November 4, 2025 13:19
@AntonD3 AntonD3 changed the base branch from main to dev November 4, 2025 13:24
Copy link
Contributor

@antoniolocascio antoniolocascio left a comment

Choose a reason for hiding this comment

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

I think we need some testing for it. Both integration and fuzzing for blob encoding/advice computation.

@AntonD3
Copy link
Contributor Author

AntonD3 commented Nov 5, 2025

@antoniolocascio, agree about testing, can you point me to some fuzz tests as an example?

Regarding integration tests I added a e2e test in the multiblock-batch, also I was thinking about unit tests to cover many blobs. Do think it's enough? Any other ideas?

@antoniolocascio
Copy link
Contributor

Yes, unit tests for encoding would be nice. For fuzzing: not sure how many implementations we'll end up having. In the current style, I would fuzz consistency of the blob_commitment_and_proof_advice on native vs the callable oracle one. If we unify this, then maybe just smoke fuzzing the encode (with different size datas) or even take random data -> encode -> check the point eval. Basically just feed random data to blob_versioned_hash() and see if it panics. The random data should cover interesting cases for lengths, but maybe we can have those as unit tests

AntonD3 and others added 6 commits November 12, 2025 13:42
## What ❔

Simplification

<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- The `Why` has to be clear to non-Matter Labs entities running their
own ZK Chain -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Is this a breaking change?
- [ ] Yes
- [ ] No

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted.
@AntonD3
Copy link
Contributor Author

AntonD3 commented Nov 12, 2025

Point evaluation native usage increased by 1.5m, will check

## What ❔

Tests

## Why ❔

To test

## Is this a breaking change?
- [ ] Yes
- [X] No

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [X] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [X] Tests for the changes have been added / updated.
- [X] Documentation comments have been added / updated.
- [X] Code has been formatted.
Copy link
Contributor

@0xVolosnikov 0xVolosnikov left a comment

Choose a reason for hiding this comment

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

Lgtm. Would be nice to check the compatibility of our encoding with Alloy.
Also we can additionally improve fuzzing/test coverage later.

Copy link
Contributor

@antoniolocascio antoniolocascio left a comment

Choose a reason for hiding this comment

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

LGTM, please add a description to the PR

0xVolosnikov and others added 3 commits November 13, 2025 09:14
## What ❔

Test

## Why ❔

Check encoding

## Is this a breaking change?
- [ ] Yes
- [ ] No

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted.
@github-actions
Copy link
Contributor

Benchmark report

Benchmark Symbol Base Eff Head Eff (%) Base Raw Head Raw (%) Base Blake Head Blake (%) Base Bigint Head Bigint (%)
block_19299001 run_prepared 310,825,485 310,905,565 (+0.03%) 268,159,709 268,239,789 (+0.03%) 410,610 410,610 (+0.00%) 9,024,004 9,024,004 (+0.00%)
block_22244135 run_prepared 191,072,649 191,053,265 (-0.01%) 164,156,589 164,137,205 (-0.01%) 172,020 172,020 (+0.00%) 6,040,935 6,040,935 (+0.00%)
precompiles bn254_ecadd 53,197 53,197 (+0.00%) 47,745 47,745 (+0.00%) 0 0 (+0.00%) 1,363 1,363 (+0.00%)
precompiles bn254_ecmul 731,034 731,034 (+0.00%) 566,846 566,846 (+0.00%) 0 0 (+0.00%) 41,047 41,047 (+0.00%)
precompiles bn254_pairing 72,689,618 72,689,618 (+0.00%) 58,161,474 58,161,474 (+0.00%) 0 0 (+0.00%) 3,632,036 3,632,036 (+0.00%)
precompiles ecrecover 480,457 480,954 (+0.10%) 311,933 312,230 (+0.10%) 0 0 (+0.00%) 42,131 42,181 (+0.12%)
precompiles id 933 933 (+0.00%) 933 933 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles keccak 137,578 137,578 (+0.00%) 137,578 137,578 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles modexp 32,084,944 32,084,944 (+0.00%) 21,427,124 21,427,124 (+0.00%) 0 0 (+0.00%) 2,664,455 2,664,455 (+0.00%)
precompiles p256_verify 750,874 750,874 (+0.00%) 472,182 472,182 (+0.00%) 0 0 (+0.00%) 69,673 69,673 (+0.00%)
precompiles point_evaluation 51,158,377 52,714,741 (+3.04%) 39,535,749 41,092,113 (+3.94%) 0 0 (+0.00%) 2,905,657 2,905,657 (+0.00%)
precompiles process_transaction 73,835,708 73,838,923 (+0.00%) 59,132,324 59,141,075 (+0.01%) 160 160 (+0.00%) 3,675,206 3,673,822 (-0.04%)
precompiles ripemd 8,028 8,028 (+0.00%) 8,028 8,028 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles run_prepared 148,134,039 148,152,223 (+0.01%) 118,666,115 118,670,791 (+0.00%) 5,050 5,050 (+0.00%) 7,346,781 7,350,158 (+0.05%)
precompiles sha256 13,167 13,167 (+0.00%) 13,167 13,167 (+0.00%) 0 0 (+0.00%) 0 0 (+0.00%)
precompiles verify_and_apply_batch 132,197 132,169 (-0.02%) 97,477 97,449 (-0.03%) 2,170 2,170 (+0.00%) 0 0 (+0.00%)

@AntonD3
Copy link
Contributor Author

AntonD3 commented Nov 13, 2025

Point evaluation native usage increased by 1.5m, will check

I am merging PR to not block the release; performance degradation can be investigated later

@AntonD3 AntonD3 merged commit 3ac07ce into dev Nov 13, 2025
18 checks passed
@AntonD3 AntonD3 deleted the ad-support-blobs-p2 branch November 13, 2025 17:46
0xVolosnikov pushed a commit that referenced this pull request Nov 14, 2025
## What ❔

#367 introduced a performance regression, this PR fixes that by inlining
the call to `verify_kzg_proof`

<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- The `Why` has to be clear to non-Matter Labs entities running their
own ZK Chain -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Is this a breaking change?
- [ ] Yes
- [X] No

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted.
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.

3 participants