From d11a0c6327f6e71371bb237e368fdbc0d33f03a6 Mon Sep 17 00:00:00 2001 From: colinlyguo Date: Mon, 19 Aug 2024 18:24:13 +0800 Subject: [PATCH] simplify --- coordinator/go.mod | 2 +- coordinator/go.sum | 4 ++-- .../logic/provertask/batch_prover_task.go | 16 ++-------------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/coordinator/go.mod b/coordinator/go.mod index 1a0f0dcfe..903676efa 100644 --- a/coordinator/go.mod +++ b/coordinator/go.mod @@ -7,7 +7,7 @@ require ( github.com/gin-gonic/gin v1.9.1 github.com/go-resty/resty/v2 v2.7.0 github.com/mitchellh/mapstructure v1.5.0 - github.com/scroll-tech/da-codec v0.0.0-20240818122843-6901956c9910 + github.com/scroll-tech/da-codec v0.0.0-20240819090825-ed4de9e92f76 github.com/scroll-tech/go-ethereum v1.10.14-0.20240626125436-418bc6f728b6 github.com/shopspring/decimal v1.3.1 github.com/stretchr/testify v1.9.0 diff --git a/coordinator/go.sum b/coordinator/go.sum index 471bcf16e..d7d9fc4c1 100644 --- a/coordinator/go.sum +++ b/coordinator/go.sum @@ -173,8 +173,8 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/scroll-tech/da-codec v0.0.0-20240818122843-6901956c9910 h1:c2siFeESs8MgppUAoatnkbnQMoFTq2DPT0TEdZFPbok= -github.com/scroll-tech/da-codec v0.0.0-20240818122843-6901956c9910/go.mod h1:D6XEESeNVJkQJlv3eK+FyR+ufPkgVQbJzERylQi53Bs= +github.com/scroll-tech/da-codec v0.0.0-20240819090825-ed4de9e92f76 h1:vEeJL5GEM8pOSGtwxNvkRQycBq5Y1J+5M5WilwxKPjM= +github.com/scroll-tech/da-codec v0.0.0-20240819090825-ed4de9e92f76/go.mod h1:D6XEESeNVJkQJlv3eK+FyR+ufPkgVQbJzERylQi53Bs= github.com/scroll-tech/go-ethereum v1.10.14-0.20240626125436-418bc6f728b6 h1:Q8YyvrcPIcXQwE4ucm4bqmPh6TP6IB1GUTXripf2WyQ= github.com/scroll-tech/go-ethereum v1.10.14-0.20240626125436-418bc6f728b6/go.mod h1:byf/mZ8jLYUCnUePTicjJWn+RvKdxDn7buS6glTnMwQ= github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE= diff --git a/coordinator/internal/logic/provertask/batch_prover_task.go b/coordinator/internal/logic/provertask/batch_prover_task.go index b7276074d..109acc98b 100644 --- a/coordinator/internal/logic/provertask/batch_prover_task.go +++ b/coordinator/internal/logic/provertask/batch_prover_task.go @@ -273,26 +273,14 @@ func (bp *BatchProverTask) getBatchTaskDetail(ctx context.Context, dbBatch *orm. return nil, fmt.Errorf("failed to create DA batch (v3) for batch %d: %w", dbBatch.Index, createErr) } taskDetail.BlobBytes = daBatch.Blob()[:] - - batchHeader, decodeErr := codecv3.NewDABatchFromBytes(dbBatch.BatchHeader) - if decodeErr != nil { - return nil, fmt.Errorf("failed to decode batch header (v3) for batch %d: %w", dbBatch.Index, decodeErr) - } - - taskDetail.BatchHeader = batchHeader + taskDetail.BatchHeader = daBatch.Encode() } else { daBatch, createErr := codecv4.NewDABatch(batchEncoding, dbBatch.EnableEncode) if createErr != nil { return nil, fmt.Errorf("failed to create DA batch (v4) for batch %d: %w", dbBatch.Index, createErr) } taskDetail.BlobBytes = daBatch.Blob()[:] - - batchHeader, decodeErr := codecv4.NewDABatchFromBytes(dbBatch.BatchHeader) - if decodeErr != nil { - return nil, fmt.Errorf("failed to decode batch header (v4) for batch %d: %w", dbBatch.Index, decodeErr) - } - - taskDetail.BatchHeader = batchHeader + taskDetail.BatchHeader = daBatch.Encode() } return taskDetail, nil