Skip to content

Commit 32a7398

Browse files
committed
sanity check for msg_queue_hash
1 parent 09ef1dd commit 32a7398

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

common/types/message/message.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type ChunkTaskDetail struct {
4444
ForkName string `json:"fork_name"`
4545
BlockHashes []common.Hash `json:"block_hashes"`
4646
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
47+
PostMsgQueueHash common.Hash `json:"post_msg_queue_hash"`
4748
}
4849

4950
// it is a hex encoded big with fixed length on 48 bytes

coordinator/internal/logic/provertask/chunk_prover_task.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ func (cp *ChunkProverTask) formatProverTask(ctx context.Context, task *orm.Prove
248248
Version: version,
249249
BlockHashes: blockHashes,
250250
PrevMsgQueueHash: common.HexToHash(chunk.PrevL1MessageQueueHash),
251+
PostMsgQueueHash: common.HexToHash(chunk.PostL1MessageQueueHash),
251252
ForkName: hardForkName,
252253
}
253254

crates/libzkp/src/tasks/chunk.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ pub struct ChunkTask {
1919
pub block_hashes: Vec<B256>,
2020
/// The on-chain L1 msg queue hash before applying L1 msg txs from the chunk.
2121
pub prev_msg_queue_hash: B256,
22+
/// The on-chain L1 msg queue hash after applying L1 msg txs from the chunk (for validate)
23+
pub post_msg_queue_hash: B256,
2224
/// Fork name specify
2325
pub fork_name: String,
2426
}
@@ -81,6 +83,7 @@ impl TryFromWithInterpreter<ChunkTask> for ChunkProvingTask {
8183
version: value.version,
8284
block_witnesses,
8385
prev_msg_queue_hash: value.prev_msg_queue_hash,
86+
post_msg_queue_hash: value.post_msg_queue_hash,
8487
fork_name: value.fork_name,
8588
validium_inputs,
8689
})
@@ -102,6 +105,8 @@ pub struct ChunkProvingTask {
102105
pub block_witnesses: Vec<BlockWitness>,
103106
/// The on-chain L1 msg queue hash before applying L1 msg txs from the chunk.
104107
pub prev_msg_queue_hash: B256,
108+
/// The on-chain L1 msg queue hash after applying L1 msg txs from the chunk (for validate)
109+
pub post_msg_queue_hash: B256,
105110
/// Fork name specify
106111
pub fork_name: String,
107112
/// Optional inputs in case of domain=validium.
@@ -205,7 +210,9 @@ impl ChunkProvingTask {
205210

206211
pub fn precheck_and_build_metadata(&self) -> Result<ChunkInfo> {
207212
let witness = self.build_guest_input();
208-
ChunkInfo::try_from(witness).map_err(|e| eyre::eyre!("{e}"))
213+
let ret = ChunkInfo::try_from(witness).map_err(|e| eyre::eyre!("{e}"))?;
214+
assert_eq!(ret.post_msg_queue_hash, self.post_msg_queue_hash);
215+
Ok(ret)
209216
}
210217

211218
/// this method check the validate of current task (there may be missing storage node)

0 commit comments

Comments
 (0)