Skip to content

Commit 12a262a

Browse files
author
colinlyguo
committed
align new types
1 parent 7d5b77a commit 12a262a

File tree

2 files changed

+39
-19
lines changed

2 files changed

+39
-19
lines changed

common/types/message/message.go

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,28 @@ type BundleTaskDetail struct {
7070

7171
// ChunkInfo is for calculating pi_hash for chunk
7272
type ChunkInfo struct {
73-
ChainID uint64 `json:"chain_id"`
74-
PrevStateRoot common.Hash `json:"prev_state_root"`
75-
PostStateRoot common.Hash `json:"post_state_root"`
76-
WithdrawRoot common.Hash `json:"withdraw_root"`
77-
DataHash common.Hash `json:"data_hash"`
78-
IsPadding bool `json:"is_padding"`
79-
TxBytes []byte `json:"tx_bytes"`
80-
TxBytesHash common.Hash `json:"tx_data_digest"`
81-
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
82-
PostMsgQueueHash common.Hash `json:"post_msg_queue_hash"`
73+
ChainID uint64 `json:"chain_id"`
74+
PrevStateRoot common.Hash `json:"prev_state_root"`
75+
PostStateRoot common.Hash `json:"post_state_root"`
76+
WithdrawRoot common.Hash `json:"withdraw_root"`
77+
DataHash common.Hash `json:"data_hash"`
78+
IsPadding bool `json:"is_padding"`
79+
TxBytes []byte `json:"tx_bytes"`
80+
TxBytesHash common.Hash `json:"tx_data_digest"`
81+
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
82+
PostMsgQueueHash common.Hash `json:"post_msg_queue_hash"`
83+
TxDataLength uint64 `json:"tx_data_length"`
84+
InitialBlockNumber uint64 `json:"initial_block_number"`
85+
BlockCtxs []BlockContextV2 `json:"block_ctxs"`
86+
}
87+
88+
// BlockContextV2 is the block context for euclid v2
89+
type BlockContextV2 struct {
90+
Timestamp uint64 `json:"timestamp"`
91+
BaseFee common.Hash `json:"base_fee"`
92+
GasLimit uint64 `json:"gas_limit"`
93+
NumTxs uint16 `json:"num_txs"`
94+
NumL1Msgs uint16 `json:"num_l1_msgs"`
8395
}
8496

8597
// SubCircuitRowUsage tracing info added in v0.11.0rc8
@@ -270,12 +282,14 @@ func (p *OpenVMChunkProof) Proof() []byte {
270282

271283
// OpenVMBatchInfo is for calculating pi_hash for batch header
272284
type OpenVMBatchInfo struct {
273-
ParentBatchHash common.Hash `json:"parent_batch_hash"`
274-
ParentStateRoot common.Hash `json:"parent_state_root"`
275-
StateRoot common.Hash `json:"state_root"`
276-
WithdrawRoot common.Hash `json:"withdraw_root"`
277-
BatchHash common.Hash `json:"batch_hash"`
278-
ChainID uint64 `json:"chain_id"`
285+
ParentBatchHash common.Hash `json:"parent_batch_hash"`
286+
ParentStateRoot common.Hash `json:"parent_state_root"`
287+
StateRoot common.Hash `json:"state_root"`
288+
WithdrawRoot common.Hash `json:"withdraw_root"`
289+
BatchHash common.Hash `json:"batch_hash"`
290+
ChainID uint64 `json:"chain_id"`
291+
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
292+
PostMsgQueueHash common.Hash `json:"post_msg_queue_hash"`
279293
}
280294

281295
// BatchProof includes the proof info that are required for batch verification and rollup.
@@ -335,6 +349,7 @@ type OpenVMBundleInfo struct {
335349
NumBatches uint32 `json:"num_batches"`
336350
PrevBatchHash common.Hash `json:"prev_batch_hash"`
337351
BatchHash common.Hash `json:"batch_hash"`
352+
MsgQueueHash common.Hash `json:"msg_queue_hash"`
338353
}
339354

340355
// OpenVMBundleProof includes the proof info that are required for verification of a bundle of batch proofs.

coordinator/internal/logic/provertask/batch_prover_task.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,16 @@ func (bp *BatchProverTask) formatProverTask(ctx context.Context, task *orm.Prove
214214
PostMsgQueueHash: common.HexToHash(chunk.PostL1MessageQueueHash),
215215
IsPadding: false,
216216
}
217-
if haloProot, ok := proof.(*message.Halo2ChunkProof); ok {
218-
if haloProot.ChunkInfo != nil {
219-
chunkInfo.TxBytes = haloProot.ChunkInfo.TxBytes
217+
if halo2Proof, ok := proof.(*message.Halo2ChunkProof); ok {
218+
if halo2Proof.ChunkInfo != nil {
219+
chunkInfo.TxBytes = halo2Proof.ChunkInfo.TxBytes
220220
}
221221
}
222+
if openvmProof, ok := proof.(*message.OpenVMChunkProof); ok {
223+
chunkInfo.InitialBlockNumber = openvmProof.MetaData.ChunkInfo.InitialBlockNumber
224+
chunkInfo.BlockCtxs = openvmProof.MetaData.ChunkInfo.BlockCtxs
225+
chunkInfo.TxDataLength = openvmProof.MetaData.ChunkInfo.TxDataLength
226+
}
222227
chunkInfos = append(chunkInfos, &chunkInfo)
223228
}
224229

0 commit comments

Comments
 (0)