Skip to content

Commit f1ea4b3

Browse files
committed
process task with CodecV7, add check for BlobDataProof length and add some comments
1 parent 03c63a6 commit f1ea4b3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

coordinator/internal/logic/provertask/batch_prover_task.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ func (bp *BatchProverTask) getBatchTaskDetail(dbBatch *orm.Batch, chunkInfos []*
275275

276276
dbBatchCodecVersion := encoding.CodecVersion(dbBatch.CodecVersion)
277277
switch dbBatchCodecVersion {
278-
case encoding.CodecV3, encoding.CodecV4, encoding.CodecV6:
278+
case encoding.CodecV3, encoding.CodecV4, encoding.CodecV6, encoding.CodecV7:
279279
default:
280280
return taskDetail, nil
281281
}
@@ -291,6 +291,15 @@ func (bp *BatchProverTask) getBatchTaskDetail(dbBatch *orm.Batch, chunkInfos []*
291291
}
292292
taskDetail.BatchHeader = batchHeader
293293
taskDetail.BlobBytes = dbBatch.BlobBytes
294+
295+
if len(dbBatch.BlobDataProof) < 160 {
296+
return nil, fmt.Errorf("blob data proof length is less than 160 bytes = %d, taskID: %s: %s", len(dbBatch.BlobDataProof), dbBatch.Hash, common.Bytes2Hex(dbBatch.BlobDataProof))
297+
}
298+
299+
// Memory layout of `BlobDataProof`: used in Codec.BlobDataProofForPointEvaluation()
300+
// | z | y | kzg_commitment | kzg_proof |
301+
// |---------|---------|----------------|-----------|
302+
// | bytes32 | bytes32 | bytes48 | bytes48 |
294303
taskDetail.KzgProof = dbBatch.BlobDataProof[112:160]
295304
taskDetail.KzgCommitment = dbBatch.BlobDataProof[64:112]
296305
taskDetail.Challenge = common.Hash(dbBatch.BlobDataProof[0:32])

0 commit comments

Comments
 (0)