Skip to content

Commit bcc6b0f

Browse files
author
colinlyguo
committed
add PrevMsgQueueHash in chunk task detail
1 parent fe6451b commit bcc6b0f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

common/types/message/message.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ const (
4141

4242
// ChunkTaskDetail is a type containing ChunkTask detail.
4343
type ChunkTaskDetail struct {
44-
BlockHashes []common.Hash `json:"block_hashes"`
44+
BlockHashes []common.Hash `json:"block_hashes"`
45+
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
4546
}
4647

4748
// BatchTaskDetail is a type containing BatchTask detail.

coordinator/internal/logic/provertask/chunk_prover_task.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/prometheus/client_golang/prometheus"
1111
"github.com/prometheus/client_golang/prometheus/promauto"
1212
"github.com/scroll-tech/da-codec/encoding"
13+
"github.com/scroll-tech/go-ethereum/common"
1314
"github.com/scroll-tech/go-ethereum/log"
1415
"github.com/scroll-tech/go-ethereum/params"
1516
"gorm.io/gorm"
@@ -168,7 +169,7 @@ func (cp *ChunkProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
168169
return nil, ErrCoordinatorInternalFailure
169170
}
170171

171-
taskMsg, err := cp.formatProverTask(ctx.Copy(), &proverTask, hardForkName)
172+
taskMsg, err := cp.formatProverTask(ctx.Copy(), &proverTask, chunkTask, hardForkName)
172173
if err != nil {
173174
cp.recoverActiveAttempts(ctx, chunkTask)
174175
log.Error("format prover task failure", "task_id", chunkTask.Hash, "err", err)
@@ -194,15 +195,16 @@ func (cp *ChunkProverTask) hardForkName(ctx *gin.Context, chunkTask *orm.Chunk)
194195
return hardForkName, nil
195196
}
196197

197-
func (cp *ChunkProverTask) formatProverTask(ctx context.Context, task *orm.ProverTask, hardForkName string) (*coordinatorType.GetTaskSchema, error) {
198+
func (cp *ChunkProverTask) formatProverTask(ctx context.Context, task *orm.ProverTask, chunk *orm.Chunk, hardForkName string) (*coordinatorType.GetTaskSchema, error) {
198199
// Get block hashes.
199200
blockHashes, dbErr := cp.blockOrm.GetL2BlockHashesByChunkHash(ctx, task.TaskID)
200201
if dbErr != nil || len(blockHashes) == 0 {
201202
return nil, fmt.Errorf("failed to fetch block hashes of a chunk, chunk hash:%s err:%w", task.TaskID, dbErr)
202203
}
203204

204205
taskDetail := message.ChunkTaskDetail{
205-
BlockHashes: blockHashes,
206+
BlockHashes: blockHashes,
207+
PrevMsgQueueHash: common.HexToHash(chunk.PrevL1MessageQueueHash),
206208
}
207209
blockHashesBytes, err := json.Marshal(taskDetail)
208210
if err != nil {

0 commit comments

Comments
 (0)