mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-12 07:28:08 -05:00
Compare commits
144 Commits
develop
...
v4.4.98-co
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
11afeb1354 | ||
|
|
cf41048c0a | ||
|
|
77d63226c5 | ||
|
|
135073c0ad | ||
|
|
bab0e4f8d6 | ||
|
|
2d620ddf4f | ||
|
|
8befb84910 | ||
|
|
4822d38aba | ||
|
|
cb87c7aedd | ||
|
|
3a3db5fe32 | ||
|
|
b4546af434 | ||
|
|
459941d942 | ||
|
|
9f480e5397 | ||
|
|
7d4ff80edf | ||
|
|
5869bfd825 | ||
|
|
12a262ad99 | ||
|
|
7d5b77a36c | ||
|
|
5f8bb53dce | ||
|
|
87e1235c7f | ||
|
|
86e6555a54 | ||
|
|
e3b17a0740 | ||
|
|
ef9e25f14c | ||
|
|
0fc28cb511 | ||
|
|
ad2e94e190 | ||
|
|
2846ecffa5 | ||
|
|
0e82c63ac4 | ||
|
|
9996af6227 | ||
|
|
8cf087c63b | ||
|
|
b984341991 | ||
|
|
7486236a7a | ||
|
|
a6ed321666 | ||
|
|
8db4e5c77d | ||
|
|
5cf8cda8a7 | ||
|
|
bcc6b0f7e0 | ||
|
|
fe6451b76c | ||
|
|
be88ef6c39 | ||
|
|
64368f9a79 | ||
|
|
f288179451 | ||
|
|
b8c7ec2b22 | ||
|
|
88da49383c | ||
|
|
1ea9acafa3 | ||
|
|
c743efd99e | ||
|
|
2d40f0f942 | ||
|
|
fcbaa674c6 | ||
|
|
110083c6c8 | ||
|
|
b3c1df7557 | ||
|
|
893bf18d62 | ||
|
|
7ec6d478b3 | ||
|
|
eacdc78ba7 | ||
|
|
2cc9f65852 | ||
|
|
af381223f3 | ||
|
|
bb6ee2c932 | ||
|
|
e99a8515b9 | ||
|
|
38b3239c6b | ||
|
|
d987931e30 | ||
|
|
90d15637eb | ||
|
|
4d677b344b | ||
|
|
d57e6b0e7b | ||
|
|
9b462e4c98 | ||
|
|
c9f6e8c6e1 | ||
|
|
867307d576 | ||
|
|
20dffe4ea5 | ||
|
|
57d50b7183 | ||
|
|
7a70e374b8 | ||
|
|
0799dd48f2 | ||
|
|
224546e380 | ||
|
|
95adcc378f | ||
|
|
47219f2d86 | ||
|
|
ab7038c0a7 | ||
|
|
d79aaef35a | ||
|
|
da963313b6 | ||
|
|
f27ddb7f8e | ||
|
|
94bee1903a | ||
|
|
b7e7d1a1f1 | ||
|
|
f1ea4b315c | ||
|
|
8b08a57f63 | ||
|
|
a868bc1531 | ||
|
|
101cc46bd9 | ||
|
|
9f4c9ee150 | ||
|
|
03c63a62cf | ||
|
|
b30f4d0b00 | ||
|
|
4333d51bef | ||
|
|
82dd5e0e5e | ||
|
|
f91c999005 | ||
|
|
c8b614fd2f | ||
|
|
a1c4562432 | ||
|
|
d6674e8a3d | ||
|
|
55b32e1c0c | ||
|
|
8ea431514d | ||
|
|
26a49cb2a3 | ||
|
|
e27ab5a396 | ||
|
|
554a233928 | ||
|
|
673777fe63 | ||
|
|
7353f30ff6 | ||
|
|
eb5758b693 | ||
|
|
47a6c23b1f | ||
|
|
081d28988d | ||
|
|
782e019f9c | ||
|
|
89ede0d315 | ||
|
|
a55de1fc09 | ||
|
|
ed394a6369 | ||
|
|
121ce09c80 | ||
|
|
0125dd62a6 | ||
|
|
bb9d404e85 | ||
|
|
e1a0bab452 | ||
|
|
50ebf179fd | ||
|
|
01fa3b34a7 | ||
|
|
2e9827a750 | ||
|
|
867fda6952 | ||
|
|
fbc14ac91b | ||
|
|
37924b0ae7 | ||
|
|
8b57dd6381 | ||
|
|
f13863e542 | ||
|
|
d3acd6b510 | ||
|
|
83c73f8458 | ||
|
|
bf084368c5 | ||
|
|
d503d4a990 | ||
|
|
ac17696171 | ||
|
|
b424cef816 | ||
|
|
e5ad9c618d | ||
|
|
848d3a6827 | ||
|
|
2bd0655fda | ||
|
|
f01af24908 | ||
|
|
2de45f0d54 | ||
|
|
c3a3bad800 | ||
|
|
9412c7ff3a | ||
|
|
5f2295043e | ||
|
|
69a80d4a4a | ||
|
|
8db5339c1f | ||
|
|
99c0a9fac5 | ||
|
|
f4e17bcca6 | ||
|
|
e713424e5c | ||
|
|
2efbbd7d77 | ||
|
|
310abdd543 | ||
|
|
5a479c3a08 | ||
|
|
783b965deb | ||
|
|
182f8e307c | ||
|
|
b460d4a717 | ||
|
|
421afe9c30 | ||
|
|
ca8d930bd6 | ||
|
|
940fde0cbf | ||
|
|
78c99636dc | ||
|
|
0c0c417829 | ||
|
|
41606fe7d7 |
2
.github/workflows/prover.yml
vendored
2
.github/workflows/prover.yml
vendored
@@ -48,7 +48,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@master
|
||||
with:
|
||||
toolchain: nightly-2023-12-03
|
||||
toolchain: nightly-2024-12-03
|
||||
components: rustfmt
|
||||
- name: Cargo cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
|
||||
152
common/libzkp/impl/Cargo.lock
generated
152
common/libzkp/impl/Cargo.lock
generated
@@ -396,7 +396,7 @@ checksum = "46ff7aa715eb2404cb87fa94390d2c5d5addd70d9617e20b2398ee6f48cb21f0"
|
||||
dependencies = [
|
||||
"alloy-sol-macro-input",
|
||||
"const-hex",
|
||||
"heck",
|
||||
"heck 0.5.0",
|
||||
"indexmap 2.7.1",
|
||||
"proc-macro-error2",
|
||||
"proc-macro2",
|
||||
@@ -414,7 +414,7 @@ checksum = "6f105fa700140c0cc6e2c3377adef650c389ac57b8ead8318a2e6bd52f1ae841"
|
||||
dependencies = [
|
||||
"const-hex",
|
||||
"dunce",
|
||||
"heck",
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
@@ -812,6 +812,12 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitstream-io"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6099cdc01846bc367c4e7dd630dc5966dccf36b652fae7a74e17b640411a91b2"
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "1.0.1"
|
||||
@@ -1078,7 +1084,7 @@ version = "4.5.28"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.98",
|
||||
@@ -2072,6 +2078,12 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
|
||||
|
||||
[[package]]
|
||||
name = "heck"
|
||||
version = "0.5.0"
|
||||
@@ -2645,18 +2657,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "munge"
|
||||
version = "0.4.3"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0091202c98cf06da46c279fdf50cccb6b1c43b4521abdf6a27b4c7e71d5d9d7"
|
||||
checksum = "64142d38c84badf60abf06ff9bd80ad2174306a5b11bd4706535090a30a419df"
|
||||
dependencies = [
|
||||
"munge_macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "munge_macro"
|
||||
version = "0.4.3"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "734799cf91479720b2f970c61a22850940dd91e27d4f02b1c6fc792778df2459"
|
||||
checksum = "1bb5c1d8184f13f7d0ccbeeca0def2f9a181bce2624302793005f5ca8aa62e5e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -5259,7 +5271,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "revm"
|
||||
version = "19.4.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#fdfbc90666769aec55c05a6aefdb6e5e1c32a3b3"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#562b7c67b8f0c0e4aee4f74fe6c0c983df58790c"
|
||||
dependencies = [
|
||||
"auto_impl",
|
||||
"cfg-if",
|
||||
@@ -5298,7 +5310,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "revm-interpreter"
|
||||
version = "15.1.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#fdfbc90666769aec55c05a6aefdb6e5e1c32a3b3"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#562b7c67b8f0c0e4aee4f74fe6c0c983df58790c"
|
||||
dependencies = [
|
||||
"revm-primitives 15.1.0",
|
||||
"serde",
|
||||
@@ -5336,7 +5348,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "revm-precompile"
|
||||
version = "16.0.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#fdfbc90666769aec55c05a6aefdb6e5e1c32a3b3"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#562b7c67b8f0c0e4aee4f74fe6c0c983df58790c"
|
||||
dependencies = [
|
||||
"aurora-engine-modexp",
|
||||
"c-kzg",
|
||||
@@ -5393,7 +5405,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "revm-primitives"
|
||||
version = "15.1.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#fdfbc90666769aec55c05a6aefdb6e5e1c32a3b3"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#562b7c67b8f0c0e4aee4f74fe6c0c983df58790c"
|
||||
dependencies = [
|
||||
"alloy-eip2930",
|
||||
"alloy-eip7702 0.5.1",
|
||||
@@ -5782,6 +5794,23 @@ dependencies = [
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scroll-zkvm-circuit-input-types"
|
||||
version = "0.1.1-rc.2"
|
||||
source = "git+https://github.com/scroll-tech/zkvm-prover.git?tag=v0.1.1-rc.3#01fb5e3b8b04f6e8a59056e1741f5d973589e727"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-serde 0.8.3",
|
||||
"itertools 0.14.0",
|
||||
"openvm",
|
||||
"openvm-rv32im-guest",
|
||||
"rkyv",
|
||||
"sbv",
|
||||
"serde",
|
||||
"tiny-keccak",
|
||||
"vm-zstd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scroll-zkvm-prover"
|
||||
version = "0.1.0-rc.6"
|
||||
@@ -5803,8 +5832,42 @@ dependencies = [
|
||||
"revm 19.5.0",
|
||||
"rkyv",
|
||||
"sbv",
|
||||
"scroll-zkvm-circuit-input-types",
|
||||
"scroll-zkvm-verifier",
|
||||
"scroll-zkvm-circuit-input-types 0.1.0-rc.6",
|
||||
"scroll-zkvm-verifier 0.1.0-rc.6",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_stacker",
|
||||
"snark-verifier-sdk",
|
||||
"thiserror 2.0.11",
|
||||
"toml",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scroll-zkvm-prover"
|
||||
version = "0.1.1-rc.2"
|
||||
source = "git+https://github.com/scroll-tech/zkvm-prover.git?tag=v0.1.1-rc.3#01fb5e3b8b04f6e8a59056e1741f5d973589e727"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"base64 0.22.1",
|
||||
"bincode",
|
||||
"c-kzg",
|
||||
"git-version",
|
||||
"hex",
|
||||
"metrics 0.23.0",
|
||||
"metrics-util",
|
||||
"munge",
|
||||
"once_cell",
|
||||
"openvm-circuit",
|
||||
"openvm-native-circuit",
|
||||
"openvm-native-recursion",
|
||||
"openvm-sdk",
|
||||
"openvm-stark-sdk",
|
||||
"revm 19.5.0",
|
||||
"rkyv",
|
||||
"sbv",
|
||||
"scroll-zkvm-circuit-input-types 0.1.1-rc.2",
|
||||
"scroll-zkvm-verifier 0.1.1-rc.2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_stacker",
|
||||
@@ -5828,7 +5891,26 @@ dependencies = [
|
||||
"openvm-sdk",
|
||||
"openvm-stark-sdk",
|
||||
"revm 19.5.0",
|
||||
"scroll-zkvm-circuit-input-types",
|
||||
"scroll-zkvm-circuit-input-types 0.1.0-rc.6",
|
||||
"serde",
|
||||
"snark-verifier-sdk",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scroll-zkvm-verifier"
|
||||
version = "0.1.1-rc.2"
|
||||
source = "git+https://github.com/scroll-tech/zkvm-prover.git?tag=v0.1.1-rc.3#01fb5e3b8b04f6e8a59056e1741f5d973589e727"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"eyre",
|
||||
"itertools 0.14.0",
|
||||
"openvm-circuit",
|
||||
"openvm-native-circuit",
|
||||
"openvm-native-recursion",
|
||||
"openvm-sdk",
|
||||
"openvm-stark-sdk",
|
||||
"revm 19.5.0",
|
||||
"scroll-zkvm-circuit-input-types 0.1.1-rc.2",
|
||||
"serde",
|
||||
"snark-verifier-sdk",
|
||||
]
|
||||
@@ -6198,6 +6280,12 @@ version = "0.11.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.26.3"
|
||||
@@ -6216,13 +6304,26 @@ dependencies = [
|
||||
"strum_macros 0.27.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.25.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
|
||||
dependencies = [
|
||||
"heck 0.4.1",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn 2.0.98",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.26.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4c6bee85a5a24955dc440386795aa378cd9cf82acd5f764469152d2270e581be"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
@@ -6235,7 +6336,7 @@ version = "0.27.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
@@ -6797,6 +6898,19 @@ version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "vm-zstd"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/scroll-tech/rust-zstd-decompressor.git?tag=v0.1.1#c7e953fc690d5f56f201892d88311c0f938f2d21"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitstream-io",
|
||||
"itertools 0.11.0",
|
||||
"serde",
|
||||
"strum 0.25.0",
|
||||
"strum_macros 0.25.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wait-timeout"
|
||||
version = "0.2.1"
|
||||
@@ -7310,8 +7424,10 @@ dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"once_cell",
|
||||
"scroll-zkvm-prover",
|
||||
"scroll-zkvm-verifier",
|
||||
"scroll-zkvm-prover 0.1.0-rc.6",
|
||||
"scroll-zkvm-prover 0.1.1-rc.2",
|
||||
"scroll-zkvm-verifier 0.1.0-rc.6",
|
||||
"scroll-zkvm-verifier 0.1.1-rc.2",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
|
||||
@@ -16,6 +16,8 @@ tiny-keccak = { git = "https://github.com/scroll-tech/tiny-keccak", branch = "sc
|
||||
[dependencies]
|
||||
euclid_prover = { git = "https://github.com/scroll-tech/zkvm-prover.git", tag = "v0.1.0-rc.6", package = "scroll-zkvm-prover" }
|
||||
euclid_verifier = { git = "https://github.com/scroll-tech/zkvm-prover.git", tag = "v0.1.0-rc.6", package = "scroll-zkvm-verifier" }
|
||||
euclidv2_prover = { git = "https://github.com/scroll-tech/zkvm-prover.git", tag = "v0.1.1-rc.3", package = "scroll-zkvm-prover" }
|
||||
euclidv2_verifier = { git = "https://github.com/scroll-tech/zkvm-prover.git", tag = "v0.1.1-rc.3", package = "scroll-zkvm-verifier" }
|
||||
|
||||
base64 = "0.13.0"
|
||||
env_logger = "0.9.0"
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#![allow(static_mut_refs)]
|
||||
|
||||
mod euclid;
|
||||
mod euclidv2;
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
use euclid::EuclidVerifier;
|
||||
use euclidv2::EuclidV2Verifier;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{cell::OnceCell, path::Path, rc::Rc};
|
||||
|
||||
@@ -47,9 +49,19 @@ static mut VERIFIER_LOW: OnceCell<VerifierPair> = OnceCell::new();
|
||||
static mut VERIFIER_HIGH: OnceCell<VerifierPair> = OnceCell::new();
|
||||
|
||||
pub fn init(config: VerifierConfig) {
|
||||
let verifier = EuclidVerifier::new(&config.high_version_circuit.assets_path);
|
||||
let verifier = EuclidVerifier::new(&config.low_version_circuit.assets_path);
|
||||
unsafe {
|
||||
VERIFIER_LOW
|
||||
.set(VerifierPair(
|
||||
config.low_version_circuit.fork_name,
|
||||
Rc::new(Box::new(verifier)),
|
||||
))
|
||||
.unwrap_unchecked();
|
||||
}
|
||||
|
||||
let verifier = EuclidV2Verifier::new(&config.high_version_circuit.assets_path);
|
||||
unsafe {
|
||||
VERIFIER_HIGH
|
||||
.set(VerifierPair(
|
||||
config.high_version_circuit.fork_name,
|
||||
Rc::new(Box::new(verifier)),
|
||||
|
||||
65
common/libzkp/impl/src/verifier/euclidv2.rs
Normal file
65
common/libzkp/impl/src/verifier/euclidv2.rs
Normal file
@@ -0,0 +1,65 @@
|
||||
use super::{ProofVerifier, TaskType, VKDump};
|
||||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::utils::panic_catch;
|
||||
use euclidv2_prover::{BatchProof, BundleProof, ChunkProof};
|
||||
use euclidv2_verifier::verifier::{BatchVerifier, BundleVerifier, ChunkVerifier};
|
||||
use std::{fs::File, path::Path};
|
||||
|
||||
pub struct EuclidV2Verifier {
|
||||
chunk_verifier: ChunkVerifier,
|
||||
batch_verifier: BatchVerifier,
|
||||
bundle_verifier: BundleVerifier,
|
||||
}
|
||||
|
||||
impl EuclidV2Verifier {
|
||||
pub fn new(assets_dir: &str) -> Self {
|
||||
let verifier_bin = Path::new(assets_dir).join("verifier.bin");
|
||||
let config = Path::new(assets_dir).join("root-verifier-vm-config");
|
||||
let exe = Path::new(assets_dir).join("root-verifier-committed-exe");
|
||||
|
||||
Self {
|
||||
chunk_verifier: ChunkVerifier::setup(&config, &exe, &verifier_bin)
|
||||
.expect("Setting up chunk verifier"),
|
||||
batch_verifier: BatchVerifier::setup(&config, &exe, &verifier_bin)
|
||||
.expect("Setting up batch verifier"),
|
||||
bundle_verifier: BundleVerifier::setup(&config, &exe, &verifier_bin)
|
||||
.expect("Setting up bundle verifier"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl ProofVerifier for EuclidV2Verifier {
|
||||
fn verify(&self, task_type: super::TaskType, proof: Vec<u8>) -> Result<bool> {
|
||||
panic_catch(|| match task_type {
|
||||
TaskType::Chunk => {
|
||||
let proof = serde_json::from_slice::<ChunkProof>(proof.as_slice()).unwrap();
|
||||
self.chunk_verifier
|
||||
.verify_proof(proof.proof.as_root_proof().unwrap())
|
||||
}
|
||||
TaskType::Batch => {
|
||||
let proof = serde_json::from_slice::<BatchProof>(proof.as_slice()).unwrap();
|
||||
self.batch_verifier
|
||||
.verify_proof(proof.proof.as_root_proof().unwrap())
|
||||
}
|
||||
TaskType::Bundle => {
|
||||
let proof = serde_json::from_slice::<BundleProof>(proof.as_slice()).unwrap();
|
||||
self.bundle_verifier
|
||||
.verify_proof_evm(&proof.proof.as_evm_proof().unwrap())
|
||||
}
|
||||
})
|
||||
.map_err(|err_str: String| anyhow::anyhow!(err_str))
|
||||
}
|
||||
|
||||
fn dump_vk(&self, file: &Path) {
|
||||
let f = File::create(file).expect("Failed to open file to dump VK");
|
||||
|
||||
let dump = VKDump {
|
||||
chunk_vk: base64::encode(self.chunk_verifier.get_app_vk()),
|
||||
batch_vk: base64::encode(self.batch_verifier.get_app_vk()),
|
||||
bundle_vk: base64::encode(self.bundle_verifier.get_app_vk()),
|
||||
};
|
||||
serde_json::to_writer(f, &dump).expect("Failed to dump VK");
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,13 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/scroll-tech/go-ethereum/common"
|
||||
"github.com/scroll-tech/go-ethereum/common/hexutil"
|
||||
"github.com/scroll-tech/go-ethereum/log"
|
||||
)
|
||||
|
||||
const (
|
||||
euclidFork = "euclid"
|
||||
EuclidFork = "euclid"
|
||||
EuclidV2Fork = "euclidV2"
|
||||
)
|
||||
|
||||
// ProofType represents the type of task.
|
||||
@@ -39,20 +42,26 @@ const (
|
||||
ProofTypeBundle
|
||||
)
|
||||
|
||||
// ChunkTaskDetail is a type containing ChunkTask detail.
|
||||
type ChunkTaskDetail struct {
|
||||
// LegacyChunkTaskDetail is a type containing ChunkTask detail.
|
||||
type LegacyChunkTaskDetail struct {
|
||||
BlockHashes []common.Hash `json:"block_hashes"`
|
||||
}
|
||||
|
||||
// EuclidV2ChunkTaskDetail is a type containing ChunkTask detail for euclid v2 chunk task.
|
||||
type EuclidV2ChunkTaskDetail struct {
|
||||
BlockHashes []common.Hash `json:"block_hashes"`
|
||||
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
|
||||
}
|
||||
|
||||
// BatchTaskDetail is a type containing BatchTask detail.
|
||||
type BatchTaskDetail struct {
|
||||
ChunkInfos []*ChunkInfo `json:"chunk_infos"`
|
||||
ChunkProofs []ChunkProof `json:"chunk_proofs"`
|
||||
BatchHeader interface{} `json:"batch_header"`
|
||||
BlobBytes []byte `json:"blob_bytes"`
|
||||
KzgProof []byte `json:"kzg_proof"`
|
||||
KzgCommitment []byte `json:"kzg_commitment"`
|
||||
Challenge common.Hash `json:"challenge"`
|
||||
ChunkInfos []*ChunkInfo `json:"chunk_infos"`
|
||||
ChunkProofs []ChunkProof `json:"chunk_proofs"`
|
||||
BatchHeader interface{} `json:"batch_header"`
|
||||
BlobBytes []byte `json:"blob_bytes"`
|
||||
KzgProof hexutil.Big `json:"kzg_proof"`
|
||||
KzgCommitment hexutil.Big `json:"kzg_commitment"`
|
||||
ChallengeDigest hexutil.Big `json:"challenge_digest"`
|
||||
}
|
||||
|
||||
// BundleTaskDetail consists of all the information required to describe the task to generate a proof for a bundle of batches.
|
||||
@@ -62,15 +71,28 @@ type BundleTaskDetail struct {
|
||||
|
||||
// ChunkInfo is for calculating pi_hash for chunk
|
||||
type ChunkInfo struct {
|
||||
ChainID uint64 `json:"chain_id"`
|
||||
PrevStateRoot common.Hash `json:"prev_state_root"`
|
||||
PostStateRoot common.Hash `json:"post_state_root"`
|
||||
WithdrawRoot common.Hash `json:"withdraw_root"`
|
||||
DataHash common.Hash `json:"data_hash"`
|
||||
IsPadding bool `json:"is_padding"`
|
||||
TxBytes []byte `json:"tx_bytes"`
|
||||
TxBytesHash common.Hash `json:"tx_data_digest"`
|
||||
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
|
||||
ChainID uint64 `json:"chain_id"`
|
||||
PrevStateRoot common.Hash `json:"prev_state_root"`
|
||||
PostStateRoot common.Hash `json:"post_state_root"`
|
||||
WithdrawRoot common.Hash `json:"withdraw_root"`
|
||||
DataHash common.Hash `json:"data_hash"`
|
||||
IsPadding bool `json:"is_padding"`
|
||||
TxBytes []byte `json:"tx_bytes"`
|
||||
TxBytesHash common.Hash `json:"tx_data_digest"`
|
||||
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
|
||||
PostMsgQueueHash common.Hash `json:"post_msg_queue_hash"`
|
||||
TxDataLength uint64 `json:"tx_data_length"`
|
||||
InitialBlockNumber uint64 `json:"initial_block_number"`
|
||||
BlockCtxs []BlockContextV2 `json:"block_ctxs"`
|
||||
}
|
||||
|
||||
// BlockContextV2 is the block context for euclid v2
|
||||
type BlockContextV2 struct {
|
||||
Timestamp uint64 `json:"timestamp"`
|
||||
BaseFee hexutil.Big `json:"base_fee"`
|
||||
GasLimit uint64 `json:"gas_limit"`
|
||||
NumTxs uint16 `json:"num_txs"`
|
||||
NumL1Msgs uint16 `json:"num_l1_msgs"`
|
||||
}
|
||||
|
||||
// SubCircuitRowUsage tracing info added in v0.11.0rc8
|
||||
@@ -86,8 +108,9 @@ type ChunkProof interface {
|
||||
|
||||
// NewChunkProof creates a new ChunkProof instance.
|
||||
func NewChunkProof(hardForkName string) ChunkProof {
|
||||
log.Info("NewChunkProof", "hardForkName", hardForkName, "euclidForkName", EuclidFork, "euclidV2ForkName", EuclidV2Fork)
|
||||
switch hardForkName {
|
||||
case euclidFork:
|
||||
case EuclidFork, EuclidV2Fork:
|
||||
return &OpenVMChunkProof{}
|
||||
default:
|
||||
return &Halo2ChunkProof{}
|
||||
@@ -120,8 +143,9 @@ type BatchProof interface {
|
||||
|
||||
// NewBatchProof creates a new BatchProof instance.
|
||||
func NewBatchProof(hardForkName string) BatchProof {
|
||||
log.Info("NewBatchProof", "hardForkName", hardForkName, "euclidForkName", EuclidFork, "euclidV2ForkName", EuclidV2Fork)
|
||||
switch hardForkName {
|
||||
case euclidFork:
|
||||
case EuclidFork, EuclidV2Fork:
|
||||
return &OpenVMBatchProof{}
|
||||
default:
|
||||
return &Halo2BatchProof{}
|
||||
@@ -177,8 +201,9 @@ type BundleProof interface {
|
||||
|
||||
// NewBundleProof creates a new BundleProof instance.
|
||||
func NewBundleProof(hardForkName string) BundleProof {
|
||||
log.Info("NewBundleProof", "hardForkName", hardForkName, "euclidForkName", EuclidFork, "euclidV2ForkName", EuclidV2Fork)
|
||||
switch hardForkName {
|
||||
case euclidFork:
|
||||
case EuclidFork, EuclidV2Fork:
|
||||
return &OpenVMBundleProof{}
|
||||
default:
|
||||
return &Halo2BundleProof{}
|
||||
@@ -258,12 +283,14 @@ func (p *OpenVMChunkProof) Proof() []byte {
|
||||
|
||||
// OpenVMBatchInfo is for calculating pi_hash for batch header
|
||||
type OpenVMBatchInfo struct {
|
||||
ParentBatchHash common.Hash `json:"parent_batch_hash"`
|
||||
ParentStateRoot common.Hash `json:"parent_state_root"`
|
||||
StateRoot common.Hash `json:"state_root"`
|
||||
WithdrawRoot common.Hash `json:"withdraw_root"`
|
||||
BatchHash common.Hash `json:"batch_hash"`
|
||||
ChainID uint64 `json:"chain_id"`
|
||||
ParentBatchHash common.Hash `json:"parent_batch_hash"`
|
||||
ParentStateRoot common.Hash `json:"parent_state_root"`
|
||||
StateRoot common.Hash `json:"state_root"`
|
||||
WithdrawRoot common.Hash `json:"withdraw_root"`
|
||||
BatchHash common.Hash `json:"batch_hash"`
|
||||
ChainID uint64 `json:"chain_id"`
|
||||
PrevMsgQueueHash common.Hash `json:"prev_msg_queue_hash"`
|
||||
PostMsgQueueHash common.Hash `json:"post_msg_queue_hash"`
|
||||
}
|
||||
|
||||
// BatchProof includes the proof info that are required for batch verification and rollup.
|
||||
@@ -323,6 +350,7 @@ type OpenVMBundleInfo struct {
|
||||
NumBatches uint32 `json:"num_batches"`
|
||||
PrevBatchHash common.Hash `json:"prev_batch_hash"`
|
||||
BatchHash common.Hash `json:"batch_hash"`
|
||||
MsgQueueHash common.Hash `json:"msg_queue_hash"`
|
||||
}
|
||||
|
||||
// OpenVMBundleProof includes the proof info that are required for verification of a bundle of batch proofs.
|
||||
|
||||
@@ -42,7 +42,7 @@ func NewLoginLogic(db *gorm.DB, cfg *config.Config, vf *verifier.Verifier) *Logi
|
||||
|
||||
var highHardForks []string
|
||||
highHardForks = append(highHardForks, cfg.ProverManager.Verifier.HighVersionCircuit.ForkName)
|
||||
if cfg.ProverManager.Verifier.HighVersionCircuit.ForkName != "euclid" {
|
||||
if cfg.ProverManager.Verifier.HighVersionCircuit.ForkName != "euclid" && cfg.ProverManager.Verifier.HighVersionCircuit.ForkName != "euclidV2" {
|
||||
highHardForks = append(highHardForks, cfg.ProverManager.Verifier.LowVersionCircuit.ForkName)
|
||||
}
|
||||
proverVersionHardForkMap[cfg.ProverManager.Verifier.HighVersionCircuit.MinProverVersion] = highHardForks
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"math/big"
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -11,6 +12,7 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"github.com/scroll-tech/da-codec/encoding"
|
||||
"github.com/scroll-tech/go-ethereum/common"
|
||||
"github.com/scroll-tech/go-ethereum/common/hexutil"
|
||||
"github.com/scroll-tech/go-ethereum/log"
|
||||
"github.com/scroll-tech/go-ethereum/params"
|
||||
"gorm.io/gorm"
|
||||
@@ -211,13 +213,19 @@ func (bp *BatchProverTask) formatProverTask(ctx context.Context, task *orm.Prove
|
||||
WithdrawRoot: common.HexToHash(chunk.WithdrawRoot),
|
||||
DataHash: common.HexToHash(chunk.Hash),
|
||||
PrevMsgQueueHash: common.HexToHash(chunk.PrevL1MessageQueueHash),
|
||||
PostMsgQueueHash: common.HexToHash(chunk.PostL1MessageQueueHash),
|
||||
IsPadding: false,
|
||||
}
|
||||
if haloProot, ok := proof.(*message.Halo2ChunkProof); ok {
|
||||
if haloProot.ChunkInfo != nil {
|
||||
chunkInfo.TxBytes = haloProot.ChunkInfo.TxBytes
|
||||
if halo2Proof, ok := proof.(*message.Halo2ChunkProof); ok {
|
||||
if halo2Proof.ChunkInfo != nil {
|
||||
chunkInfo.TxBytes = halo2Proof.ChunkInfo.TxBytes
|
||||
}
|
||||
}
|
||||
if openvmProof, ok := proof.(*message.OpenVMChunkProof); ok {
|
||||
chunkInfo.InitialBlockNumber = openvmProof.MetaData.ChunkInfo.InitialBlockNumber
|
||||
chunkInfo.BlockCtxs = openvmProof.MetaData.ChunkInfo.BlockCtxs
|
||||
chunkInfo.TxDataLength = openvmProof.MetaData.ChunkInfo.TxDataLength
|
||||
}
|
||||
chunkInfos = append(chunkInfos, &chunkInfo)
|
||||
}
|
||||
|
||||
@@ -231,6 +239,9 @@ func (bp *BatchProverTask) formatProverTask(ctx context.Context, task *orm.Prove
|
||||
return nil, fmt.Errorf("failed to marshal chunk proofs, taskID:%s err:%w", task.TaskID, err)
|
||||
}
|
||||
|
||||
log.Info("get batch task", "task_id", task.TaskID, "public_key", task.ProverPublicKey, "prover_name", task.ProverName, "prover_version", task.ProverVersion)
|
||||
log.Info("chunkProofsBytes", "chunkProofsBytes", string(chunkProofsBytes))
|
||||
|
||||
taskMsg := &coordinatorType.GetTaskSchema{
|
||||
UUID: task.UUID.String(),
|
||||
TaskID: task.TaskID,
|
||||
@@ -280,8 +291,8 @@ func (bp *BatchProverTask) getBatchTaskDetail(dbBatch *orm.Batch, chunkInfos []*
|
||||
// | z | y | kzg_commitment | kzg_proof |
|
||||
// |---------|---------|----------------|-----------|
|
||||
// | bytes32 | bytes32 | bytes48 | bytes48 |
|
||||
taskDetail.KzgProof = dbBatch.BlobDataProof[112:160]
|
||||
taskDetail.KzgCommitment = dbBatch.BlobDataProof[64:112]
|
||||
taskDetail.Challenge = common.Hash(dbBatch.BlobDataProof[0:32])
|
||||
taskDetail.KzgProof = hexutil.Big(*new(big.Int).SetBytes(dbBatch.BlobDataProof[112:160]))
|
||||
taskDetail.KzgCommitment = hexutil.Big(*new(big.Int).SetBytes(dbBatch.BlobDataProof[64:112]))
|
||||
taskDetail.ChallengeDigest = hexutil.Big(*new(big.Int).SetBytes(dbBatch.BlobDataProof[0:32])) // FIXME: Challenge = ChallengeDigest % BLS_MODULUS, get the original ChallengeDigest.
|
||||
return taskDetail, nil
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"github.com/scroll-tech/go-ethereum/common"
|
||||
"github.com/scroll-tech/go-ethereum/log"
|
||||
"github.com/scroll-tech/go-ethereum/params"
|
||||
"gorm.io/gorm"
|
||||
@@ -162,7 +163,7 @@ func (cp *ChunkProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
|
||||
return nil, ErrCoordinatorInternalFailure
|
||||
}
|
||||
|
||||
taskMsg, err := cp.formatProverTask(ctx.Copy(), &proverTask, hardForkName)
|
||||
taskMsg, err := cp.formatProverTask(ctx.Copy(), &proverTask, chunkTask, hardForkName)
|
||||
if err != nil {
|
||||
cp.recoverActiveAttempts(ctx, chunkTask)
|
||||
log.Error("format prover task failure", "task_id", chunkTask.Hash, "err", err)
|
||||
@@ -179,29 +180,46 @@ func (cp *ChunkProverTask) Assign(ctx *gin.Context, getTaskParameter *coordinato
|
||||
return taskMsg, nil
|
||||
}
|
||||
|
||||
func (cp *ChunkProverTask) formatProverTask(ctx context.Context, task *orm.ProverTask, hardForkName string) (*coordinatorType.GetTaskSchema, error) {
|
||||
func (cp *ChunkProverTask) formatProverTask(ctx context.Context, task *orm.ProverTask, chunk *orm.Chunk, hardForkName string) (*coordinatorType.GetTaskSchema, error) {
|
||||
// Get block hashes.
|
||||
blockHashes, dbErr := cp.blockOrm.GetL2BlockHashesByChunkHash(ctx, task.TaskID)
|
||||
if dbErr != nil || len(blockHashes) == 0 {
|
||||
return nil, fmt.Errorf("failed to fetch block hashes of a chunk, chunk hash:%s err:%w", task.TaskID, dbErr)
|
||||
}
|
||||
|
||||
taskDetail := message.ChunkTaskDetail{
|
||||
BlockHashes: blockHashes,
|
||||
}
|
||||
blockHashesBytes, err := json.Marshal(taskDetail)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal block hashes hash:%s, err:%w", task.TaskID, err)
|
||||
var taskDetailBytes []byte
|
||||
if hardForkName == message.EuclidV2Fork {
|
||||
taskDetail := message.EuclidV2ChunkTaskDetail{
|
||||
BlockHashes: blockHashes,
|
||||
PrevMsgQueueHash: common.HexToHash(chunk.PrevL1MessageQueueHash),
|
||||
}
|
||||
var err error
|
||||
taskDetailBytes, err = json.Marshal(taskDetail)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal block hashes hash:%s, err:%w", task.TaskID, err)
|
||||
}
|
||||
} else {
|
||||
taskDetail := message.LegacyChunkTaskDetail{
|
||||
BlockHashes: blockHashes,
|
||||
}
|
||||
var err error
|
||||
taskDetailBytes, err = json.Marshal(taskDetail)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to marshal block hashes hash:%s, err:%w", task.TaskID, err)
|
||||
}
|
||||
}
|
||||
|
||||
proverTaskSchema := &coordinatorType.GetTaskSchema{
|
||||
UUID: task.UUID.String(),
|
||||
TaskID: task.TaskID,
|
||||
TaskType: int(message.ProofTypeChunk),
|
||||
TaskData: string(blockHashesBytes),
|
||||
TaskData: string(taskDetailBytes),
|
||||
HardForkName: hardForkName,
|
||||
}
|
||||
|
||||
log.Info("format prover task", "task_id", task.TaskID, "task_type", message.ProofTypeChunk.String(), "hard_fork_name", hardForkName)
|
||||
log.Info("TaskData", "task_id", task.TaskID, "task_data", proverTaskSchema.TaskData, "taskDetail", string(taskDetailBytes))
|
||||
|
||||
return proverTaskSchema, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -99,15 +99,16 @@ func NewVerifier(cfg *config.VerifierConfig) (*Verifier, error) {
|
||||
OpenVMVkMap: make(map[string]struct{}),
|
||||
}
|
||||
|
||||
if err := v.loadLowVersionVKs(cfg); err != nil {
|
||||
return nil, err
|
||||
if cfg.LowVersionCircuit.ForkName == message.EuclidFork {
|
||||
if err := v.loadOpenVMVks(cfg.LowVersionCircuit.ForkName); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
|
||||
if err := v.loadOpenVMVks(cfg.HighVersionCircuit.ForkName); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
v.loadCurieVersionVKs()
|
||||
return v, nil
|
||||
}
|
||||
|
||||
@@ -204,31 +205,6 @@ func (v *Verifier) readVK(filePat string) (string, error) {
|
||||
return base64.StdEncoding.EncodeToString(byt), nil
|
||||
}
|
||||
|
||||
// load low version vks, current is darwin
|
||||
func (v *Verifier) loadLowVersionVKs(cfg *config.VerifierConfig) error {
|
||||
bundleVK, err := v.readVK(path.Join(cfg.LowVersionCircuit.AssetsPath, "vk_bundle.vkey"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
batchVK, err := v.readVK(path.Join(cfg.LowVersionCircuit.AssetsPath, "vk_batch.vkey"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
chunkVK, err := v.readVK(path.Join(cfg.LowVersionCircuit.AssetsPath, "vk_chunk.vkey"))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
v.BundleVkMap[bundleVK] = struct{}{}
|
||||
v.BatchVKMap[batchVK] = struct{}{}
|
||||
v.ChunkVKMap[chunkVK] = struct{}{}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (v *Verifier) loadCurieVersionVKs() {
|
||||
v.BatchVKMap["AAAAGgAAAARX2S0K1wF333B1waOsnG/vcASJmWG9YM6SNWCBy1ywD9jfGkei+f0wNYpkjW7JO12EfU7CjYVBo+PGku3zaQJI64lbn6BwyTBa4RfrPFpV5mP47ix0sXZ+Wt5wklMLRW7OIJb1yfCDm+gkSsp3/Zqrxt4SY4rQ4WtHfynTCQ0KDi78jNuiFvwxO3ub3DkgGVaxMkGxTRP/Vz6E7MCZMUBR5wZFcMzJn+73f0wYjDxfj00krg9O1VrwVxbVV1ycLR6oQLcOgm/l+xwth8io0vDpF9OY21gD5DgJn9GgcYe8KoRVEbEqApLZPdBibpcSMTY9czZI2LnFcqrDDmYvhEwgjhZrsTog2xLXOODoOupZ/is5ekQ9Gi0y871b1mLlCGA="] = struct{}{}
|
||||
v.ChunkVKMap["AAAAGQAAAATyWEABRbJ6hQQ5/zLX1gTasr7349minA9rSgMS6gDeHwZKqikRiO3md+pXjjxMHnKQtmXYgMXhJSvlmZ+Ws+cheuly2X1RuNQzcZuRImaKPR9LJsVZYsXfJbuqdKX8p0Gj8G83wMJOmTzNVUyUol0w0lTU+CEiTpHOnxBsTF3EWaW3s1u4ycOgWt1c9M6s7WmaBZLYgAWYCunO5CLCLApNGbCASeck/LuSoedEri5u6HccCKU2khG6zl6W07jvYSbDVLJktbjRiHv+/HQix+K14j8boo8Z/unhpwXCsPxkQA=="] = struct{}{}
|
||||
}
|
||||
|
||||
func (v *Verifier) loadOpenVMVks(forkName string) error {
|
||||
tempFile := path.Join(os.TempDir(), "openVmVk.json")
|
||||
defer func() {
|
||||
|
||||
135
zkvm-prover/Cargo.lock
generated
135
zkvm-prover/Cargo.lock
generated
@@ -1149,6 +1149,12 @@ dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitstream-io"
|
||||
version = "2.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6099cdc01846bc367c4e7dd630dc5966dccf36b652fae7a74e17b640411a91b2"
|
||||
|
||||
[[package]]
|
||||
name = "bitvec"
|
||||
version = "1.0.1"
|
||||
@@ -3741,18 +3747,18 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "munge"
|
||||
version = "0.4.3"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0091202c98cf06da46c279fdf50cccb6b1c43b4521abdf6a27b4c7e71d5d9d7"
|
||||
checksum = "64142d38c84badf60abf06ff9bd80ad2174306a5b11bd4706535090a30a419df"
|
||||
dependencies = [
|
||||
"munge_macro",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "munge_macro"
|
||||
version = "0.4.3"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "734799cf91479720b2f970c61a22850940dd91e27d4f02b1c6fc792778df2459"
|
||||
checksum = "1bb5c1d8184f13f7d0ccbeeca0def2f9a181bce2624302793005f5ca8aa62e5e"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -5726,7 +5732,8 @@ dependencies = [
|
||||
"rlp",
|
||||
"sbv-primitives",
|
||||
"scroll-proving-sdk",
|
||||
"scroll-zkvm-prover",
|
||||
"scroll-zkvm-prover 0.1.0-rc.6",
|
||||
"scroll-zkvm-prover 0.1.1-rc.2",
|
||||
"serde",
|
||||
"serde_bytes",
|
||||
"serde_json",
|
||||
@@ -6823,7 +6830,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "revm"
|
||||
version = "19.4.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#fdfbc90666769aec55c05a6aefdb6e5e1c32a3b3"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#562b7c67b8f0c0e4aee4f74fe6c0c983df58790c"
|
||||
dependencies = [
|
||||
"auto_impl",
|
||||
"cfg-if",
|
||||
@@ -6862,7 +6869,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "revm-interpreter"
|
||||
version = "15.1.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#fdfbc90666769aec55c05a6aefdb6e5e1c32a3b3"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#562b7c67b8f0c0e4aee4f74fe6c0c983df58790c"
|
||||
dependencies = [
|
||||
"revm-primitives 15.1.0",
|
||||
"serde",
|
||||
@@ -6900,7 +6907,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "revm-precompile"
|
||||
version = "16.0.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#fdfbc90666769aec55c05a6aefdb6e5e1c32a3b3"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#562b7c67b8f0c0e4aee4f74fe6c0c983df58790c"
|
||||
dependencies = [
|
||||
"aurora-engine-modexp",
|
||||
"c-kzg",
|
||||
@@ -6957,7 +6964,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "revm-primitives"
|
||||
version = "15.1.0"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#fdfbc90666769aec55c05a6aefdb6e5e1c32a3b3"
|
||||
source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor%2Ffeat%2Fv55%2Feuclid-v2#562b7c67b8f0c0e4aee4f74fe6c0c983df58790c"
|
||||
dependencies = [
|
||||
"alloy-eip2930",
|
||||
"alloy-eip7702 0.5.1",
|
||||
@@ -7530,7 +7537,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "scroll-proving-sdk"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/scroll-tech/scroll-proving-sdk.git?rev=af95d2a#af95d2a85109a4e44482cf4deb3dadfbb8617ef0"
|
||||
source = "git+https://github.com/scroll-tech/scroll-proving-sdk.git?rev=ea16370#ea163700741aebde4422ac6c9798a47c8704ccab"
|
||||
dependencies = [
|
||||
"alloy",
|
||||
"anyhow",
|
||||
@@ -7575,6 +7582,23 @@ dependencies = [
|
||||
"tiny-keccak",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scroll-zkvm-circuit-input-types"
|
||||
version = "0.1.1-rc.2"
|
||||
source = "git+https://github.com/scroll-tech/zkvm-prover?tag=v0.1.1-rc.3#01fb5e3b8b04f6e8a59056e1741f5d973589e727"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-serde 0.8.3",
|
||||
"itertools 0.14.0",
|
||||
"openvm",
|
||||
"openvm-rv32im-guest",
|
||||
"rkyv",
|
||||
"sbv",
|
||||
"serde",
|
||||
"tiny-keccak",
|
||||
"vm-zstd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scroll-zkvm-prover"
|
||||
version = "0.1.0-rc.6"
|
||||
@@ -7596,8 +7620,42 @@ dependencies = [
|
||||
"revm 19.5.0",
|
||||
"rkyv",
|
||||
"sbv",
|
||||
"scroll-zkvm-circuit-input-types",
|
||||
"scroll-zkvm-verifier",
|
||||
"scroll-zkvm-circuit-input-types 0.1.0-rc.6",
|
||||
"scroll-zkvm-verifier 0.1.0-rc.6",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_stacker",
|
||||
"snark-verifier-sdk",
|
||||
"thiserror 2.0.11",
|
||||
"toml",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scroll-zkvm-prover"
|
||||
version = "0.1.1-rc.2"
|
||||
source = "git+https://github.com/scroll-tech/zkvm-prover?tag=v0.1.1-rc.3#01fb5e3b8b04f6e8a59056e1741f5d973589e727"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"base64 0.22.1",
|
||||
"bincode",
|
||||
"c-kzg",
|
||||
"git-version",
|
||||
"hex",
|
||||
"metrics 0.23.0",
|
||||
"metrics-util",
|
||||
"munge",
|
||||
"once_cell",
|
||||
"openvm-circuit",
|
||||
"openvm-native-circuit",
|
||||
"openvm-native-recursion",
|
||||
"openvm-sdk",
|
||||
"openvm-stark-sdk",
|
||||
"revm 19.5.0",
|
||||
"rkyv",
|
||||
"sbv",
|
||||
"scroll-zkvm-circuit-input-types 0.1.1-rc.2",
|
||||
"scroll-zkvm-verifier 0.1.1-rc.2",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_stacker",
|
||||
@@ -7621,7 +7679,26 @@ dependencies = [
|
||||
"openvm-sdk",
|
||||
"openvm-stark-sdk",
|
||||
"revm 19.5.0",
|
||||
"scroll-zkvm-circuit-input-types",
|
||||
"scroll-zkvm-circuit-input-types 0.1.0-rc.6",
|
||||
"serde",
|
||||
"snark-verifier-sdk",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "scroll-zkvm-verifier"
|
||||
version = "0.1.1-rc.2"
|
||||
source = "git+https://github.com/scroll-tech/zkvm-prover?tag=v0.1.1-rc.3#01fb5e3b8b04f6e8a59056e1741f5d973589e727"
|
||||
dependencies = [
|
||||
"bincode",
|
||||
"eyre",
|
||||
"itertools 0.14.0",
|
||||
"openvm-circuit",
|
||||
"openvm-native-circuit",
|
||||
"openvm-native-recursion",
|
||||
"openvm-sdk",
|
||||
"openvm-stark-sdk",
|
||||
"revm 19.5.0",
|
||||
"scroll-zkvm-circuit-input-types 0.1.1-rc.2",
|
||||
"serde",
|
||||
"snark-verifier-sdk",
|
||||
]
|
||||
@@ -8140,6 +8217,12 @@ dependencies = [
|
||||
"strum_macros 0.24.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.25.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "290d54ea6f91c969195bdbcd7442c8c2a2ba87da8bf60a7ee86a235d4bc1e125"
|
||||
|
||||
[[package]]
|
||||
name = "strum"
|
||||
version = "0.26.3"
|
||||
@@ -8171,6 +8254,19 @@ dependencies = [
|
||||
"syn 1.0.109",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.25.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23dc1fa9ac9c169a78ba62f0b841814b7abae11bdd047b9c58f893439e309ea0"
|
||||
dependencies = [
|
||||
"heck 0.4.1",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"rustversion",
|
||||
"syn 2.0.98",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strum_macros"
|
||||
version = "0.26.4"
|
||||
@@ -9025,6 +9121,19 @@ version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
||||
|
||||
[[package]]
|
||||
name = "vm-zstd"
|
||||
version = "0.1.1"
|
||||
source = "git+https://github.com/scroll-tech/rust-zstd-decompressor.git?tag=v0.1.1#c7e953fc690d5f56f201892d88311c0f938f2d21"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"bitstream-io",
|
||||
"itertools 0.11.0",
|
||||
"serde",
|
||||
"strum 0.25.0",
|
||||
"strum_macros 0.25.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wait-timeout"
|
||||
version = "0.2.1"
|
||||
|
||||
@@ -18,10 +18,11 @@ serde = { version = "1.0.198", features = ["derive"] }
|
||||
serde_json = "1.0.116"
|
||||
futures = "0.3.30"
|
||||
|
||||
scroll-zkvm-prover = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.1.0-rc.6" }
|
||||
scroll-zkvm-prover-euclid = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.1.0-rc.6", package = "scroll-zkvm-prover" }
|
||||
scroll-zkvm-prover-euclidv2 = { git = "https://github.com/scroll-tech/zkvm-prover", tag = "v0.1.1-rc.3", package = "scroll-zkvm-prover" }
|
||||
ethers-core = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0.7" }
|
||||
ethers-providers = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0.7" }
|
||||
scroll-proving-sdk = { git = "https://github.com/scroll-tech/scroll-proving-sdk.git", rev = "af95d2a", features = [
|
||||
scroll-proving-sdk = { git = "https://github.com/scroll-tech/scroll-proving-sdk.git", rev = "ea16370", features = [
|
||||
"openvm",
|
||||
] }
|
||||
sbv-primitives = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "zkvm/euclid-v2", features = [
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
"db_path": "unique-db-path-for-prover-1"
|
||||
},
|
||||
"circuits": {
|
||||
"euclid": {
|
||||
"hard_fork_name": "euclid",
|
||||
"euclidV2": {
|
||||
"hard_fork_name": "euclidV2",
|
||||
"workspace_path": "/home/ubuntu/prover-workdir"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
use crate::zk_circuits_handler::{euclid::EuclidHandler, CircuitsHandler};
|
||||
use crate::zk_circuits_handler::{
|
||||
euclid::EuclidHandler, euclidV2::EuclidV2Handler, CircuitsHandler,
|
||||
};
|
||||
use anyhow::{anyhow, Result};
|
||||
use async_trait::async_trait;
|
||||
use scroll_proving_sdk::{
|
||||
@@ -62,16 +64,23 @@ impl ProvingService for LocalProver {
|
||||
async fn get_vks(&self, req: GetVkRequest) -> GetVkResponse {
|
||||
let mut vks = vec![];
|
||||
for hard_fork_name in self.config.circuits.keys() {
|
||||
println!("\n\n\nhard fork = {:?}", hard_fork_name);
|
||||
let handler = self.new_handler(hard_fork_name);
|
||||
println!("request proof-types = {:?}", req.proof_types);
|
||||
for proof_type in &req.proof_types {
|
||||
let vk = handler.get_vk(*proof_type).await;
|
||||
println!("proof type = {:?}, vk = {:?}", proof_type, vk);
|
||||
|
||||
if let Some(vk) = vk {
|
||||
vks.push(base64::encode(vk));
|
||||
let vk_base64 = base64::encode(vk);
|
||||
println!("vk (base64) = {:?}", vk_base64);
|
||||
vks.push(vk_base64);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
println!("\n\n\nall vks = {:#?}", vks);
|
||||
|
||||
GetVkResponse { vks, error: None }
|
||||
}
|
||||
async fn prove(&mut self, req: ProveRequest) -> ProveResponse {
|
||||
@@ -177,13 +186,20 @@ impl LocalProver {
|
||||
}
|
||||
|
||||
fn new_handler(&self, hard_fork_name: &str) -> Arc<dyn CircuitsHandler> {
|
||||
println!("in new_handler");
|
||||
// if we got assigned a task for an unknown hard fork, there is something wrong in the
|
||||
// coordinator
|
||||
let config = self.config.circuits.get(hard_fork_name).unwrap();
|
||||
println!("config workspace path for hard-fork {:?} = {:?}", hard_fork_name, config.workspace_path);
|
||||
|
||||
Arc::new(match hard_fork_name {
|
||||
"euclid" => Arc::new(Mutex::new(EuclidHandler::new(&config.workspace_path))),
|
||||
match hard_fork_name {
|
||||
"euclid" => Arc::new(Arc::new(Mutex::new(EuclidHandler::new(
|
||||
&config.workspace_path,
|
||||
)))) as Arc<dyn CircuitsHandler>,
|
||||
"euclidV2" => Arc::new(Arc::new(Mutex::new(EuclidV2Handler::new(
|
||||
&config.workspace_path,
|
||||
)))) as Arc<dyn CircuitsHandler>,
|
||||
_ => unreachable!(),
|
||||
}) as Arc<dyn CircuitsHandler>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
pub mod euclid;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
pub mod euclidV2;
|
||||
|
||||
use anyhow::Result;
|
||||
use async_trait::async_trait;
|
||||
use scroll_proving_sdk::prover::{proving_service::ProveRequest, ProofType};
|
||||
|
||||
@@ -4,7 +4,7 @@ use super::CircuitsHandler;
|
||||
use anyhow::{anyhow, Result};
|
||||
use async_trait::async_trait;
|
||||
use scroll_proving_sdk::prover::{proving_service::ProveRequest, ProofType};
|
||||
use scroll_zkvm_prover::{
|
||||
use scroll_zkvm_prover_euclid::{
|
||||
task::{batch::BatchProvingTask, bundle::BundleProvingTask, chunk::ChunkProvingTask},
|
||||
BatchProver, BundleProver, ChunkProver,
|
||||
};
|
||||
|
||||
105
zkvm-prover/src/zk_circuits_handler/euclidV2.rs
Normal file
105
zkvm-prover/src/zk_circuits_handler/euclidV2.rs
Normal file
@@ -0,0 +1,105 @@
|
||||
use std::{path::Path, sync::Arc};
|
||||
|
||||
use super::CircuitsHandler;
|
||||
use anyhow::{anyhow, Result};
|
||||
use async_trait::async_trait;
|
||||
use scroll_proving_sdk::prover::{proving_service::ProveRequest, ProofType};
|
||||
use scroll_zkvm_prover_euclidv2::{
|
||||
task::{batch::BatchProvingTask, bundle::BundleProvingTask, chunk::ChunkProvingTask},
|
||||
BatchProver, BundleProver, ChunkProver,
|
||||
};
|
||||
use tokio::sync::Mutex;
|
||||
pub struct EuclidV2Handler {
|
||||
chunk_prover: ChunkProver,
|
||||
batch_prover: BatchProver,
|
||||
bundle_prover: BundleProver,
|
||||
}
|
||||
|
||||
unsafe impl Send for EuclidV2Handler {}
|
||||
|
||||
impl EuclidV2Handler {
|
||||
pub fn new(workspace_path: &str) -> Self {
|
||||
let workspace_path = Path::new(workspace_path);
|
||||
println!("ok 1");
|
||||
|
||||
let cache_dir = workspace_path.join("cache");
|
||||
let chunk_exe = workspace_path.join("chunk/app.vmexe");
|
||||
let chunk_app_config = workspace_path.join("chunk/openvm.toml");
|
||||
let chunk_prover = ChunkProver::setup(
|
||||
chunk_exe,
|
||||
chunk_app_config,
|
||||
Some(cache_dir.clone()),
|
||||
Default::default(),
|
||||
)
|
||||
.expect("Failed to setup chunk prover");
|
||||
println!("ok 2");
|
||||
|
||||
let batch_exe = workspace_path.join("batch/app.vmexe");
|
||||
let batch_app_config = workspace_path.join("batch/openvm.toml");
|
||||
let batch_prover = BatchProver::setup(
|
||||
batch_exe,
|
||||
batch_app_config,
|
||||
Some(cache_dir.clone()),
|
||||
Default::default(),
|
||||
)
|
||||
.expect("Failed to setup batch prover");
|
||||
println!("ok 3");
|
||||
|
||||
let bundle_exe = workspace_path.join("bundle/app.vmexe");
|
||||
let bundle_app_config = workspace_path.join("bundle/openvm.toml");
|
||||
let bundle_prover = BundleProver::setup(
|
||||
bundle_exe,
|
||||
bundle_app_config,
|
||||
Some(cache_dir),
|
||||
Default::default(),
|
||||
)
|
||||
.expect("Failed to setup bundle prover");
|
||||
println!("ok 4");
|
||||
|
||||
Self {
|
||||
chunk_prover,
|
||||
batch_prover,
|
||||
bundle_prover,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl CircuitsHandler for Arc<Mutex<EuclidV2Handler>> {
|
||||
async fn get_vk(&self, task_type: ProofType) -> Option<Vec<u8>> {
|
||||
Some(match task_type {
|
||||
ProofType::Chunk => self.try_lock().unwrap().chunk_prover.get_app_vk(),
|
||||
ProofType::Batch => self.try_lock().unwrap().batch_prover.get_app_vk(),
|
||||
ProofType::Bundle => self.try_lock().unwrap().bundle_prover.get_app_vk(),
|
||||
_ => unreachable!("Unsupported proof type"),
|
||||
})
|
||||
}
|
||||
|
||||
async fn get_proof_data(&self, prove_request: ProveRequest) -> Result<String> {
|
||||
match prove_request.proof_type {
|
||||
ProofType::Chunk => {
|
||||
let task: ChunkProvingTask = serde_json::from_str(&prove_request.input)?;
|
||||
let proof = self.try_lock().unwrap().chunk_prover.gen_proof(&task)?;
|
||||
|
||||
Ok(serde_json::to_string(&proof)?)
|
||||
}
|
||||
ProofType::Batch => {
|
||||
let task: BatchProvingTask = serde_json::from_str(&prove_request.input)?;
|
||||
let proof = self.try_lock().unwrap().batch_prover.gen_proof(&task)?;
|
||||
|
||||
Ok(serde_json::to_string(&proof)?)
|
||||
}
|
||||
ProofType::Bundle => {
|
||||
let batch_proofs: BundleProvingTask = serde_json::from_str(&prove_request.input)?;
|
||||
let proof = self
|
||||
.try_lock()
|
||||
.unwrap()
|
||||
.bundle_prover
|
||||
.gen_proof_evm(&batch_proofs)?;
|
||||
|
||||
Ok(serde_json::to_string(&proof)?)
|
||||
}
|
||||
_ => Err(anyhow!("Unsupported proof type")),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user