Skip to content

Commit b7a172a

Browse files
noel2004colinlyguo
andauthored
feat: upgrade zkvm-prover to feynman fork (#1686)
Co-authored-by: colinlyguo <[email protected]>
1 parent 80807db commit b7a172a

File tree

26 files changed

+1974
-1187
lines changed

26 files changed

+1974
-1187
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,23 @@ 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 = "6078604", package = "scroll-zkvm-prover" }
21-
scroll-zkvm-verifier-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "6078604", package = "scroll-zkvm-verifier" }
22-
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "6078604" }
20+
scroll-zkvm-prover-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "2962428", package = "scroll-zkvm-prover" }
21+
scroll-zkvm-verifier-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "2962428", package = "scroll-zkvm-verifier" }
22+
scroll-zkvm-types = { git = "https://github.com/scroll-tech/zkvm-prover", rev = "2962428" }
2323

24-
sbv-primitives = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "zkvm/euclid-upgrade", features = ["scroll"] }
25-
sbv-utils = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "zkvm/euclid-upgrade" }
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" }
2626

2727
metrics = "0.23.0"
2828
metrics-util = "0.17"
2929
metrics-tracing-context = "0.16.0"
3030

3131
anyhow = "1.0"
32-
alloy = { version = "0.11", default-features = false }
33-
alloy-primitives = { version = "0.8", default-features = false }
32+
alloy = { version = "1", default-features = false }
33+
alloy-primitives = { version = "1.2", default-features = false, features = ["tiny-keccak"] }
3434
# also use this to trigger "serde" feature for primitives
35-
alloy-serde = { version = "0.8", default-features = false }
35+
alloy-serde = { version = "1", default-features = false }
3636

37-
rkyv = "0.8"
3837
serde = { version = "1", default-features = false, features = ["derive"] }
3938
serde_json = { version = "1.0" }
4039
serde_derive = "1.0"
@@ -43,22 +42,25 @@ itertools = "0.14"
4342
tiny-keccak = "2.0"
4443
tracing = "0.1"
4544
eyre = "0.6"
46-
bincode_v1 = { version = "1.3", package = "bincode"}
47-
snark-verifier-sdk = { version = "0.2.0", default-features = false, features = [
48-
"loader_halo2",
49-
"halo2-axiom",
50-
"display",
51-
] }
5245
once_cell = "1.20"
5346
base64 = "0.22"
5447

55-
#TODO: upgrade when Feynman
56-
vm-zstd = { git = "https://github.com/scroll-tech/rust-zstd-decompressor.git", tag = "v0.1.1" }
57-
5848
[patch.crates-io]
59-
alloy-primitives = { git = "https://github.com/scroll-tech/alloy-core", branch = "v0.8.18-euclid-upgrade" }
60-
ruint = { git = "https://github.com/scroll-tech/uint.git", branch = "v1.12.3" }
61-
tiny-keccak = { git = "https://github.com/scroll-tech/tiny-keccak", branch = "scroll-patch-v2.0.2-euclid-upgrade" }
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" }
61+
62+
ruint = { git = "https://github.com/scroll-tech/uint.git", branch = "v1.15.0" }
63+
alloy-primitives = { git = "https://github.com/scroll-tech/alloy-core", branch = "v1.2.0" }
6264

6365
[profile.maxperf]
6466
inherits = "release"

coordinator/cmd/tool/verify.go

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func verify(cCtx *cli.Context) error {
2828
proofType = cCtx.Args().Get(1)
2929
proofPath = cCtx.Args().Get(2)
3030
}
31-
log.Info("verify proof in: ", proofPath, "type", proofType, "forkName", forkName)
31+
log.Info("verify proof", "in", proofPath, "type", proofType, "forkName", forkName)
3232

