Skip to content

Commit ee23417

Browse files
committed
Merge remote-tracking branch 'origin/develop' into jt/permissionless-batches-recovery
2 parents 6f36edc + d21fa36 commit ee23417

File tree

36 files changed

+12065
-543
lines changed

36 files changed

+12065
-543
lines changed

Cargo.lock

Lines changed: 516 additions & 339 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ repository = "https://github.com/scroll-tech/scroll"
1717
version = "4.5.8"
1818

1919
[workspace.dependencies]
20-
scroll-zkvm-prover-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "0dd7b19", package = "scroll-zkvm-prover" }
21-
scroll-zkvm-verifier-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "0dd7b19", package = "scroll-zkvm-verifier" }
22-
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "0dd7b19" }
20+
scroll-zkvm-prover-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", branch = "feat/0.5.1", package = "scroll-zkvm-prover" }
21+
scroll-zkvm-verifier-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", branch = "feat/0.5.1", package = "scroll-zkvm-verifier" }
22+
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", branch = "feat/0.5.1" }
2323

24-
sbv-primitives = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "chore/upgrade", features = ["scroll"] }
25-
sbv-utils = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "chore/upgrade" }
24+
sbv-primitives = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "chore/openvm-1.3", features = ["scroll"] }
25+
sbv-utils = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "chore/openvm-1.3" }
2626

2727
metrics = "0.23.0"
2828
metrics-util = "0.17"
@@ -46,23 +46,23 @@ once_cell = "1.20"
4646
base64 = "0.22"
4747

4848
[patch.crates-io]
49-
revm = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
50-
revm-bytecode = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
51-
revm-context = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
52-
revm-context-interface = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
53-
revm-database = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
54-
revm-database-interface = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
55-
revm-handler = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
56-
revm-inspector = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
57-
revm-interpreter = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
58-
revm-precompile = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
59-
revm-primitives = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
60-
revm-state = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v74" }
49+
revm = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
50+
revm-bytecode = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
51+
revm-context = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
52+
revm-context-interface = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
53+
revm-database = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
54+
revm-database-interface = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
55+
revm-handler = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
56+
revm-inspector = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
57+
revm-interpreter = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
58+
revm-precompile = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
59+
revm-primitives = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
60+
revm-state = { git = "https://github.com/scroll-tech/revm", branch = "feat/reth-v78" }
6161

6262
ruint = { git = "https://github.com/scroll-tech/uint.git", branch = "v1.15.0" }
6363
alloy-primitives = { git = "https://github.com/scroll-tech/alloy-core", branch = "v1.2.0" }
6464

6565
[profile.maxperf]
6666
inherits = "release"
6767
lto = "fat"
68-
codegen-units = 1
68+
codegen-units = 1

bridge-history-api/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ require (
1111
github.com/pressly/goose/v3 v3.16.0
1212
github.com/prometheus/client_golang v1.19.0
1313
github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6
14-
github.com/scroll-tech/go-ethereum v1.10.14-0.20250626101020-47bc86cd961c
14+
github.com/scroll-tech/go-ethereum v1.10.14-0.20250729113104-bd8f141bb3e9
1515
github.com/stretchr/testify v1.9.0
1616
github.com/urfave/cli/v2 v2.25.7
1717
golang.org/x/sync v0.11.0
1818
gorm.io/gorm v1.25.7-0.20240204074919-46816ad31dde
1919
)
2020

21-
replace github.com/scroll-tech/go-ethereum => github.com/scroll-tech/go-ethereum v1.10.14-0.20250626101020-47bc86cd961c // It's a hotfix for the header hash incompatibility issue, pls change this with caution
21+
replace github.com/scroll-tech/go-ethereum => github.com/scroll-tech/go-ethereum v1.10.14-0.20250729113104-bd8f141bb3e9 // It's a hotfix for the header hash incompatibility issue, pls change this with caution
2222

