Skip to content

Commit

Permalink
Revert "simplify"
Browse files Browse the repository at this point in the history
This reverts commit d11a0c6.
  • Loading branch information
colinlyguo committed Aug 19, 2024
1 parent d11a0c6 commit bfb150b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion coordinator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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-20240819090825-ed4de9e92f76
github.com/scroll-tech/da-codec v0.0.0-20240818122843-6901956c9910
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
Expand Down
4 changes: 2 additions & 2 deletions coordinator/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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-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/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/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=
Expand Down
16 changes: 14 additions & 2 deletions coordinator/internal/logic/provertask/batch_prover_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,26 @@ 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()[:]
taskDetail.BatchHeader = daBatch.Encode()

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
} 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()[:]
taskDetail.BatchHeader = daBatch.Encode()

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
}

return taskDetail, nil
Expand Down

0 comments on commit bfb150b

Please sign in to comment.