3333
// Load the content of the proof file
3434
data, err := os.ReadFile(filepath.Clean(proofPath))
@@ -53,7 +53,7 @@ func verify(cCtx *cli.Context) error {
5353
return fmt.Errorf("no vk loaded for fork %s", forkName)
5454
}
5555
if len(proof.Vk) != 0 {
56-
if bytes.Equal(proof.Vk, vk) {
56+
if !bytes.Equal(proof.Vk, vk) {
5757
return fmt.Errorf("unmatch vk with expected: expected %s, get %s",
5858
base64.StdEncoding.EncodeToString(vk),
5959
base64.StdEncoding.EncodeToString(proof.Vk),
@@ -74,7 +74,7 @@ func verify(cCtx *cli.Context) error {
7474
return fmt.Errorf("no vk loaded for fork %s", forkName)
7575
}
7676
if len(proof.Vk) != 0 {
77-
if bytes.Equal(proof.Vk, vk) {
77+
if !bytes.Equal(proof.Vk, vk) {
7878
return fmt.Errorf("unmatch vk with expected: expected %s, get %s",
7979
base64.StdEncoding.EncodeToString(vk),
8080
base64.StdEncoding.EncodeToString(proof.Vk),
@@ -94,16 +94,7 @@ func verify(cCtx *cli.Context) error {
9494
if !ok {
9595
return fmt.Errorf("no vk loaded for fork %s", forkName)
9696
}
97-
if len(proof.Vk) != 0 {
98-
if bytes.Equal(proof.Vk, vk) {
99-
return fmt.Errorf("unmatch vk with expected: expected %s, get %s",
100-
base64.StdEncoding.EncodeToString(vk),
101-
base64.StdEncoding.EncodeToString(proof.Vk),
102-
)
103-
}
104-
} else {
105-
proof.Vk = vk
106-
}
97+
proof.Vk = vk
10798

10899
ret, err = vf.VerifyBundleProof(proof, forkName)
109100
default:

coordinator/internal/logic/libzkp/lib.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ import (
1717
"scroll-tech/common/types/message"
1818
)
1919

20+
func init() {
21+
C.init_tracing()
22+
}
23+
2024
// Helper function to convert Go string to C string and handle cleanup
2125
func goToCString(s string) *C.char {
2226
return C.CString(s)

coordinator/internal/logic/libzkp/libzkp.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88

99
#include <stddef.h> // For size_t
1010

11+
// Init log tracing
12+
void init_tracing();
13+
1114
// Initialize the verifier with configuration
1215
void init_verifier(char* config);
1316

coordinator/internal/logic/provertask/batch_prover_task.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func (bp *BatchProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
197197
taskMsg, metadata, err = bp.applyUniversal(taskMsg)
198198
if err != nil {
199199
bp.recoverActiveAttempts(ctx, batchTask)
200-
log.Error("Generate universal prover task failure", "task_id", batchTask.Hash, "type", "batch")
200+
log.Error("Generate universal prover task failure", "task_id", batchTask.Hash, "type", "batch", "err", err)
201201
return nil, ErrCoordinatorInternalFailure
202202
}
203203
proverTask.Metadata = metadata

coordinator/internal/logic/provertask/bundle_prover_task.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (bp *BundleProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinat
193193
taskMsg, metadata, err = bp.applyUniversal(taskMsg)
194194
if err != nil {
195195
bp.recoverActiveAttempts(ctx, bundleTask)
196-
log.Error("Generate universal prover task failure", "task_id", bundleTask.Hash, "type", "bundle")
196+
log.Error("Generate universal prover task failure", "task_id", bundleTask.Hash, "type", "bundle", "err", err)
197197
return nil, ErrCoordinatorInternalFailure
198198
}
199199
// bundle proof require snark

coordinator/internal/logic/provertask/chunk_prover_task.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ func (cp *ChunkProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
191191
taskMsg, metadata, err = cp.applyUniversal(taskMsg)
192192
if err != nil {
193193
cp.recoverActiveAttempts(ctx, chunkTask)
194-
log.Error("Generate universal prover task failure", "task_id", chunkTask.Hash, "type", "chunk")
194+
log.Error("Generate universal prover task failure", "task_id", chunkTask.Hash, "type", "chunk", "err", err)
195195
return nil, ErrCoordinatorInternalFailure
196196
}
197197
proverTask.Metadata = metadata

coordinator/internal/logic/verifier/verifier.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -117,19 +117,6 @@ func (v *Verifier) VerifyBundleProof(proof *message.OpenVMBundleProof, forkName
117117
return libzkp.VerifyBundleProof(string(buf), forkName), nil
118118
}
119119

120-
// func (v *Verifier) ReadVK(filePat string) (string, error) {
121-
122-
// f, err := os.Open(filepath.Clean(filePat))
123-
// if err != nil {
124-
// return "", err
125-
// }
126-
// byt, err := io.ReadAll(f)
127-
// if err != nil {
128-
// return "", err
129-
// }
130-
// return base64.StdEncoding.EncodeToString(byt), nil
131-
// }
132-
133120
func (v *Verifier) loadOpenVMVks(cfg config.AssetConfig) error {
134121

135122
vkFileName := cfg.Vkfile

coordinator/internal/orm/prover_task.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ func (o *ProverTask) UpdateProverTaskProvingStatusAndFailureType(ctx context.Con
269269
return nil
270270
}
271271

272-
// UpdateProverTaskProvingStatusAndFailureType updates the proving_status of a specific ProverTask record.
272+
// UpdateProverTaskAssignedTime updates the assigned_at time of a specific ProverTask record.
273273
func (o *ProverTask) UpdateProverTaskAssignedTime(ctx context.Context, uuid uuid.UUID, t time.Time, dbTX ...*gorm.DB) error {
274274
db := o.db
275275
if len(dbTX) > 0 && dbTX[0] != nil {

0 commit comments

Comments
 (0)