2323
require (
2424
dario.cat/mergo v1.0.0 // indirect

bridge-history-api/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf
311311
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
312312
github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6 h1:vb2XLvQwCf+F/ifP6P/lfeiQrHY6+Yb/E3R4KHXLqSE=
313313
github.com/scroll-tech/da-codec v0.1.3-0.20250626091118-58b899494da6/go.mod h1:Z6kN5u2khPhiqHyk172kGB7o38bH/nj7Ilrb/46wZGg=
314-
github.com/scroll-tech/go-ethereum v1.10.14-0.20250626101020-47bc86cd961c h1:IpEBKM6O+xOK2qZVZztGxcobFXkKMb5hAkBEVzfXjVg=
315-
github.com/scroll-tech/go-ethereum v1.10.14-0.20250626101020-47bc86cd961c/go.mod h1:pDCZ4iGvEGmdIe4aSAGBrb7XSrKEML6/L/wEMmNxOdk=
314+
github.com/scroll-tech/go-ethereum v1.10.14-0.20250729113104-bd8f141bb3e9 h1:u371VK8eOU2Z/0SVf5KDI3eJc8msHSpJbav4do/8n38=
315+
github.com/scroll-tech/go-ethereum v1.10.14-0.20250729113104-bd8f141bb3e9/go.mod h1:pDCZ4iGvEGmdIe4aSAGBrb7XSrKEML6/L/wEMmNxOdk=
316316
github.com/scroll-tech/zktrie v0.8.4 h1:UagmnZ4Z3ITCk+aUq9NQZJNAwnWl4gSxsLb2Nl7IgRE=
317317
github.com/scroll-tech/zktrie v0.8.4/go.mod h1:XvNo7vAk8yxNyTjBDj5WIiFzYW4bx/gJ78+NK6Zn6Uk=
318318
github.com/segmentio/asm v1.2.0 h1:9BQrFxC+YOHJlTlHGkTrFWf59nbL3XnCoFLTwDCI7ys=

common/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"runtime/debug"
66
)
77

8-
var tag = "v4.5.30"
8+
var tag = "v4.5.37"
99

