Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"runtime/debug"
)

var tag = "v4.5.23"
var tag = "v4.5.24"

var commit = func() string {
if info, ok := debug.ReadBuildInfo(); ok {
Expand Down
2 changes: 1 addition & 1 deletion rollup/cmd/blob_uploader/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func action(ctx *cli.Context) error {
log.Crit("failed to create l2 relayer", "config file", cfgFile, "error", err)
}

go utils.Loop(subCtx, 2*time.Second, blobUploader.UploadBlobToS3)
go utils.Loop(subCtx, 1*time.Second, blobUploader.UploadBlobToS3)

// Finish start all blob-uploader functions.
log.Info("Start blob-uploader successfully", "version", version.Version)
Expand Down
20 changes: 15 additions & 5 deletions rollup/internal/controller/blob_uploader/blob_uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,13 @@ func (b *BlobUploader) constructBlobCodec(dbBatch *orm.Batch) (*kzg4844.Blob, er
return nil, fmt.Errorf("failed to get chunks in range: %v", err)
}

// temporarily disable this check because the codec_version field for chunk was added later.
// check codec version
for _, dbChunk := range dbChunks {
if dbBatch.CodecVersion != dbChunk.CodecVersion {
return nil, fmt.Errorf("batch codec version is different from chunk codec version, batch index: %d, chunk index: %d, batch codec version: %d, chunk codec version: %d", dbBatch.Index, dbChunk.Index, dbBatch.CodecVersion, dbChunk.CodecVersion)
}
}
// for _, dbChunk := range dbChunks {
// if dbBatch.CodecVersion != dbChunk.CodecVersion {
// return nil, fmt.Errorf("batch codec version is different from chunk codec version, batch index: %d, chunk index: %d, batch codec version: %d, chunk codec version: %d", dbBatch.Index, dbChunk.Index, dbBatch.CodecVersion, dbChunk.CodecVersion)
// }
// }

chunks := make([]*encoding.Chunk, len(dbChunks))
var allBlocks []*encoding.Block // collect blocks for CodecV7
Expand All @@ -156,6 +157,15 @@ func (b *BlobUploader) constructBlobCodec(dbBatch *orm.Batch) (*kzg4844.Blob, er

var encodingBatch *encoding.Batch
codecVersion := encoding.CodecVersion(dbBatch.CodecVersion)

// temporarily add this check because the codec_version field for chunk was added later.
if codecVersion == encoding.CodecV0 && dbBatch.Index < 73224 {
codecVersion = encoding.CodecV1
}
if codecVersion == encoding.CodecV0 && dbBatch.Index >= 73224 { // for sepolia
codecVersion = encoding.CodecV2
}

switch codecVersion {
case encoding.CodecV0:
return nil, fmt.Errorf("codec version 0 doesn't support blob, batch index: %d", dbBatch.Index)
Expand Down
6 changes: 4 additions & 2 deletions rollup/internal/controller/blob_uploader/s3_sender.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ type S3Uploader struct {
func NewS3Uploader(cfg *config.AWSS3Config) (*S3Uploader, error) {
// load AWS config
var opts []func(*awsconfig.LoadOptions) error
opts = append(opts, awsconfig.WithRegion(cfg.Region))

// if AccessKey && SecretKey provided, use it
if cfg.AccessKey != "" && cfg.SecretKey != "" {
opts = append(opts, awsconfig.WithCredentialsProvider(
Expand All @@ -38,6 +36,10 @@ func NewS3Uploader(cfg *config.AWSS3Config) (*S3Uploader, error) {
)
}

if cfg.Region != "" {
opts = append(opts, awsconfig.WithRegion(cfg.Region))
}

awsCfg, err := awsconfig.LoadDefaultConfig(context.Background(), opts...)
if err != nil {
return nil, fmt.Errorf("failed to load default config: %w", err)
Expand Down
3 changes: 2 additions & 1 deletion rollup/internal/orm/blob_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ func (o *BlobUpload) InsertOrUpdateBlobUpload(ctx context.Context, batchIndex ui
return fmt.Errorf("BlobUpload.InsertOrUpdateBlobUpload query error: %w, batch index: %v, batch_hash: %v, platform: %v", err, batchIndex, batchHash, platform)
}

if err := db.Model(&existing).Update("status", int16(status)).Error; err != nil {
if err := db.Model(&existing).Where("batch_index = ? AND batch_hash = ? AND platform = ? AND deleted_at IS NULL",
batchIndex, batchHash, int16(platform)).Update("status", int16(status)).Error; err != nil {
return fmt.Errorf("BlobUpload.InsertOrUpdateBlobUpload update error: %w, batch index: %v, batch_hash: %v, platform: %v", err, batchIndex, batchHash, platform)
}

Expand Down