@@ -393,7 +393,7 @@ func (r *Layer2Relayer) ProcessPendingBatches() {
393393 codecVersion := encoding .CodecVersion (dbBatch .CodecVersion )
394394 switch codecVersion {
395395 case encoding .CodecV0 , encoding .CodecV1 , encoding .CodecV2 :
396- calldata , err = r .constructCommitBatchPayloadCodecV0AndV1AndV2 (dbBatch , dbParentBatch , dbChunks , chunks )
396+ calldata , blob , err = r .constructCommitBatchPayloadCodecV0AndV1AndV2 (dbBatch , dbParentBatch , dbChunks , chunks )
397397 if err != nil {
398398 log .Error ("failed to construct commitBatch payload for V0/V1/V2" , "codecVersion" , codecVersion , "index" , dbBatch .Index , "err" , err )
399399 return
@@ -638,7 +638,7 @@ func (r *Layer2Relayer) finalizeBatch(dbBatch *orm.Batch, withProof bool) error
638638 return fmt .Errorf ("failed to construct finalizeBatch payload codecv1, index: %v, err: %w" , dbBatch .Index , err )
639639 }
640640 } else { // >= codecv3
641- log .Info ("encoding is codecv3, using finalizeBundle instead" , "index" , dbBatch .Index )
641+ log .Debug ("encoding is codecv3, using finalizeBundle instead" , "index" , dbBatch .Index )
642642 return nil
643643 }
644644
@@ -932,35 +932,42 @@ func (r *Layer2Relayer) handleL2RollupRelayerConfirmLoop(ctx context.Context) {
932932 }
933933}
934934
935- func (r * Layer2Relayer ) constructCommitBatchPayloadCodecV0AndV1AndV2 (dbBatch * orm.Batch , dbParentBatch * orm.Batch , dbChunks []* orm.Chunk , chunks []* encoding.Chunk ) ([]byte , error ) {
935+ func (r * Layer2Relayer ) constructCommitBatchPayloadCodecV0AndV1AndV2 (dbBatch * orm.Batch , dbParentBatch * orm.Batch , dbChunks []* orm.Chunk , chunks []* encoding.Chunk ) ([]byte , * kzg4844. Blob , error ) {
936936 codec , err := encoding .CodecFromVersion (encoding .CodecVersion (dbBatch .CodecVersion ))
937937 if err != nil {
938- return nil , fmt .Errorf ("failed to get codec from version: %w" , err )
938+ return nil , nil , fmt .Errorf ("failed to get codec from version: %w" , err )
939939 }
940940
941- daBatch , err := codec .NewDABatchFromBytes (dbBatch .BatchHeader )
942- if err != nil {
943- return nil , fmt .Errorf ("failed to create DA batch from bytes: %w" , err )
941+ batch := & encoding.Batch {
942+ Index : dbBatch .Index ,
943+ TotalL1MessagePoppedBefore : dbChunks [0 ].TotalL1MessagesPoppedBefore ,
944+ ParentBatchHash : common .HexToHash (dbParentBatch .Hash ),
945+ Chunks : chunks ,
946+ }
947+
948+ daBatch , createErr := codec .NewDABatch (batch )
949+ if createErr != nil {
950+ return nil , nil , fmt .Errorf ("failed to create DA batch: %w" , createErr )
944951 }
945952
946953 encodedChunks := make ([][]byte , len (dbChunks ))
947954 for i , c := range dbChunks {
948955 daChunk , createErr := codec .NewDAChunk (chunks [i ], c .TotalL1MessagesPoppedBefore )
949956 if createErr != nil {
950- return nil , fmt .Errorf ("failed to create DA chunk: %w" , createErr )
957+ return nil , nil , fmt .Errorf ("failed to create DA chunk: %w" , createErr )
951958 }
952959 daChunkBytes , encodeErr := daChunk .Encode ()
953960 if encodeErr != nil {
954- return nil , fmt .Errorf ("failed to encode DA chunk: %w" , encodeErr )
961+ return nil , nil , fmt .Errorf ("failed to encode DA chunk: %w" , encodeErr )
955962 }
956963 encodedChunks [i ] = daChunkBytes
957964 }
958965
959966 calldata , packErr := r .l1RollupABI .Pack ("commitBatch" , daBatch .Version (), dbParentBatch .BatchHeader , encodedChunks , daBatch .SkippedL1MessageBitmap ())
960967 if packErr != nil {
961- return nil , fmt .Errorf ("failed to pack commitBatch: %w" , packErr )
968+ return nil , nil , fmt .Errorf ("failed to pack commitBatch: %w" , packErr )
962969 }
963- return calldata , nil
970+ return calldata , daBatch . Blob (), nil
964971}
965972
966973func (r * Layer2Relayer ) constructCommitBatchPayloadCodecV3AndV4 (dbBatch * orm.Batch , dbParentBatch * orm.Batch , dbChunks []* orm.Chunk , chunks []* encoding.Chunk ) ([]byte , * kzg4844.Blob , error ) {
0 commit comments