Skip to content

Commit 886af07

Browse files
author
colinlyguo
committed
fix challenge digest
1 parent 2b318ec commit 886af07

File tree

6 files changed

+22
-26
lines changed

6 files changed

+22
-26
lines changed

common/types/message/message.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ type BatchTaskDetail struct {
106106
BlobBytes []byte `json:"blob_bytes"`
107107
KzgProof Byte48 `json:"kzg_proof,omitempty"`
108108
KzgCommitment Byte48 `json:"kzg_commitment,omitempty"`
109-
ChallengeDigest *common.Hash `json:"challenge_digest,omitempty"`
109+
ChallengeDigest common.Hash `json:"challenge_digest,omitempty"`
110110
}
111111

112112
// BundleTaskDetail consists of all the information required to describe the task to generate a proof for a bundle of batches.

coordinator/go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@ module scroll-tech/coordinator
22

33
go 1.22
44

5-
toolchain go1.22.2
6-
75
require (
86
github.com/appleboy/gin-jwt/v2 v2.9.1
97
github.com/gin-gonic/gin v1.9.1
108
github.com/go-resty/resty/v2 v2.7.0
119
github.com/google/uuid v1.6.0
1210
github.com/mitchellh/mapstructure v1.5.0
1311
github.com/prometheus/client_golang v1.19.0
14-
github.com/scroll-tech/da-codec v0.1.3-0.20250310095435-012aaee6b435
12+
github.com/scroll-tech/da-codec v0.1.3-0.20250327153440-cd3e5728df9c
1513
github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601
1614
github.com/shopspring/decimal v1.3.1
1715
github.com/stretchr/testify v1.10.0

coordinator/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU
177177
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
178178
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
179179
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
180-
github.com/scroll-tech/da-codec v0.1.3-0.20250310095435-012aaee6b435 h1:X9fkvjrYBY79lGgKEPpUhuiJ4vWpWwzOVw4H8CU8L54=
181-
github.com/scroll-tech/da-codec v0.1.3-0.20250310095435-012aaee6b435/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY=
180+
github.com/scroll-tech/da-codec v0.1.3-0.20250327153440-cd3e5728df9c h1:MCbuwFynRgxQeoyXwt/wUAPo3vfb61rMWxqADE2he4A=
181+
github.com/scroll-tech/da-codec v0.1.3-0.20250327153440-cd3e5728df9c/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY=
182182
github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601 h1:NEsjCG6uSvLRBlsP3+x6PL1kM+Ojs3g8UGotIPgJSz8=
183183
github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601/go.mod h1:OblWe1+QrZwdpwO0j/LY3BSGuKT3YPUFBDQQgvvfStQ=
184184
github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE=

coordinator/internal/logic/provertask/batch_prover_task.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

rollup/go.mod

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ module scroll-tech/rollup
22

33
go 1.22
44

5-
toolchain go1.22.2
6-
75
require (
86
github.com/agiledragon/gomonkey/v2 v2.12.0
97
github.com/consensys/gnark-crypto v0.16.0
@@ -13,7 +11,7 @@ require (
1311
github.com/holiman/uint256 v1.3.2
1412
github.com/mitchellh/mapstructure v1.5.0
1513
github.com/prometheus/client_golang v1.16.0
16-
github.com/scroll-tech/da-codec v0.1.3-0.20250313030021-a8341d04bc4e
14+
github.com/scroll-tech/da-codec v0.1.3-0.20250327153440-cd3e5728df9c
1715
github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601
1816
github.com/smartystreets/goconvey v1.8.0
1917
github.com/spf13/viper v1.19.0

rollup/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6ke
249249
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
250250
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
251251
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
252-
github.com/scroll-tech/da-codec v0.1.3-0.20250313030021-a8341d04bc4e h1:0IkSVltsMrKCprOOfQyJsLeqhPEuA0sTp41pZBpDeDk=
253-
github.com/scroll-tech/da-codec v0.1.3-0.20250313030021-a8341d04bc4e/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY=
252+
github.com/scroll-tech/da-codec v0.1.3-0.20250327153440-cd3e5728df9c h1:MCbuwFynRgxQeoyXwt/wUAPo3vfb61rMWxqADE2he4A=
253+
github.com/scroll-tech/da-codec v0.1.3-0.20250327153440-cd3e5728df9c/go.mod h1:yhTS9OVC0xQGhg7DN5iV5KZJvnSIlFWAxDdp+6jxQtY=
254254
github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601 h1:NEsjCG6uSvLRBlsP3+x6PL1kM+Ojs3g8UGotIPgJSz8=
255255
github.com/scroll-tech/go-ethereum v1.10.14-0.20250305151038-478940e79601/go.mod h1:OblWe1+QrZwdpwO0j/LY3BSGuKT3YPUFBDQQgvvfStQ=
256256
github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE=

0 commit comments

Comments
 (0)