Open AbdelStark opened 2 years ago
Could you share a couple test vectors? I could work on a branch that does that, just would like to ensure I get the serialization right. I like the idea of using ssz-rs.
Could you share a couple test vectors? I could work on a branch that does that, just would like to ensure I get the serialization right. I like the idea of using ssz-rs.
Please find a sample JSON file with test vectors here: eip4844_test_vectors_sample_1.json
The code to generate the sample is also available here: test-vectors
To generate new test vectors you can:
go test
Discord: https://discord.com/channels/595666850260713488/595701195843174434/1024344939959697498
Sweet. Will give a shot by this weekend.
Dived into this, rough notes below. The biggest thing we're missing is a Rust function for blobs.ComputeCommitmentsAndAggregatedProof()
. Everything else is basic type defs and conversions.
Generating a proof will mean we need to also have the KZG G1 trusted setup parameters loaded. Presumably these would be loaded via the Provider/SignerMiddleware, and we could consider distributing them with the library as an optional feature.
Find Rust KZG library which exposes what we need https://github.com/mdehoog/go-ethereum/blob/e5291efded799e80f6e8b77f21b45fa6bbc0b2d3/core/types/data_blob.go#L353-L398
Figure out how to SSZ serialize https://github.com/mdehoog/go-ethereum/commit/fce14ba9348950e746c712081dbd9c3fa99bd2c5#diff-d32f17b8a6d7109add632096d016f4cb111673ad2168034ecbced8af07d77822R517
new transaction type After confirmed -> Option? Like we do for BaseFee. https://github.com/mdehoog/go-ethereum/blob/e5291efded799e80f6e8b77f21b45fa6bbc0b2d3/core/types/data_blob_tx.go#L318
BlobVersionedHashes: versionedHashes,
Submit with KZG Proof on new tx type https://github.com/Inphi/blob-utils/blob/4fab45306c1406e122a12cb7c0f0d28bb8a69afa/utils.go#L14-L50 https://github.com/Inphi/eip4844-interop/blob/master/shared/blobs.go#L9-L45
blobs := shared.EncodeBlobs(data) commitments, versionedHashes, aggregatedProof, err := blobs.ComputeCommitmentsAndAggregatedProof()
How to pass the trusted setup? Add it as a builder-pattern parameter to the provider? And to the signer?
new header field https://github.com/mdehoog/go-ethereum/blob/eip-4844/core/types/block.go#L91-L92 excess_blobs (camelcase)
test it out against prod https://github.com/Inphi/eip4844-interop/blob/69392f4ff7d6339dabcd9cb1f4bf65d4480f9600/tests/fee-market/main.go https://github.com/Inphi/blob-utils/blob/4fab45306c1406e122a12cb7c0f0d28bb8a69afa/download.go
Misc:
We might be able to use this library for the proof / commitments gen https://github.com/crate-crypto/proto-danksharding-crypto/tree/master/crypto
For ssz seralize, lighthouse's internal ssz crate is worth looking into as it's battle tested and used on mainnet.
It's a self contained package that doesn't depend on any lighthouse modules, so it can easily be included in ethers-rs. It's missing a few things for EIP-4844, like a Bytes48
ssz codec and hash_tree_root
implementation needed for KZG commitments.
Flagging @asn-d6's library too https://github.com/asn-d6/blobbers
Any update on this? With 4844 approaching this seems like something that would be helpful
Context
EIP-4844 introduces a new transaction type, using EIP-2718 mechanism.
As @gakonst mentioned:
Originally posted by @gakonst in https://github.com/gakonst/ethers-rs/issues/1685#issuecomment-1243048983
Feature
Implement a new transaction type in
ethers-rs
to enable developers to use shard blob transactions.According to the EIP specification, the new transaction type encoding is the following:
SSZ encoding
The new transaction is then: a single byte
BLOB_TX_TYPE
(0x05) followed by an SSZ encoding of theSignedBlobTransaction
container.It means that
ethers-rs
needs a way to encode and decode using SSZ format. As far as I know, currently there is no way to use SSZ encoding. We should then think about how we want to add this encoding, some alternatives:Open design questions
External implementations and tooling
There is currently a Devnet v1 running with a Geth fork for the EL and a Prysm fork for the CL.
Geth
For the Geth fork this is the implementation of shard blob transactions: see data_blob_tx.go
blob-utils
blob-utils
is a CLI tool to send and download blobs on the proto-danksharding devnet.