mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-12 07:28:08 -05:00
Compare commits
3 Commits
v4.4.26-de
...
v4.4.31
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f1576a4e91 | ||
|
|
4e3dc52db3 | ||
|
|
8471838cd4 |
@@ -21,6 +21,8 @@ RUN --mount=target=. \
|
||||
# Pull gas_oracle into a second stage deploy ubuntu container
|
||||
FROM ubuntu:20.04
|
||||
|
||||
RUN apt update && apt install ca-certificates -y
|
||||
|
||||
ENV CGO_LDFLAGS="-ldl"
|
||||
|
||||
COPY --from=builder /bin/gas_oracle /bin/
|
||||
|
||||
@@ -21,6 +21,8 @@ RUN --mount=target=. \
|
||||
# Pull rollup_relayer into a second stage deploy ubuntu container
|
||||
FROM ubuntu:20.04
|
||||
|
||||
RUN apt update && apt install ca-certificates -y
|
||||
|
||||
ENV CGO_LDFLAGS="-ldl"
|
||||
|
||||
COPY --from=builder /bin/rollup_relayer /bin/
|
||||
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"runtime/debug"
|
||||
)
|
||||
|
||||
var tag = "v4.4.26"
|
||||
var tag = "v4.4.27"
|
||||
|
||||
var commit = func() string {
|
||||
if info, ok := debug.ReadBuildInfo(); ok {
|
||||
|
||||
@@ -3,7 +3,6 @@ package provertask
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"time"
|
||||
@@ -191,7 +190,7 @@ func (bp *BatchProverTask) doAssignTaskWithinChunkRange(ctx *gin.Context, taskCt
|
||||
func (bp *BatchProverTask) getChunkRangeByName(ctx *gin.Context, hardForkName string) (*chunkIndexRange, error) {
|
||||
hardForkNumber, err := bp.getHardForkNumberByName(hardForkName)
|
||||
if err != nil {
|
||||
// log.Error("batch assign failure because of the hard fork name don't exist", "fork name", hardForkName)
|
||||
log.Error("batch assign failure because of the hard fork name don't exist", "fork name", hardForkName)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -247,7 +246,10 @@ func (bp *BatchProverTask) assignWithTwoCircuits(ctx *gin.Context, taskCtx *prov
|
||||
for i := 0; i < 2; i++ {
|
||||
hardForkNames[i] = bp.reverseVkMap[getTaskParameter.VKs[i]]
|
||||
chunkRanges[i], err = bp.getChunkRangeByName(ctx, hardForkNames[i])
|
||||
if err == nil && chunkRanges[i] != nil {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if chunkRanges[i] != nil {
|
||||
if chunkRange == nil {
|
||||
chunkRange = chunkRanges[i]
|
||||
} else {
|
||||
@@ -256,8 +258,7 @@ func (bp *BatchProverTask) assignWithTwoCircuits(ctx *gin.Context, taskCtx *prov
|
||||
}
|
||||
}
|
||||
if chunkRange == nil {
|
||||
log.Error("chunkRange empty")
|
||||
return nil, errors.New("chunkRange empty")
|
||||
return nil, nil
|
||||
}
|
||||
var hardForkName string
|
||||
getHardForkName := func(batch *orm.Batch) (string, error) {
|
||||
|
||||
@@ -3,7 +3,6 @@ package provertask
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
@@ -182,31 +181,21 @@ func (cp *ChunkProverTask) assignWithTwoCircuits(ctx *gin.Context, taskCtx *prov
|
||||
blockRanges [2]*blockRange
|
||||
err error
|
||||
)
|
||||
var blockRange *blockRange
|
||||
for i := 0; i < 2; i++ {
|
||||
hardForkNames[i] = cp.reverseVkMap[getTaskParameter.VKs[i]]
|
||||
blockRanges[i], err = cp.getBlockRangeByName(hardForkNames[i])
|
||||
if err == nil && blockRanges[i] != nil {
|
||||
if blockRange == nil {
|
||||
blockRange = blockRanges[i]
|
||||
} else {
|
||||
var err2 error
|
||||
blockRange, err2 = blockRange.merge(*blockRanges[i])
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if blockRange == nil {
|
||||
log.Error("blockRange empty")
|
||||
return nil, errors.New("blockRange empty")
|
||||
blockRange, err := blockRanges[0].merge(*blockRanges[1])
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var hardForkName string
|
||||
getHardForkName := func(chunk *orm.Chunk) (string, error) {
|
||||
for i := 0; i < 2; i++ {
|
||||
if blockRanges[i] != nil && blockRanges[i].contains(chunk.StartBlockNumber, chunk.EndBlockNumber) {
|
||||
if blockRanges[i].contains(chunk.StartBlockNumber, chunk.EndBlockNumber) {
|
||||
hardForkName = hardForkNames[i]
|
||||
break
|
||||
}
|
||||
@@ -246,7 +235,7 @@ func (r *blockRange) contains(start, end uint64) bool {
|
||||
func (cp *ChunkProverTask) getBlockRangeByName(hardForkName string) (*blockRange, error) {
|
||||
hardForkNumber, err := cp.getHardForkNumberByName(hardForkName)
|
||||
if err != nil {
|
||||
// log.Error("chunk assign failure because of the hard fork name don't exist", "fork name", hardForkName)
|
||||
log.Error("chunk assign failure because of the hard fork name don't exist", "fork name", hardForkName)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
@@ -240,7 +240,8 @@ func (p *BatchProposer) proposeBatch() error {
|
||||
batch.Chunks = append(batch.Chunks, chunk)
|
||||
metrics, calcErr := utils.CalculateBatchMetrics(&batch, codecVersion)
|
||||
|
||||
if errors.Is(calcErr, &encoding.CompressedDataCompatibilityError{}) {
|
||||
var compressErr *encoding.CompressedDataCompatibilityError
|
||||
if errors.As(calcErr, &compressErr) {
|
||||
if i == 0 {
|
||||
// The first chunk fails compressed data compatibility check, manual fix is needed.
|
||||
return fmt.Errorf("the first chunk fails compressed data compatibility check; start block number: %v, end block number: %v", dbChunks[0].StartBlockNumber, dbChunks[0].EndBlockNumber)
|
||||
|
||||
@@ -242,7 +242,8 @@ func (p *ChunkProposer) proposeChunk() error {
|
||||
chunk.Blocks = append(chunk.Blocks, block)
|
||||
|
||||
metrics, calcErr := utils.CalculateChunkMetrics(&chunk, codecVersion)
|
||||
if errors.Is(calcErr, &encoding.CompressedDataCompatibilityError{}) {
|
||||
var compressErr *encoding.CompressedDataCompatibilityError
|
||||
if errors.As(calcErr, &compressErr) {
|
||||
if i == 0 {
|
||||
// The first block fails compressed data compatibility check, manual fix is needed.
|
||||
return fmt.Errorf("the first block fails compressed data compatibility check; block number: %v", block.Header.Number)
|
||||
|
||||
@@ -92,7 +92,8 @@ func CalculateChunkMetrics(chunk *encoding.Chunk, codecVersion encoding.CodecVer
|
||||
metrics.L1CommitUncompressedBatchBytesSize, metrics.L1CommitBlobSize, err = codecv2.EstimateChunkL1CommitBatchSizeAndBlobSize(chunk)
|
||||
metrics.EstimateBlobSizeTime = time.Since(start)
|
||||
if err != nil {
|
||||
if errors.Is(err, &encoding.CompressedDataCompatibilityError{}) {
|
||||
var compressErr *encoding.CompressedDataCompatibilityError
|
||||
if errors.As(err, &compressErr) {
|
||||
return nil, err
|
||||
} else {
|
||||
return nil, fmt.Errorf("failed to estimate codecv2 chunk L1 commit batch size and blob size: %w", err)
|
||||
@@ -176,7 +177,8 @@ func CalculateBatchMetrics(batch *encoding.Batch, codecVersion encoding.CodecVer
|
||||
metrics.L1CommitUncompressedBatchBytesSize, metrics.L1CommitBlobSize, err = codecv2.EstimateBatchL1CommitBatchSizeAndBlobSize(batch)
|
||||
metrics.EstimateBlobSizeTime = time.Since(start)
|
||||
if err != nil {
|
||||
if errors.Is(err, &encoding.CompressedDataCompatibilityError{}) {
|
||||
var compressErr *encoding.CompressedDataCompatibilityError
|
||||
if errors.As(err, &compressErr) {
|
||||
return nil, err
|
||||
} else {
|
||||
return nil, fmt.Errorf("failed to estimate codecv2 batch L1 commit batch size and blob size: %w", err)
|
||||
|
||||
53
rollup/internal/utils/utils_test.go
Normal file
53
rollup/internal/utils/utils_test.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"math/big"
|
||||
"testing"
|
||||
|
||||
"github.com/agiledragon/gomonkey/v2"
|
||||
"github.com/scroll-tech/da-codec/encoding"
|
||||
"github.com/scroll-tech/da-codec/encoding/codecv2"
|
||||
"github.com/scroll-tech/go-ethereum/common"
|
||||
"github.com/scroll-tech/go-ethereum/core/types"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// regression test
|
||||
func TestCompressedDataCompatibilityErrorCatching(t *testing.T) {
|
||||
block := &encoding.Block{
|
||||
Header: &types.Header{
|
||||
Number: big.NewInt(0),
|
||||
},
|
||||
RowConsumption: &types.RowConsumption{},
|
||||
}
|
||||
chunk := &encoding.Chunk{
|
||||
Blocks: []*encoding.Block{block},
|
||||
}
|
||||
batch := &encoding.Batch{
|
||||
Index: 0,
|
||||
TotalL1MessagePoppedBefore: 0,
|
||||
ParentBatchHash: common.Hash{},
|
||||
Chunks: []*encoding.Chunk{chunk},
|
||||
}
|
||||
|
||||
patchGuard1 := gomonkey.ApplyFunc(codecv2.EstimateChunkL1CommitBatchSizeAndBlobSize, func(b *encoding.Chunk) (uint64, uint64, error) {
|
||||
return 0, 0, &encoding.CompressedDataCompatibilityError{Err: errors.New("test-error-1")}
|
||||
})
|
||||
defer patchGuard1.Reset()
|
||||
|
||||
var compressErr *encoding.CompressedDataCompatibilityError
|
||||
|
||||
_, err := CalculateChunkMetrics(chunk, encoding.CodecV2)
|
||||
assert.Error(t, err)
|
||||
assert.ErrorAs(t, err, &compressErr)
|
||||
|
||||
patchGuard2 := gomonkey.ApplyFunc(codecv2.EstimateBatchL1CommitBatchSizeAndBlobSize, func(b *encoding.Batch) (uint64, uint64, error) {
|
||||
return 0, 0, &encoding.CompressedDataCompatibilityError{Err: errors.New("test-error-2")}
|
||||
})
|
||||
defer patchGuard2.Reset()
|
||||
|
||||
_, err = CalculateBatchMetrics(batch, encoding.CodecV2)
|
||||
assert.Error(t, err)
|
||||
assert.ErrorAs(t, err, &compressErr)
|
||||
}
|
||||
Reference in New Issue
Block a user