Skip to content

Conversation

@spalladino
Copy link
Contributor

@spalladino spalladino commented Oct 14, 2025

Implements EIP-7594 blob transaction support alongside existing EIP-4844 blobs.

Fixes #4021

BREAKING CHANGES:

  • blobsToProofs now returns Hex[][] or ByteArray[][] instead of flat arrays
    • EIP-4844: Returns [[proof]] (one proof per blob, wrapped in array)
    • EIP-7594: Returns [[proof1, ...proof128], ...] (128 cell proofs per blob)
  • BlobSidecar.proof type now accepts type | type[] to support both formats

Features:

  • Add optional blobVersion parameter ('4844' | '7594') to blob-related methods
  • Automatic blob version detection based on chain ID (Sepolia uses EIP-7594)
  • Add getBlobVersion helper for chain-based version selection
  • Support for computeCellsAndKzgProofs in KZG interface
  • EIP-7594 uses wrapper version byte 0x01 in transaction serialization
  • Transaction parsing handles both 4-element (EIP-4844) and 5-element (EIP-7594) wrappers

Implementation:

  • blobsToProofs: Returns array of proof arrays, uses computeCellsAndKzgProofs for EIP-7594
  • toBlobSidecars: Handles proof arrays, unwraps single proofs for EIP-4844
  • serializeTransaction: Flattens proof arrays, adds version byte for EIP-7594
  • parseTransaction: Groups proofs by blob dynamically based on count
  • getBlobVersion: Auto-detects version from chain ID with override support

Documentation:

  • Update blob transaction guide with EIP-7594 information
  • Add blobVersion parameter docs to blobsToProofs and toBlobSidecars
  • Document proof structure differences between EIP-4844 and EIP-7594

Dependencies:

  • Update @paulmillr/trusted-setups to 0.3.0 (PeerDAS support)
  • Update micro-eth-signer to 0.17.3 (includes computeCellsAndProofs)

🤖 Generated with Claude Code

Implements EIP-7594 blob transaction support alongside existing EIP-4844 blobs.

BREAKING CHANGES:
- `blobsToProofs` now returns `Hex[][]` or `ByteArray[][]` instead of flat arrays
  - EIP-4844: Returns `[[proof]]` (one proof per blob, wrapped in array)
  - EIP-7594: Returns `[[proof1, ...proof128], ...]` (128 cell proofs per blob)
- `BlobSidecar.proof` type now accepts `type | type[]` to support both formats

Features:
- Add optional `blobVersion` parameter ('4844' | '7594') to blob-related methods
- Automatic blob version detection based on chain ID (Sepolia uses EIP-7594)
- Add `getBlobVersion` helper for chain-based version selection
- Support for `computeCellsAndKzgProofs` in KZG interface
- EIP-7594 uses wrapper version byte `0x01` in transaction serialization
- Transaction parsing handles both 4-element (EIP-4844) and 5-element (EIP-7594) wrappers

Implementation:
- `blobsToProofs`: Returns array of proof arrays, uses `computeCellsAndKzgProofs` for EIP-7594
- `toBlobSidecars`: Handles proof arrays, unwraps single proofs for EIP-4844
- `serializeTransaction`: Flattens proof arrays, adds version byte for EIP-7594
- `parseTransaction`: Groups proofs by blob dynamically based on count
- `getBlobVersion`: Auto-detects version from chain ID with override support

Documentation:
- Update blob transaction guide with EIP-7594 information
- Add `blobVersion` parameter docs to `blobsToProofs` and `toBlobSidecars`
- Document proof structure differences between EIP-4844 and EIP-7594

Tests:
- Add comprehensive EIP-7594 test coverage (128 tests passing)
- Mock KZG implementation with `computeCellsAndKzgProofs` for testing
- Test serialization, parsing, and round-trip for both blob versions
- Verify automatic chain-based version detection

Dependencies:
- Update `@paulmillr/trusted-setups` to 0.3.0 (PeerDAS support)
- Update `micro-eth-signer` to 0.17.3 (includes `computeCellsAndProofs`)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@changeset-bot
Copy link

changeset-bot bot commented Oct 14, 2025

🦋 Changeset detected

Latest commit: 371f001

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@spalladino spalladino force-pushed the feat/eip-7594-support-for-blob-txs branch from a06a712 to ad047bf Compare October 14, 2025 17:09
@socket-security
Copy link

socket-security bot commented Oct 14, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​paulmillr/​trusted-setups@​0.1.2 ⏵ 0.3.081 -110094 +284 +4100
Updatedmicro-eth-signer@​0.14.0 ⏵ 0.17.3100 +1100100 +1100 +10100

View full report

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 14, 2025

Open in StackBlitz

npm i https://pkg.pr.new/viem@4022

commit: 371f001

@spalladino
Copy link
Contributor Author

I see a bunch of tests are failing, my guess is because the PR does not have access to env vars for executing actual requests? Let me know if there's anything I should adjust to make the CI less angry.

@spalladino
Copy link
Contributor Author

I've tested this manually using the sendRawTransaction.test.ts test against both Sepolia and Hoodi (since it has not yet activated Fusaka), and both worked fine.

Comment on lines +379 to +380
/** Blob version (EIP-4844 or EIP-7594). Defaults to '4844'. */
blobVersion?: '4844' | '7594' | undefined
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I found it easier to just add a blobVersion to the TransactionSerializableEIP4844 type, but we could also just add a whole new TransactionSerializableEIP7594 type. If we did this, we could also have differentiated BlobSidecar types.

Comment on lines +49 to +50
// Sepolia uses EIP-7594
if (chainId === 11_155_111) return '7594'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if there's a cleaner version for doing this. We could add a new setting to src/chains/definitions/sepolia.ts and all other chains that have implemented this fork. Still, this would require updating viem again on the time the fork kicks in. Is there a precedent for handling breaking JSON RPC API changes at a fork?

@spalladino spalladino force-pushed the feat/eip-7594-support-for-blob-txs branch from 6c033f5 to 371f001 Compare October 15, 2025 08:48
spypsy pushed a commit to AztecProtocol/aztec-packages that referenced this pull request Oct 15, 2025
Updates viem to `@spalladino/[email protected]`
    
See wevm/viem#4022

Builds on #17697

---------

Co-authored-by: PhilWindle <[email protected]>
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.

EIP-4844 Blob Transactions Failing on Sepolia After Fusaka Upgrade

1 participant