-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: add EIP-7594 (PeerDAS) blob support #4022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add EIP-7594 (PeerDAS) blob support #4022
Conversation
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 detectedLatest commit: 371f001 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
a06a712 to
ad047bf
Compare
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
commit: |
|
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. |
| /** Blob version (EIP-4844 or EIP-7594). Defaults to '4844'. */ | ||
| blobVersion?: '4844' | '7594' | undefined |
There was a problem hiding this comment.
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.
| // Sepolia uses EIP-7594 | ||
| if (chainId === 11_155_111) return '7594' |
There was a problem hiding this comment.
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?
6c033f5 to
371f001
Compare
Updates viem to `@spalladino/[email protected]` See wevm/viem#4022 Builds on #17697 --------- Co-authored-by: PhilWindle <[email protected]>
Implements EIP-7594 blob transaction support alongside existing EIP-4844 blobs.
Fixes #4021
BREAKING CHANGES:
blobsToProofsnow returnsHex[][]orByteArray[][]instead of flat arrays[[proof]](one proof per blob, wrapped in array)[[proof1, ...proof128], ...](128 cell proofs per blob)BlobSidecar.prooftype now acceptstype | type[]to support both formatsFeatures:
blobVersionparameter ('4844' | '7594') to blob-related methodsgetBlobVersionhelper for chain-based version selectioncomputeCellsAndKzgProofsin KZG interface0x01in transaction serializationImplementation:
blobsToProofs: Returns array of proof arrays, usescomputeCellsAndKzgProofsfor EIP-7594toBlobSidecars: Handles proof arrays, unwraps single proofs for EIP-4844serializeTransaction: Flattens proof arrays, adds version byte for EIP-7594parseTransaction: Groups proofs by blob dynamically based on countgetBlobVersion: Auto-detects version from chain ID with override supportDocumentation:
blobVersionparameter docs toblobsToProofsandtoBlobSidecarsDependencies:
@paulmillr/trusted-setupsto 0.3.0 (PeerDAS support)micro-eth-signerto 0.17.3 (includescomputeCellsAndProofs)🤖 Generated with Claude Code