@@ -209,7 +209,7 @@ func (m *SimpleTxManager) Close() {
209209}
210210
211211func (m * SimpleTxManager ) txLogger (tx * types.Transaction , logGas bool ) log.Logger {
212- fields := []any {"tx" , tx .Hash (), "nonce" , tx .Nonce ()}
212+ fields := []any {"tx" , tx .Hash (). Hex () , "nonce" , tx .Nonce ()}
213213 if logGas {
214214 fields = append (fields , "gasTipCap" , tx .GasTipCap (), "gasFeeCap" , tx .GasFeeCap (), "gasLimit" , tx .Gas ())
215215 }
@@ -364,7 +364,8 @@ func (m *SimpleTxManager) craftTx(ctx context.Context, candidate TxCandidate) (*
364364 if candidate .To == nil {
365365 return nil , errors .New ("blob txs cannot deploy contracts" )
366366 }
367- if sidecar , blobHashes , err = MakeSidecar (candidate .Blobs ); err != nil {
367+ // Use configuration to determine whether to enable cell proofs
368+ if sidecar , blobHashes , err = MakeSidecar (candidate .Blobs , m .cfg .EnableCellProofs ); err != nil {
368369 return nil , fmt .Errorf ("failed to make sidecar: %w" , err )
369370 }
370371 }
@@ -492,10 +493,23 @@ func (m *SimpleTxManager) SetBumpFeeRetryTime(val time.Duration) {
492493}
493494
494495// MakeSidecar builds & returns the BlobTxSidecar and corresponding blob hashes from the raw blob
495- // data.
496- func MakeSidecar (blobs []* eth.Blob ) (* types.BlobTxSidecar , []common.Hash , error ) {
497- sidecar := & types.BlobTxSidecar {}
496+ // data with configurable cell proof support.
497+ func MakeSidecar (blobs []* eth.Blob , enableCellProofs bool ) (* types.BlobTxSidecar , []common.Hash , error ) {
498+ var sidecar * types.BlobTxSidecar
499+ if enableCellProofs {
500+ sidecar = & types.BlobTxSidecar {
501+ Proofs : make ([]kzg4844.Proof , 0 , len (blobs )* kzg4844 .CellProofsPerBlob ),
502+ Version : types .BlobSidecarVersion1 , // Use Version1 for cell proofs (Fusaka compatibility)
503+ }
504+ } else {
505+ sidecar = & types.BlobTxSidecar {
506+ Proofs : make ([]kzg4844.Proof , 0 , len (blobs )),
507+ Version : types .BlobSidecarVersion0 , // Use Version0 for legacy blob proofs
508+ }
509+ }
510+
498511 blobHashes := make ([]common.Hash , 0 , len (blobs ))
512+
499513 for i , blob := range blobs {
500514 rawBlob := blob .KZGBlob ()
501515 sidecar .Blobs = append (sidecar .Blobs , * rawBlob )
@@ -504,13 +518,24 @@ func MakeSidecar(blobs []*eth.Blob) (*types.BlobTxSidecar, []common.Hash, error)
504518 return nil , nil , fmt .Errorf ("cannot compute KZG commitment of blob %d in tx candidate: %w" , i , err )
505519 }
506520 sidecar .Commitments = append (sidecar .Commitments , commitment )
507- proof , err := kzg4844 .ComputeBlobProof (rawBlob , commitment )
508- if err != nil {
509- return nil , nil , fmt .Errorf ("cannot compute KZG proof for fast commitment verification of blob %d in tx candidate: %w" , i , err )
510- }
511- sidecar .Proofs = append (sidecar .Proofs , proof )
512521 blobHashes = append (blobHashes , eth .KZGToVersionedHash (commitment ))
522+ if enableCellProofs {
523+ // Version1: Use cell proofs for Fusaka compatibility
524+ cellProofs , err := kzg4844 .ComputeCellProofs (rawBlob )
525+ if err != nil {
526+ return nil , nil , fmt .Errorf ("cannot compute KZG cell proofs for blob %d in tx candidate: %w" , i , err )
527+ }
528+ sidecar .Proofs = append (sidecar .Proofs , cellProofs ... )
529+ } else {
530+ // Version0: Use legacy blob proofs
531+ proof , err := kzg4844 .ComputeBlobProof (rawBlob , sidecar .Commitments [i ])
532+ if err != nil {
533+ return nil , nil , fmt .Errorf ("cannot compute KZG proof for fast commitment verification of blob %d in tx candidate: %w" , i , err )
534+ }
535+ sidecar .Proofs = append (sidecar .Proofs , proof )
536+ }
513537 }
538+
514539 return sidecar , blobHashes , nil
515540}
516541
0 commit comments