Skip to content

Commit 03c63a6

Browse files
committed
update batch/chunk details for phase2
1 parent f91c999 commit 03c63a6

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

common/types/message/message.go

+16-12
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ type ChunkTaskDetail struct {
4646

4747
// BatchTaskDetail is a type containing BatchTask detail.
4848
type BatchTaskDetail struct {
49-
ChunkInfos []*ChunkInfo `json:"chunk_infos"`
50-
ChunkProofs []ChunkProof `json:"chunk_proofs"`
51-
BatchHeader interface{} `json:"batch_header"`
52-
BlobBytes []byte `json:"blob_bytes"`
49+
ChunkInfos []*ChunkInfo `json:"chunk_infos"`
50+
ChunkProofs []ChunkProof `json:"chunk_proofs"`
51+
BatchHeader interface{} `json:"batch_header"`
52+
BlobBytes []byte `json:"blob_bytes"`
53+
KzgProof []byte `json:"kzg_proof"`
54+
KzgCommitment []byte `json:"kzg_commitment"`
55+
Challenge common.Hash `json:"challenge"`
5356
}
5457

5558
// BundleTaskDetail consists of all the information required to describe the task to generate a proof for a bundle of batches.
@@ -59,14 +62,15 @@ type BundleTaskDetail struct {
5962

6063
// ChunkInfo is for calculating pi_hash for chunk
6164
type ChunkInfo struct {
62-
ChainID uint64 `json:"chain_id"`
63-
PrevStateRoot common.Hash `json:"prev_state_root"`
64-
PostStateRoot common.Hash `json:"post_state_root"`
65-
WithdrawRoot common.Hash `json:"withdraw_root"`
66-
DataHash common.Hash `json:"data_hash"`
67-
IsPadding bool `json:"is_padding"`
68-
TxBytes []byte `json:"tx_bytes"`
69-
TxBytesHash common.Hash `json:"tx_data_digest"`
65+
ChainID uint64 `json:"chain_id"`
66+
PrevStateRoot common.Hash `json:"prev_state_root"`
67+
PostStateRoot common.Hash `json:"post_state_root"`
68+
WithdrawRoot common.Hash `json:"withdraw_root"`
69+
DataHash common.Hash `json:"data_hash"`
70+
IsPadding bool `json:"is_padding"`
71+
TxBytes []byte `json:"tx_bytes"`
72+
TxBytesHash common.Hash `json:"tx_data_digest"`
73+
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
7074
}
7175

7276
// SubCircuitRowUsage tracing info added in v0.11.0rc8

coordinator/internal/logic/provertask/batch_prover_task.go

+10-7
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,13 @@ func (bp *BatchProverTask) formatProverTask(ctx context.Context, task *orm.Prove
225225
chunkProofs = append(chunkProofs, proof)
226226

227227
chunkInfo := message.ChunkInfo{
228-
ChainID: bp.cfg.L2.ChainID,
229-
PrevStateRoot: common.HexToHash(chunk.ParentChunkStateRoot),
230-
PostStateRoot: common.HexToHash(chunk.StateRoot),
231-
WithdrawRoot: common.HexToHash(chunk.WithdrawRoot),
232-
DataHash: common.HexToHash(chunk.Hash),
233-
IsPadding: false,
228+
ChainID: bp.cfg.L2.ChainID,
229+
PrevStateRoot: common.HexToHash(chunk.ParentChunkStateRoot),
230+
PostStateRoot: common.HexToHash(chunk.StateRoot),
231+
WithdrawRoot: common.HexToHash(chunk.WithdrawRoot),
232+
DataHash: common.HexToHash(chunk.Hash),
233+
PrevMsgQueueHash: common.HexToHash(chunk.PrevL1MessageQueueHash),
234+
IsPadding: false,
234235
}
235236
if haloProot, ok := proof.(*message.Halo2ChunkProof); ok {
236237
if haloProot.ChunkInfo != nil {
@@ -290,6 +291,8 @@ func (bp *BatchProverTask) getBatchTaskDetail(dbBatch *orm.Batch, chunkInfos []*
290291
}
291292
taskDetail.BatchHeader = batchHeader
292293
taskDetail.BlobBytes = dbBatch.BlobBytes
293-
294+
taskDetail.KzgProof = dbBatch.BlobDataProof[112:160]
295+
taskDetail.KzgCommitment = dbBatch.BlobDataProof[64:112]
296+
taskDetail.Challenge = common.Hash(dbBatch.BlobDataProof[0:32])
294297
return taskDetail, nil
295298
}

coordinator/internal/orm/chunk.go

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ type Chunk struct {
2828
StartBlockTime uint64 `json:"start_block_time" gorm:"column:start_block_time"`
2929
TotalL1MessagesPoppedBefore uint64 `json:"total_l1_messages_popped_before" gorm:"column:total_l1_messages_popped_before"`
3030
TotalL1MessagesPoppedInChunk uint64 `json:"total_l1_messages_popped_in_chunk" gorm:"column:total_l1_messages_popped_in_chunk"`
31+
PrevL1MessageQueueHash string `json:"prev_l1_message_queue_hash" gorm:"column:prev_l1_message_queue_hash"`
32+
PostL1MessageQueueHash string `json:"post_l1_message_queue_hash" gorm:"column:post_l1_message_queue_hash"`
3133
ParentChunkHash string `json:"parent_chunk_hash" gorm:"column:parent_chunk_hash"`
3234
StateRoot string `json:"state_root" gorm:"column:state_root"`
3335
ParentChunkStateRoot string `json:"parent_chunk_state_root" gorm:"column:parent_chunk_state_root"`

0 commit comments

Comments
 (0)