1010
var commit = func() string {
1111
if info, ok := debug.ReadBuildInfo(); ok {

coordinator/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: lint docker clean coordinator coordinator_skip_libzkp mock_coordinator
1+
.PHONY: lint docker clean coordinator coordinator_skip_libzkp mock_coordinator libzkp
22

33
IMAGE_VERSION=latest
44
REPO_ROOT_DIR=./..

coordinator/internal/logic/provertask/batch_prover_task.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ func (bp *BatchProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
8686
var tmpBatchTask *orm.Batch
8787

8888
if taskCtx.hasAssignedTask != nil {
89+
if taskCtx.hasAssignedTask.TaskType != int16(message.ProofTypeBatch) {
90+
return nil, fmt.Errorf("prover with publicKey %s is already assigned a task. ProverName: %s, ProverVersion: %s", taskCtx.PublicKey, taskCtx.ProverName, taskCtx.ProverVersion)
91+
}
92+
8993
tmpBatchTask, getTaskError = bp.batchOrm.GetBatchByHash(ctx.Copy(), taskCtx.hasAssignedTask.TaskID)
9094
if getTaskError != nil {
9195
log.Error("failed to get batch has assigned to prover", "taskID", taskCtx.hasAssignedTask.TaskID, "err", getTaskError)
@@ -95,6 +99,14 @@ func (bp *BatchProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
9599
return nil, fmt.Errorf("prover with publicKey %s is already assigned a dropped batch. ProverName: %s, ProverVersion: %s",
96100
taskCtx.PublicKey, taskCtx.ProverName, taskCtx.ProverVersion)
97101
}
102+
} else if getTaskParameter.TaskID != "" {
103+
tmpBatchTask, getTaskError = bp.batchOrm.GetBatchByHash(ctx.Copy(), getTaskParameter.TaskID)
104+
if getTaskError != nil {
105+
log.Error("failed to get expected batch", "taskID", getTaskParameter.TaskID, "err", getTaskError)
106+
return nil, ErrCoordinatorInternalFailure
107+
} else if tmpBatchTask == nil {
108+
return nil, fmt.Errorf("Expected task (%s) is already dropped", getTaskParameter.TaskID)
109+
}
98110
}
99111

100112
if tmpBatchTask == nil {

coordinator/internal/logic/provertask/bundle_prover_task.go

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ func (bp *BundleProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinat
8484
var tmpBundleTask *orm.Bundle
8585

8686
if taskCtx.hasAssignedTask != nil {
87+
if taskCtx.hasAssignedTask.TaskType != int16(message.ProofTypeBundle) {
88+
return nil, fmt.Errorf("prover with publicKey %s is already assigned a task. ProverName: %s, ProverVersion: %s", taskCtx.PublicKey, taskCtx.ProverName, taskCtx.ProverVersion)
89+
}
90+
8791
tmpBundleTask, getTaskError = bp.bundleOrm.GetBundleByHash(ctx.Copy(), taskCtx.hasAssignedTask.TaskID)
8892
if getTaskError != nil {
8993
log.Error("failed to get bundle has assigned to prover", "taskID", taskCtx.hasAssignedTask.TaskID, "err", getTaskError)
@@ -93,6 +97,14 @@ func (bp *BundleProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinat
9397
return nil, fmt.Errorf("prover with publicKey %s is already assigned a dropped bundle. ProverName: %s, ProverVersion: %s",
9498
taskCtx.PublicKey, taskCtx.ProverName, taskCtx.ProverVersion)
9599
}
100+
} else if getTaskParameter.TaskID != "" {
101+
tmpBundleTask, getTaskError = bp.bundleOrm.GetBundleByHash(ctx.Copy(), getTaskParameter.TaskID)
102+
if getTaskError != nil {
103+
log.Error("failed to get expected bundle", "taskID", getTaskParameter.TaskID, "err", getTaskError)
104+
return nil, ErrCoordinatorInternalFailure
105+
} else if tmpBundleTask == nil {
106+
return nil, fmt.Errorf("Expected task (%s) is already dropped", getTaskParameter.TaskID)
107+
}
96108
}
97109

98110
if tmpBundleTask == nil {
@@ -234,9 +246,14 @@ func (bp *BundleProverTask) formatProverTask(ctx context.Context, task *orm.Prov
234246
return nil, fmt.Errorf("failed to get batch proofs for bundle task id:%s, no batch found", task.TaskID)
235247
}
236248

237-
parentBatch, err := bp.batchOrm.GetBatchByHash(ctx, batches[0].ParentBatchHash)
238-
if err != nil {
239-
return nil, fmt.Errorf("failed to get parent batch for batch task id:%s err:%w", task.TaskID, err)
249+
var prevStateRoot common.Hash
250+
// this would be common in test cases: the first batch has empty parent
251+
if batches[0].Index > 1 {
252+
parentBatch, err := bp.batchOrm.GetBatchByHash(ctx, batches[0].ParentBatchHash)
253+
if err != nil {
254+
return nil, fmt.Errorf("failed to get parent batch for batch task id:%s err:%w", task.TaskID, err)
255+
}
256+
prevStateRoot = common.HexToHash(parentBatch.StateRoot)
240257
}
241258

242259
var batchProofs []*message.OpenVMBatchProof
@@ -255,7 +272,7 @@ func (bp *BundleProverTask) formatProverTask(ctx context.Context, task *orm.Prov
255272

256273
taskDetail.BundleInfo = &message.OpenVMBundleInfo{
257274
ChainID: bp.cfg.L2.ChainID,
258-
PrevStateRoot: common.HexToHash(parentBatch.StateRoot),
275+
PrevStateRoot: prevStateRoot,
259276
PostStateRoot: common.HexToHash(batches[len(batches)-1].StateRoot),
260277
WithdrawRoot: common.HexToHash(batches[len(batches)-1].WithdrawRoot),
261278
NumBatches: uint32(len(batches)),

coordinator/internal/logic/provertask/chunk_prover_task.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ func (cp *ChunkProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
8080
for i := 0; i < 5; i++ {
8181
var getTaskError error
8282
var tmpChunkTask *orm.Chunk
83+
8384
if taskCtx.hasAssignedTask != nil {
85+
if taskCtx.hasAssignedTask.TaskType != int16(message.ProofTypeChunk) {
86+
return nil, fmt.Errorf("prover with publicKey %s is already assigned a task. ProverName: %s, ProverVersion: %s", taskCtx.PublicKey, taskCtx.ProverName, taskCtx.ProverVersion)
87+
}
88+
8489
log.Debug("retrieved assigned task chunk", "taskID", taskCtx.hasAssignedTask.TaskID, "prover", taskCtx.ProverName)
8590
tmpChunkTask, getTaskError = cp.chunkOrm.GetChunkByHash(ctx.Copy(), taskCtx.hasAssignedTask.TaskID)
8691
if getTaskError != nil {
@@ -91,6 +96,14 @@ func (cp *ChunkProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
9196
return nil, fmt.Errorf("prover with publicKey %s is already assigned a dropped chunk. ProverName: %s, ProverVersion: %s",
9297
taskCtx.PublicKey, taskCtx.ProverName, taskCtx.ProverVersion)
9398
}
99+
} else if getTaskParameter.TaskID != "" {
100+
tmpChunkTask, getTaskError = cp.chunkOrm.GetChunkByHash(ctx.Copy(), getTaskParameter.TaskID)
101+
if getTaskError != nil {
102+
log.Error("failed to get expected chunk", "taskID", getTaskParameter.TaskID, "err", getTaskError)
103+
return nil, ErrCoordinatorInternalFailure
104+
} else if tmpChunkTask == nil {
105+
return nil, fmt.Errorf("Expected task (%s) is already dropped", getTaskParameter.TaskID)
106+
}
94107
}
95108

96109
if tmpChunkTask == nil {
@@ -221,7 +234,7 @@ func (cp *ChunkProverTask) formatProverTask(ctx context.Context, task *orm.Prove
221234
// Get block hashes.
222235
blockHashes, dbErr := cp.blockOrm.GetL2BlockHashesByChunkHash(ctx, task.TaskID)
223236
if dbErr != nil || len(blockHashes) == 0 {
224-
return nil, fmt.Errorf("failed to fetch block hashes of a chunk, chunk hash:%s err:%w", task.TaskID, dbErr)
237+
return nil, fmt.Errorf("failed to fetch block hashes of a chunk, chunk hash:%s err:%v", task.TaskID, dbErr)
225238
}
226239

227240
var taskDetailBytes []byte

coordinator/internal/logic/verifier/verifier.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ package verifier
55
import (
66
"encoding/base64"
77
"encoding/json"
8+
"fmt"
89
"io"
910
"os"
1011
"path"
1112
"path/filepath"
13+
"strings"
1214

1315
"github.com/scroll-tech/go-ethereum/log"
1416

@@ -117,6 +119,16 @@ func (v *Verifier) VerifyBundleProof(proof *message.OpenVMBundleProof, forkName
117119
return libzkp.VerifyBundleProof(string(buf), forkName), nil
118120
}
119121

122+
/*
123+
add vk of imcompatilbe circuit app here to avoid we had used them unexpectedly
124+
25/07/15: 0.5.0rc0 is no longer compatible since a breaking change
125+
*/
126+
const blocked_vks = `
127+
rSJNNBpsxBdKlstbIIU/aYc7bHau98Qb2yjZMc5PmDhmGOolp5kYRbvF/VcWcO5HN5ujGs6S00W8pZcCoNQRLQ==,
128+
2Lo7Cebm6SFtcsYXipkcMxIBmVY7UpoMXik/Msm7t2nyvi9EaNGsSnDnaCurscYEF+IcdjPUtVtY9EcD7IKwWg==,
129+
D6YFHwTLZF/U2zpYJPQ3LwJZRm85yA5Vq2iFBqd3Mk4iwOUpS8sbOp3vg2+NDxhhKphgYpuUlykpdsoRhEt+cw==,
130+
`
131+
120132
func (v *Verifier) loadOpenVMVks(cfg config.AssetConfig) error {
121133

122134
vkFileName := cfg.Vkfile
@@ -138,6 +150,16 @@ func (v *Verifier) loadOpenVMVks(cfg config.AssetConfig) error {
138150
if err := json.Unmarshal(byt, &dump); err != nil {
139151
return err
140152
}
153+
if strings.Contains(blocked_vks, dump.Chunk) {
154+
return fmt.Errorf("loaded blocked chunk vk %s", dump.Chunk)
155+
}
156+
if strings.Contains(blocked_vks, dump.Batch) {
157+
return fmt.Errorf("loaded blocked batch vk %s", dump.Batch)
158+
}
159+
if strings.Contains(blocked_vks, dump.Bundle) {
160+
return fmt.Errorf("loaded blocked bundle vk %s", dump.Bundle)
161+
}
162+
141163
v.OpenVMVkMap[dump.Chunk] = struct{}{}
142164
v.OpenVMVkMap[dump.Batch] = struct{}{}
143165
v.OpenVMVkMap[dump.Bundle] = struct{}{}

0 commit comments

Comments
 (0)