@@ -288,25 +288,25 @@ func (bp *BatchProverTask) getBatchTaskDetail(dbBatch *orm.Batch, chunkInfos []*
288288 }
289289 taskDetail .BatchHeader = batchHeader
290290 taskDetail .BlobBytes = dbBatch .BlobBytes
291- if hardForkName == message .EuclidV2Fork && len (taskDetail .BlobBytes ) < 126976 {
292- zeroPadding := make ([]byte , 126976 - len (taskDetail .BlobBytes ))
293- taskDetail .BlobBytes = append (taskDetail .BlobBytes , zeroPadding ... )
294- }
295291
296292 if len (dbBatch .BlobDataProof ) < 160 {
297293 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 ))
298294 }
299295
300- // Memory layout of `BlobDataProof`: used in Codec.BlobDataProofForPointEvaluation()
301- // | z | y | kzg_commitment | kzg_proof |
302- // |---------|---------|----------------|-----------|
303- // | bytes32 | bytes32 | bytes48 | bytes48 |
304- taskDetail .KzgProof = message.Byte48 {Big : hexutil .Big (* new (big.Int ).SetBytes (dbBatch .BlobDataProof [112 :160 ]))}
305- taskDetail .KzgCommitment = message.Byte48 {Big : hexutil .Big (* new (big.Int ).SetBytes (dbBatch .BlobDataProof [64 :112 ]))}
306- // FIXME: Challenge = ChallengeDigest % BLS_MODULUS, get the original ChallengeDigest.
307- // Simply omit the field now to skip sanity check in prover side
308- // Resume it later (or FIXME has worked or the prover side has relax its checking)
309- // taskDetail.ChallengeDigest = new(common.Hash)
310- // *taskDetail.ChallengeDigest = common.BytesToHash(dbBatch.BlobDataProof[0:32])
296+ challengeDigest , kzgProof , kzgCommitment , err := codec .BlobDataProofFromBlobBytes (dbBatch .BlobBytes )
297+ if err != nil {
298+ return nil , fmt .Errorf ("failed to get challenge digest from blob bytes, taskID: %s, err: %w" , dbBatch .Hash , err )
299+ }
300+
301+ taskDetail .ChallengeDigest = challengeDigest
302+ taskDetail .KzgProof = message.Byte48 {Big : hexutil .Big (* new (big.Int ).SetBytes (kzgProof [:]))}
303+ taskDetail .KzgCommitment = message.Byte48 {Big : hexutil .Big (* new (big.Int ).SetBytes (kzgCommitment [:]))}
304+
305+ // FIXME: remove this hot fix logic after stable release.
306+ if hardForkName == message .EuclidV2Fork && len (taskDetail .BlobBytes ) < 126976 {
307+ zeroPadding := make ([]byte , 126976 - len (taskDetail .BlobBytes ))
308+ taskDetail .BlobBytes = append (taskDetail .BlobBytes , zeroPadding ... )
309+ }
310+
311311 return taskDetail , nil
312312}
0 commit comments