Compare commits

...

156 Commits

Author SHA1 Message Date
colinlyguo
91319712e6 feat(coordinator): support ChallengeDigest in batch task detail 2025-03-18 11:28:07 +08:00
colinlyguo
3ee2d2b39c tweaks 2025-03-18 01:30:06 +08:00
Morty
4b21c79443 update scroll-proving-sdk commit 2025-03-17 18:08:21 +08:00
xkx
c6f0299373 feat: euclid v2 GPU prover (#1623)
Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
Co-authored-by: Morty <70688412+yiweichi@users.noreply.github.com>
2025-03-17 15:32:44 +08:00
Morty
3454c6c670 update scroll-proving-sdk commit 2025-03-16 06:03:28 +08:00
colinlyguo
901693a2c0 remove a log 2025-03-14 18:42:31 +08:00
Ho
0bb53140f5 fix: byte48 type required in prover (#1627)
Signed-off-by: noelwei <fan@scroll.io>
Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com>
2025-03-14 17:39:45 +08:00
Morty
09790c4448 fix: clap deprecated warnings 2025-03-14 15:23:30 +08:00
colinlyguo
ae212a919a fix logs 2025-03-14 14:02:07 +08:00
colinlyguo
9b5c42e9d9 tweak logs 2025-03-14 13:46:44 +08:00
Rohit Narurkar
60877d3c16 fix: reduce segment len in prover config (#1631) 2025-03-13 21:28:28 +08:00
Morty
07d1621310 update scroll-proving-sdk commit (#1630) 2025-03-13 19:08:48 +08:00
colinlyguo
11afeb1354 update verifier 2025-03-13 15:31:07 +08:00
Morty
cf41048c0a Update rc3 (#1629) 2025-03-13 15:23:17 +08:00
colinlyguo
77d63226c5 fix 2025-03-13 14:29:53 +08:00
colinlyguo
135073c0ad Reapply "feat: add euclidv2 verifier"
This reverts commit 7d5b77a36c.
2025-03-13 14:26:31 +08:00
colin
bab0e4f8d6 Merge branch 'develop' into feat/openvm-euclid-v2 2025-03-13 13:35:00 +08:00
colinlyguo
2d620ddf4f fix 2025-03-13 05:40:02 +08:00
colinlyguo
8befb84910 fix 2025-03-13 04:51:27 +08:00
colinlyguo
4822d38aba fix 2025-03-13 04:45:54 +08:00
colinlyguo
cb87c7aedd another type fix 2025-03-13 04:24:35 +08:00
colinlyguo
3a3db5fe32 add logs 2025-03-13 03:52:01 +08:00
colinlyguo
b4546af434 remove load vks 2025-03-13 03:29:38 +08:00
colinlyguo
459941d942 use hexutil.Big 2025-03-13 03:27:38 +08:00
colinlyguo
9f480e5397 fix 2025-03-13 03:12:11 +08:00
colinlyguo
7d4ff80edf update type error 2025-03-13 03:07:52 +08:00
colinlyguo
5869bfd825 load low version open vm circuit 2025-03-13 02:59:42 +08:00
colinlyguo
12a262ad99 align new types 2025-03-13 02:25:49 +08:00
colinlyguo
7d5b77a36c Revert "feat: add euclidv2 verifier"
This reverts commit ef9e25f14c.
2025-03-13 00:40:24 +08:00
Morty
5f8bb53dce update scroll-proving-sdk version (#1626) 2025-03-12 23:43:40 +08:00
colinlyguo
87e1235c7f fix 2025-03-12 23:31:47 +08:00
colin
86e6555a54 Merge branch 'develop' into feat/openvm-euclid-v2 2025-03-12 23:19:12 +08:00
colinlyguo
e3b17a0740 add PostMsgQueueHash in chunk info 2025-03-12 23:18:06 +08:00
Ömer Faruk Irmak
ef9e25f14c feat: add euclidv2 verifier 2025-03-12 18:17:59 +03:00
Morty
0fc28cb511 fix(coordinator): euclid v2 prover compatibility (#1625) 2025-03-12 22:22:06 +08:00
colinlyguo
ad2e94e190 support euclidV2 in proof handling 2025-03-12 22:07:44 +08:00
colinlyguo
2846ecffa5 fix a compilatin error 2025-03-12 19:51:26 +08:00
colinlyguo
0e82c63ac4 add back dbg logs 2025-03-12 19:30:02 +08:00
colinlyguo
9996af6227 Revert "revert dbg commits"
This reverts commit fe6451b76c.
2025-03-12 19:29:05 +08:00
colinlyguo
8cf087c63b update scroll-proving-sdk 2025-03-12 18:22:40 +08:00
colinlyguo
b984341991 euclid & euclidv2 compatible logic 2025-03-12 17:44:58 +08:00
colinlyguo
7486236a7a update scroll-proving-sdk 2025-03-12 17:26:45 +08:00
kunxian xia
a6ed321666 update scroll-zkvm-prover v0.1.1-rc.2 2025-03-12 17:10:16 +08:00
colinlyguo
8db4e5c77d update scroll-proving-sdk 2025-03-12 15:55:57 +08:00
colinlyguo
5cf8cda8a7 add logs 2025-03-12 15:06:21 +08:00
colinlyguo
bcc6b0f7e0 add PrevMsgQueueHash in chunk task detail 2025-03-12 14:52:27 +08:00
Rohit Narurkar
fe6451b76c revert dbg commits 2025-03-11 18:34:05 +00:00
Rohit Narurkar
be88ef6c39 dbg: more println 2025-03-11 17:54:00 +00:00
Rohit Narurkar
64368f9a79 dbg: proof types from req 2025-03-11 17:27:21 +00:00
Rohit Narurkar
f288179451 dbg: add dbg logs for prover vks 2025-03-11 17:09:34 +00:00
Rohit Narurkar
b8c7ec2b22 fix: compilation 2025-03-11 17:01:32 +00:00
colinlyguo
88da49383c update prover client 2025-03-12 00:30:16 +08:00
colin
1ea9acafa3 Merge branch 'develop' into feat/openvm-euclid-v2 2025-03-11 22:39:46 +08:00
colin
c743efd99e Merge branch 'develop' into feat/openvm-euclid-v2 2025-03-11 21:48:56 +08:00
Rohit Narurkar
2d40f0f942 fix: chunk task deserialisation from prove request input (#1620) 2025-03-11 21:45:53 +08:00
colinlyguo
fcbaa674c6 update dependencies 2025-03-11 21:45:53 +08:00
colinlyguo
110083c6c8 update rust version in CI 2025-03-11 21:45:53 +08:00
colinlyguo
b3c1df7557 revert a change 2025-03-11 21:45:53 +08:00
colinlyguo
893bf18d62 update Cargo.lock 2025-03-11 21:45:52 +08:00
colinlyguo
7ec6d478b3 feat: openvm euclid v2 2025-03-11 21:45:51 +08:00
colin
eacdc78ba7 fix(bridge-history): overwrite l2geth dependency by replace (#1617) 2025-03-11 19:18:13 +08:00
georgehao
2cc9f65852 chore: auto version bump [bot] 2025-03-11 10:45:50 +00:00
jonastheis
af381223f3 chore: auto version bump [bot] 2025-03-10 23:14:41 +00:00
Jonas Theis
bb6ee2c932 Merge branch 'develop' into feat/use-codec-v6 2025-03-11 07:14:23 +08:00
jonastheis
e99a8515b9 Merge branch 'feat/use-codec-v6' of github.com:scroll-tech/scroll into feat/use-codec-v6 2025-03-10 20:29:20 +08:00
jonastheis
38b3239c6b chore: auto version bump [bot] 2025-03-10 12:29:04 +00:00
jonastheis
d987931e30 go mod tidy 2025-03-10 20:28:59 +08:00
jonastheis
90d15637eb Merge remote-tracking branch 'origin/develop' into feat/use-codec-v6 2025-03-10 20:28:29 +08:00
jonastheis
4d677b344b address review comments 2025-03-10 18:13:02 +08:00
jonastheis
d57e6b0e7b chore: auto version bump [bot] 2025-03-10 09:59:24 +00:00
jonastheis
9b462e4c98 go mod tidy 2025-03-10 17:54:52 +08:00
jonastheis
c9f6e8c6e1 Merge remote-tracking branch 'origin/develop' into feat/use-codec-v6 2025-03-10 17:54:23 +08:00
jonastheis
867307d576 Merge remote-tracking branch 'origin/omerfirmak/euclid-prover' into feat/use-codec-v6 2025-03-10 16:47:34 +08:00
omerfirmak
20dffe4ea5 chore: auto version bump [bot] 2025-03-10 08:43:29 +00:00
Ömer Faruk Irmak
57d50b7183 Merge branch 'develop' into omerfirmak/euclid-prover 2025-03-10 11:33:11 +03:00
jonastheis
7a70e374b8 fix test 2025-03-10 15:22:14 +08:00
jonastheis
0799dd48f2 fix linter 2025-03-10 14:34:46 +08:00
jonastheis
224546e380 add new ABI and add more tests 2025-03-10 14:33:43 +08:00
jonastheis
95adcc378f fix tests 2025-03-10 14:03:02 +08:00
jonastheis
47219f2d86 run goimports 2025-03-10 12:15:04 +08:00
jonastheis
ab7038c0a7 Merge branch 'feat/use-codec-v6' of github.com:scroll-tech/scroll into feat/use-codec-v6 2025-03-10 12:13:23 +08:00
jonastheis
d79aaef35a fix CI 2025-03-10 12:12:50 +08:00
colinlyguo
da963313b6 tweak comments and some renamings 2025-03-09 22:58:29 +08:00
jonastheis
f27ddb7f8e remove debug line 2025-03-08 16:42:53 +08:00
colin
94bee1903a feat(bridge-history): support codecv7 (#1609)
Co-authored-by: jonastheis <4181434+jonastheis@users.noreply.github.com>
2025-03-08 16:35:27 +08:00
jonastheis
b7e7d1a1f1 Merge remote-tracking branch 'origin/omerfirmak/euclid-prover' into feat/use-codec-v6 2025-03-08 11:59:41 +08:00
jonastheis
f1ea4b315c process task with CodecV7, add check for BlobDataProof length and add some comments 2025-03-08 11:57:36 +08:00
colinlyguo
8b08a57f63 Revert "simplify version checks"
This reverts commit a868bc1531.
2025-03-08 01:12:48 +08:00
colinlyguo
a868bc1531 simplify version checks 2025-03-08 01:08:29 +08:00
colinlyguo
101cc46bd9 update dependencies 2025-03-07 23:58:59 +08:00
Morty
9f4c9ee150 fix: prover version (#1611) 2025-03-07 23:12:50 +08:00
Ömer Faruk Irmak
03c63a62cf update batch/chunk details for phase2 2025-03-07 16:15:20 +03:00
colin
b30f4d0b00 chore(zkvm-circuit): upgrade to 0.1.0-rc.6 (#1610) 2025-03-07 13:28:49 +08:00
colinlyguo
4333d51bef Revert "feat(bridge-history): support codecv7"
This reverts commit 82dd5e0e5e.
2025-03-07 01:53:10 +08:00
colinlyguo
82dd5e0e5e feat(bridge-history): support codecv7 2025-03-07 01:52:35 +08:00
Péter Garamvölgyi
f91c999005 fix batch proposer panic 2025-03-06 14:29:11 +01:00
colinlyguo
c8b614fd2f unit tests fix 2025-03-06 19:20:46 +08:00
jonastheis
a1c4562432 add configuration parameter maxChunksPerBatch for batch proposer 2025-03-06 18:42:36 +08:00
jonastheis
d6674e8a3d add configuration parameter maxChunksPerBatch for batch proposer 2025-03-06 18:35:01 +08:00
jonastheis
55b32e1c0c add debug log message 2025-03-06 13:37:57 +08:00
jonastheis
8ea431514d update go.work.sum 2025-03-06 13:36:32 +08:00
jonastheis
26a49cb2a3 Merge remote-tracking branch 'origin/omerfirmak/euclid-prover' into feat/use-codec-v6 2025-03-06 13:35:30 +08:00
Ömer Faruk Irmak
e27ab5a396 Merge remote-tracking branch 'origin/develop' into omerfirmak/euclid-prover 2025-03-05 10:43:19 +03:00
Ömer Faruk Irmak
554a233928 refactor: move euclid prover to new subdir 2025-03-04 14:17:53 +03:00
jonastheis
673777fe63 use go 1.22 in Dockerfile builder 2025-02-28 21:50:09 +07:00
jonastheis
7353f30ff6 update l2geth version in go.mod 2025-02-28 21:49:32 +07:00
Rohit Narurkar
eb5758b693 feat: bump to zkvm-prover rc5 2025-02-28 13:03:55 +03:00
jonastheis
47a6c23b1f fix bug where chunk and batch blocks mismatch 2025-02-28 08:25:52 +07:00
jonastheis
081d28988d update da-codec dependency 2025-02-27 15:33:54 +08:00
jonastheis
782e019f9c Merge branch 'feat/use-codec-v6' of github.com:scroll-tech/scroll into feat/use-codec-v6 2025-02-27 15:05:37 +08:00
jonastheis
89ede0d315 build rollup images with --platform=linux/amd64 2025-02-27 15:04:26 +08:00
colin
a55de1fc09 feat: set code tx support (#1600) 2025-02-27 13:49:32 +08:00
jonastheis
ed394a6369 make sure that all batches committed in the same tx are part of the same bundle 2025-02-27 10:50:09 +08:00
jonastheis
121ce09c80 update config and adjust to new contract ABI 2025-02-27 10:47:56 +08:00
jonastheis
0125dd62a6 add new contract ABI 2025-02-27 10:43:48 +08:00
Ömer Faruk Irmak
bb9d404e85 fix: force byte arrays to be marshaled as JSON arrays 2025-02-24 18:14:28 +03:00
jonastheis
e1a0bab452 add new contract ABI and adjust submission to it 2025-02-24 19:41:53 +08:00
Ömer Faruk Irmak
50ebf179fd fix: generate evm proofs for bundles 2025-02-21 21:25:25 +03:00
Ömer Faruk Irmak
01fa3b34a7 feat: use verifier-only types in coordinator 2025-02-21 16:06:27 +03:00
Ömer Faruk Irmak
2e9827a750 fix: properly propagate verifier errors 2025-02-21 12:05:58 +03:00
Ömer Faruk Irmak
867fda6952 fix: add batch tasks details for v6 codec 2025-02-20 20:06:57 +03:00
jonastheis
fbc14ac91b address review comments 2025-02-20 20:20:13 +08:00
Ömer Faruk Irmak
37924b0ae7 feat: bump zkvm-prover to rc4 2025-02-20 15:06:45 +03:00
jonastheis
8b57dd6381 fixes after merge 2025-02-20 16:27:37 +08:00
jonastheis
f13863e542 Merge remote-tracking branch 'origin/omerfirmak/euclid-prover' into feat/use-codec-v6 2025-02-20 16:25:57 +08:00
jonastheis
d3acd6b510 adjust to recent CodecV7 changes. remove initialL1MessageQueueIndex and renaming to prev and post L1MessageQueueHash 2025-02-19 20:09:56 +08:00
Ömer Faruk Irmak
83c73f8458 fix: coordinator ignore euclid transition chunk 2025-02-17 14:50:08 +03:00
Ömer Faruk Irmak
bf084368c5 fix: prover using wrong resources for batch/bundle circuits 2025-02-17 13:27:20 +03:00
Ömer Faruk Irmak
d503d4a990 fix: base64 encode VKs 2025-02-17 12:52:49 +03:00
Ömer Faruk Irmak
ac17696171 feat: update contracts to euclid version 2025-02-16 16:39:52 +03:00
Ömer Faruk Irmak
b424cef816 feat: add CPU prover dockerfile 2025-02-16 16:39:52 +03:00
Ömer Faruk Irmak
e5ad9c618d feat: allow stopping fake finalization at fork boundary 2025-02-16 16:39:52 +03:00
Ömer Faruk Irmak
848d3a6827 fix: re-enable supported forks check 2025-02-16 16:39:52 +03:00
Ömer Faruk Irmak
2bd0655fda feat: Add Euclid verifier 2025-02-16 16:39:49 +03:00
Ömer Faruk Irmak
f01af24908 fix: potentially flaky testResubmitZeroGasPriceTransaction 2025-02-11 17:48:21 +03:00
Ömer Faruk Irmak
2de45f0d54 feat(coordinator): add euclid proof types
Co-authored-by: noelwei <fan@scroll.io>
2025-02-11 17:48:21 +03:00
Ömer Faruk Irmak
c3a3bad800 feat(rollup-relayer): add Euclid support 2025-02-11 17:48:21 +03:00
Ömer Faruk Irmak
9412c7ff3a feat(coordinator): abstract proof types behind an interface 2025-02-11 17:48:21 +03:00
Ömer Faruk Irmak
5f2295043e feat(prover): euclid prover first draft 2025-02-11 17:48:15 +03:00
jonastheis
69a80d4a4a add testCommitBatchAndFinalizeBundleCodecV7 for relayer 2025-02-10 12:51:47 +08:00
jonastheis
8db5339c1f fix issues with chunks when handling CodecV7 2025-02-10 12:22:25 +08:00
jonastheis
99c0a9fac5 update to latest da-codec 2025-02-10 12:21:45 +08:00
jonastheis
f4e17bcca6 fix ci 2025-02-06 15:30:58 +08:00
jonastheis
e713424e5c update contextIDFromBatches prefix to v7 2025-02-05 17:25:07 +08:00
jonastheis
2efbbd7d77 add support for bundles with CodecV7 2025-02-05 17:05:17 +08:00
jonastheis
310abdd543 add InitialL1MessageQueueHash and LastL1MessageQueueHash to chunk and batch 2025-02-05 13:31:14 +08:00
jonastheis
5a479c3a08 address review comments 2025-02-05 11:28:49 +08:00
jonastheis
783b965deb update go.mod to latest da-codec version V7 2025-02-05 11:28:38 +08:00
jonastheis
182f8e307c update go.mod to latest da-codec version V7 2025-01-28 11:18:28 +08:00
jonastheis
b460d4a717 Merge remote-tracking branch 'origin/omerfirmak/mpt' into feat/use-codec-v6 2025-01-28 11:17:09 +08:00
Ömer Faruk Irmak
421afe9c30 deprecate halo2 provers, start openvm prover 2025-01-27 14:03:03 +03:00
Ömer Faruk Irmak
ca8d930bd6 feat(rollup-relayer): add Euclid support 2025-01-13 11:23:11 +03:00
jonastheis
940fde0cbf implement missing part of commit logic for CodecV6 2024-12-31 14:11:40 +08:00
jonastheis
78c99636dc implement batch submission of multiple batches per transaction and contextID logic to support multiple batches by concatenating batch hashes 2024-12-31 13:56:51 +08:00
jonastheis
0c0c417829 adjust Sender to support multiple blobs when sending a transaction 2024-12-31 13:55:38 +08:00
jonastheis
41606fe7d7 support first version of CodecV6 in relayer and add functionality to submit multiple batches in a single transaction 2024-12-30 18:48:18 +08:00
20 changed files with 1020 additions and 147 deletions

View File

@@ -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

View File

@@ -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",

View File

@@ -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"

View File

@@ -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)),

View 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");
}
}

View File

@@ -4,12 +4,15 @@ import (
"encoding/json"
"errors"
"fmt"
"math/big"
"github.com/scroll-tech/go-ethereum/common"
"github.com/scroll-tech/go-ethereum/common/hexutil"
)
const (
euclidFork = "euclid"
EuclidFork = "euclid"
EuclidV2Fork = "euclidV2"
)
// ProofType represents the type of task.
@@ -39,20 +42,69 @@ 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"`
}
// it is a hex encoded big with fixed length on 48 bytes
type Byte48 struct {
hexutil.Big
}
func (e Byte48) MarshalText() ([]byte, error) {
i := e.ToInt()
// overrite encode big
if sign := i.Sign(); sign < 0 {
// sanity check
return nil, errors.New("Byte48 must be positive integer")
} else {
s := i.Text(16)
if len(s) > 96 {
return nil, errors.New("integer Exceed 384bit")
}
return []byte(fmt.Sprintf("0x%0*s", 96, s)), nil
}
}
func isString(input []byte) bool {
return len(input) >= 2 && input[0] == '"' && input[len(input)-1] == '"'
}
// hexutil.Big has limition of 256bit so we have to override it ...
func (e *Byte48) UnmarshalJSON(input []byte) error {
if !isString(input) {
return errors.New("not hex string")
}
b, err := hexutil.Decode(string(input[1 : len(input)-1]))
if err != nil {
return err
}
if len(b) != 48 {
return fmt.Errorf("not a 48 bytes hex string: %d", len(b))
}
var dec big.Int
dec.SetBytes(b)
*e = Byte48{(hexutil.Big)(dec)}
return nil
}
// 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 Byte48 `json:"kzg_proof"`
KzgCommitment Byte48 `json:"kzg_commitment"`
ChallengeDigest common.Hash `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 +114,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
@@ -87,7 +152,7 @@ type ChunkProof interface {
// NewChunkProof creates a new ChunkProof instance.
func NewChunkProof(hardForkName string) ChunkProof {
switch hardForkName {
case euclidFork:
case EuclidFork, EuclidV2Fork:
return &OpenVMChunkProof{}
default:
return &Halo2ChunkProof{}
@@ -121,7 +186,7 @@ type BatchProof interface {
// NewBatchProof creates a new BatchProof instance.
func NewBatchProof(hardForkName string) BatchProof {
switch hardForkName {
case euclidFork:
case EuclidFork, EuclidV2Fork:
return &OpenVMBatchProof{}
default:
return &Halo2BatchProof{}
@@ -178,7 +243,7 @@ type BundleProof interface {
// NewBundleProof creates a new BundleProof instance.
func NewBundleProof(hardForkName string) BundleProof {
switch hardForkName {
case euclidFork:
case EuclidFork, EuclidV2Fork:
return &OpenVMBundleProof{}
default:
return &Halo2BundleProof{}
@@ -258,12 +323,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 +390,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.

View File

@@ -0,0 +1,22 @@
package message
import (
"fmt"
"testing"
)
func TestBytes48(t *testing.T) {
ti := &Byte48{}
ti.UnmarshalText([]byte("0x1"))
if s, err := ti.MarshalText(); err == nil {
if len(s) != 98 {
panic(fmt.Sprintf("wrong str: %s", s))
}
}
ti.UnmarshalText([]byte("0x0"))
if s, err := ti.MarshalText(); err == nil {
if len(s) != 98 {
panic(fmt.Sprintf("wrong str: %s", s))
}
}
}

View File

@@ -9,6 +9,7 @@ import (
"github.com/scroll-tech/go-ethereum/log"
"gorm.io/gorm"
"scroll-tech/common/types/message"
"scroll-tech/common/version"
"scroll-tech/coordinator/internal/config"
@@ -42,7 +43,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 != message.EuclidFork && cfg.ProverManager.Verifier.HighVersionCircuit.ForkName != message.EuclidV2Fork {
highHardForks = append(highHardForks, cfg.ProverManager.Verifier.LowVersionCircuit.ForkName)
}
proverVersionHardForkMap[cfg.ProverManager.Verifier.HighVersionCircuit.MinProverVersion] = highHardForks

View File

@@ -2,8 +2,10 @@ package provertask
import (
"context"
"crypto/sha256"
"encoding/json"
"fmt"
"math/big"
"time"
"github.com/gin-gonic/gin"
@@ -11,6 +13,9 @@ 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/crypto"
"github.com/scroll-tech/go-ethereum/crypto/kzg4844"
"github.com/scroll-tech/go-ethereum/log"
"github.com/scroll-tech/go-ethereum/params"
"gorm.io/gorm"
@@ -211,13 +216,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)
}
@@ -238,6 +249,9 @@ func (bp *BatchProverTask) formatProverTask(ctx context.Context, task *orm.Prove
TaskData: string(chunkProofsBytes),
HardForkName: hardForkName,
}
log.Debug("TaskData", "task_id", task.TaskID, "task_type", message.ProofTypeBatch.String(), "hard_fork_name", hardForkName, "task_data", taskMsg.TaskData)
return taskMsg, nil
}
@@ -280,8 +294,52 @@ 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 = message.Byte48{Big: hexutil.Big(*new(big.Int).SetBytes(dbBatch.BlobDataProof[112:160]))}
taskDetail.KzgCommitment = message.Byte48{Big: hexutil.Big(*new(big.Int).SetBytes(dbBatch.BlobDataProof[64:112]))}
// convert raw data to BLSFieldElements
blob, err := makeBlobCanonical(dbBatch.BlobBytes)
if err != nil {
return nil, fmt.Errorf("failed to convert blobBytes to canonical form: %w", err)
}
// compute blob versioned hash
c, err := kzg4844.BlobToCommitment(blob)
if err != nil {
return nil, fmt.Errorf("failed to create blob commitment: %w", err)
}
blobVersionedHash := kzg4844.CalcBlobHashV1(sha256.New(), &c)
taskDetail.ChallengeDigest = crypto.Keccak256Hash(crypto.Keccak256(dbBatch.BlobBytes), blobVersionedHash)
return taskDetail, nil
}
// maxBlobBytes is the maximum number of bytes that can be stored in a blob.
const maxBlobBytes = 131072
// maxEffectiveBlobBytes is the maximum number of bytes that can be stored in a blob.
// We can only utilize 31/32 of a blob.
const maxEffectiveBlobBytes = maxBlobBytes / 32 * 31
// makeBlobCanonical converts the raw blob data into the canonical blob representation of 4096 BLSFieldElements.
func makeBlobCanonical(blobBytes []byte) (*kzg4844.Blob, error) {
if len(blobBytes) > maxEffectiveBlobBytes {
return nil, fmt.Errorf("oversized batch payload, blob bytes length: %v, max length: %v", len(blobBytes), maxEffectiveBlobBytes)
}
// the canonical (padded) blob payload
var blob kzg4844.Blob
// encode blob payload by prepending every 31 bytes with 1 zero byte
index := 0
for from := 0; from < len(blobBytes); from += 31 {
to := from + 31
if to > len(blobBytes) {
to = len(blobBytes)
}
copy(blob[index+1:], blobBytes[from:to])
index += 32
}
return &blob, nil
}

View File

@@ -219,6 +219,9 @@ func (bp *BundleProverTask) formatProverTask(ctx context.Context, task *orm.Prov
TaskData: string(batchProofsBytes),
HardForkName: hardForkName,
}
log.Debug("TaskData", "task_id", task.TaskID, "task_type", message.ProofTypeBundle.String(), "hard_fork_name", hardForkName, "task_data", taskMsg.TaskData)
return taskMsg, nil
}

View File

@@ -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,45 @@ 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.Debug("TaskData", "task_id", task.TaskID, "task_type", message.ProofTypeChunk.String(), "hard_fork_name", hardForkName, "task_data", proverTaskSchema.TaskData)
return proverTaskSchema, nil
}

View File

@@ -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() {

474
zkvm-prover/Cargo.lock generated
View File

@@ -755,6 +755,15 @@ version = "1.0.96"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6b964d184e89d9b6b67dd2715bc8e74cf3107fb2b529990c90cf517326150bf4"
[[package]]
name = "approx"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6"
dependencies = [
"num-traits",
]
[[package]]
name = "ark-ff"
version = "0.3.0"
@@ -1149,6 +1158,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"
@@ -1294,6 +1309,20 @@ name = "bytemuck"
version = "1.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef657dfab802224e671f5818e9a4935f9b1957ed18e58292690cc39e7a4092a3"
dependencies = [
"bytemuck_derive",
]
[[package]]
name = "bytemuck_derive"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fa76293b4f7bb636ab88fd78228235b5248b4d05cc589aed610f954af5d7c7a"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.98",
]
[[package]]
name = "byteorder"
@@ -1489,7 +1518,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c"
dependencies = [
"lazy_static",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -1710,6 +1739,52 @@ dependencies = [
"cipher",
]
[[package]]
name = "cust"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d6cc71911e179f12483b9734120b45bd00bf64fab085cc4818428523eedd469"
dependencies = [
"bitflags 1.3.2",
"bytemuck",
"cust_core",
"cust_derive",
"cust_raw",
"find_cuda_helper",
]
[[package]]
name = "cust_core"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "039f79662cb8f890cbf335e818cd522d6e3a53fe63f61d1aaaf859cd3d975f06"
dependencies = [
"cust_derive",
"glam",
"mint",
"vek",
]
[[package]]
name = "cust_derive"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e8a3bc95fe629aed92b2423de6ccff9e40174b21d19cb6ee6281a4d04ac72f66"
dependencies = [
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "cust_raw"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbf40d6ade12cb9828bbc844b9875c7b93d25e67a3c9bf61c7aa3ae09e402bf8"
dependencies = [
"find_cuda_helper",
]
[[package]]
name = "darling"
version = "0.20.10"
@@ -1874,6 +1949,15 @@ dependencies = [
"subtle",
]
[[package]]
name = "directories"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35"
dependencies = [
"dirs-sys",
]
[[package]]
name = "dirs"
version = "5.0.1"
@@ -2069,7 +2153,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d"
dependencies = [
"libc",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -2271,6 +2355,15 @@ dependencies = [
"syn 1.0.109",
]
[[package]]
name = "find_cuda_helper"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9f9e65c593dd01ac77daad909ea4ad17f0d6d1776193fc8ea766356177abdad"
dependencies = [
"glob",
]
[[package]]
name = "fixed-hash"
version = "0.8.0"
@@ -2539,6 +2632,15 @@ dependencies = [
"syn 2.0.98",
]
[[package]]
name = "glam"
version = "0.20.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f43e957e744be03f5801a55472f593d43fabdebf25a4585db250f04d86b1675f"
dependencies = [
"num-traits",
]
[[package]]
name = "glob"
version = "0.3.2"
@@ -2879,6 +2981,15 @@ dependencies = [
"digest 0.10.7",
]
[[package]]
name = "home"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf"
dependencies = [
"windows-sys 0.59.0",
]
[[package]]
name = "http"
version = "0.2.12"
@@ -3587,6 +3698,16 @@ version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94"
[[package]]
name = "matrixmultiply"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9380b911e3e96d10c1f415da0876389aaf1b56759054eeb0de7df940c456ba1a"
dependencies = [
"autocfg",
"rawpointer",
]
[[package]]
name = "maybe-rayon"
version = "0.1.1"
@@ -3707,6 +3828,12 @@ dependencies = [
"adler2",
]
[[package]]
name = "mint"
version = "0.5.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e53debba6bda7a793e5f99b8dacf19e626084f525f7829104ba9898f367d85ff"
[[package]]
name = "mio"
version = "1.0.3"
@@ -3741,18 +3868,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",
@@ -3776,6 +3903,20 @@ dependencies = [
"tempfile",
]
[[package]]
name = "ndarray"
version = "0.15.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adb12d4e967ec485a5f71c6311fe28158e9d6f4bc4a447b474184d0f91a8fa32"
dependencies = [
"matrixmultiply",
"num-complex",
"num-integer",
"num-traits",
"rawpointer",
"rayon",
]
[[package]]
name = "nibble_vec"
version = "0.1.0"
@@ -3904,6 +4045,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"
dependencies = [
"autocfg",
"libm",
]
[[package]]
@@ -4912,7 +5054,7 @@ dependencies = [
[[package]]
name = "openvm-stark-backend"
version = "1.0.0-rc.0"
source = "git+https://github.com/openvm-org/stark-backend.git?rev=bc364134b8315c27bfd29c6e77ac79fe77090137#bc364134b8315c27bfd29c6e77ac79fe77090137"
source = "git+ssh://git@github.com/scroll-tech/openvm-stark-gpu.git?branch=main#49db21be4060fe5430d02f5b5f59b36e3af2f7d4"
dependencies = [
"async-trait",
"cfg-if",
@@ -4924,6 +5066,9 @@ dependencies = [
"p3-challenger",
"p3-commit",
"p3-field",
"p3-gpu-backend",
"p3-gpu-base",
"p3-gpu-module",
"p3-matrix",
"p3-maybe-rayon",
"p3-uni-stark",
@@ -4938,7 +5083,7 @@ dependencies = [
[[package]]
name = "openvm-stark-sdk"
version = "1.0.0-rc.0"
source = "git+https://github.com/openvm-org/stark-backend.git?rev=bc364134b8315c27bfd29c6e77ac79fe77090137#bc364134b8315c27bfd29c6e77ac79fe77090137"
source = "git+ssh://git@github.com/scroll-tech/openvm-stark-gpu.git?branch=main#49db21be4060fe5430d02f5b5f59b36e3af2f7d4"
dependencies = [
"derivative",
"derive_more 0.99.19",
@@ -4954,6 +5099,7 @@ dependencies = [
"p3-dft",
"p3-fri",
"p3-goldilocks",
"p3-gpu-backend",
"p3-keccak",
"p3-merkle-tree",
"p3-poseidon",
@@ -5023,7 +5169,7 @@ dependencies = [
[[package]]
name = "p3-air"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"p3-field",
"p3-matrix",
@@ -5032,7 +5178,7 @@ dependencies = [
[[package]]
name = "p3-baby-bear"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"p3-field",
"p3-mds",
@@ -5046,7 +5192,7 @@ dependencies = [
[[package]]
name = "p3-blake3"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"blake3",
"p3-symmetric",
@@ -5056,7 +5202,7 @@ dependencies = [
[[package]]
name = "p3-bn254-fr"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"ff 0.13.0",
"halo2curves",
@@ -5071,7 +5217,7 @@ dependencies = [
[[package]]
name = "p3-challenger"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"p3-field",
"p3-maybe-rayon",
@@ -5083,12 +5229,14 @@ dependencies = [
[[package]]
name = "p3-commit"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"anyhow",
"itertools 0.13.0",
"p3-challenger",
"p3-dft",
"p3-field",
"p3-gpu-base",
"p3-matrix",
"p3-util",
"serde",
@@ -5097,7 +5245,7 @@ dependencies = [
[[package]]
name = "p3-dft"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"itertools 0.13.0",
"p3-field",
@@ -5110,7 +5258,7 @@ dependencies = [
[[package]]
name = "p3-field"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"itertools 0.13.0",
"num-bigint 0.4.6",
@@ -5127,26 +5275,31 @@ dependencies = [
[[package]]
name = "p3-fri"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"anyhow",
"itertools 0.13.0",
"p3-challenger",
"p3-commit",
"p3-dft",
"p3-field",
"p3-gpu-backend",
"p3-gpu-base",
"p3-interpolation",
"p3-matrix",
"p3-maybe-rayon",
"p3-merkle-tree",
"p3-util",
"rand",
"serde",
"tracing",
"zkhash",
]
[[package]]
name = "p3-goldilocks"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"num-bigint 0.4.6",
"p3-dft",
@@ -5160,10 +5313,95 @@ dependencies = [
"serde",
]
[[package]]
name = "p3-gpu-backend"
version = "0.1.0"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"anyhow",
"bytemuck",
"cc",
"cust",
"cust_raw",
"ff 0.13.0",
"itertools 0.13.0",
"lazy_static",
"ndarray",
"once_cell",
"p3-baby-bear",
"p3-commit",
"p3-dft",
"p3-field",
"p3-gpu-base",
"p3-gpu-build",
"p3-interpolation",
"p3-matrix",
"p3-maybe-rayon",
"p3-poseidon2",
"p3-util",
"parking_lot 0.12.3",
"paste",
"rand",
"rand_core",
"rayon",
"serde",
"sppark",
"tracing",
"transpose",
]
[[package]]
name = "p3-gpu-base"
version = "0.1.0"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"anyhow",
"bytemuck",
"cust",
"cust_raw",
"hex",
"lazy_static",
"p3-field",
"p3-matrix",
"parking_lot 0.12.3",
"tracing",
]
[[package]]
name = "p3-gpu-build"
version = "0.1.0"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"cc",
"directories",
"hex",
"p3-gpu-field",
"sha2",
"tempfile",
]
[[package]]
name = "p3-gpu-field"
version = "0.1.0"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
[[package]]
name = "p3-gpu-module"
version = "0.1.0"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"itertools 0.13.0",
"p3-field",
"p3-gpu-base",
"p3-matrix",
"p3-util",
"tracing",
]
[[package]]
name = "p3-interpolation"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"p3-field",
"p3-matrix",
@@ -5174,7 +5412,7 @@ dependencies = [
[[package]]
name = "p3-keccak"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"itertools 0.13.0",
"p3-field",
@@ -5186,21 +5424,23 @@ dependencies = [
[[package]]
name = "p3-keccak-air"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"p3-air",
"p3-field",
"p3-gpu-backend",
"p3-matrix",
"p3-maybe-rayon",
"p3-util",
"rand",
"tracing",
"zkhash",
]
[[package]]
name = "p3-matrix"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"itertools 0.13.0",
"p3-field",
@@ -5215,7 +5455,7 @@ dependencies = [
[[package]]
name = "p3-maybe-rayon"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"rayon",
]
@@ -5223,7 +5463,7 @@ dependencies = [
[[package]]
name = "p3-mds"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"itertools 0.13.0",
"p3-dft",
@@ -5237,11 +5477,13 @@ dependencies = [
[[package]]
name = "p3-merkle-tree"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"anyhow",
"itertools 0.13.0",
"p3-commit",
"p3-field",
"p3-gpu-base",
"p3-matrix",
"p3-maybe-rayon",
"p3-symmetric",
@@ -5254,7 +5496,7 @@ dependencies = [
[[package]]
name = "p3-monty-31"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"itertools 0.13.0",
"num-bigint 0.4.6",
@@ -5275,7 +5517,7 @@ dependencies = [
[[package]]
name = "p3-poseidon"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"p3-field",
"p3-mds",
@@ -5286,7 +5528,7 @@ dependencies = [
[[package]]
name = "p3-poseidon2"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"gcd",
"p3-field",
@@ -5298,7 +5540,7 @@ dependencies = [
[[package]]
name = "p3-poseidon2-air"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"p3-air",
"p3-field",
@@ -5314,7 +5556,7 @@ dependencies = [
[[package]]
name = "p3-symmetric"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"itertools 0.13.0",
"p3-field",
@@ -5324,7 +5566,7 @@ dependencies = [
[[package]]
name = "p3-uni-stark"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"itertools 0.13.0",
"p3-air",
@@ -5342,7 +5584,7 @@ dependencies = [
[[package]]
name = "p3-util"
version = "0.1.0"
source = "git+https://github.com/Plonky3/Plonky3.git?rev=b0591e9#b0591e9b82d58d10f86359875b5d5fa96433b4cf"
source = "git+ssh://git@github.com/scroll-tech/plonky3-gpu.git?branch=openvm-v2#342685a5353519a56d26abea43ac40415f4189b3"
dependencies = [
"serde",
]
@@ -5726,7 +5968,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",
@@ -5835,7 +6078,7 @@ dependencies = [
"once_cell",
"socket2",
"tracing",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -5921,6 +6164,12 @@ dependencies = [
"bitflags 2.8.0",
]
[[package]]
name = "rawpointer"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3"
[[package]]
name = "rayon"
version = "1.10.0"
@@ -6823,7 +7072,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#6fe1fae6d92f0f6a3ed234a955aca4bdcf864f97"
dependencies = [
"auto_impl",
"cfg-if",
@@ -6862,7 +7111,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#6fe1fae6d92f0f6a3ed234a955aca4bdcf864f97"
dependencies = [
"revm-primitives 15.1.0",
"serde",
@@ -6900,7 +7149,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#6fe1fae6d92f0f6a3ed234a955aca4bdcf864f97"
dependencies = [
"aurora-engine-modexp",
"c-kzg",
@@ -6957,7 +7206,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#6fe1fae6d92f0f6a3ed234a955aca4bdcf864f97"
dependencies = [
"alloy-eip2930",
"alloy-eip7702 0.5.1",
@@ -7213,7 +7462,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -7530,7 +7779,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=e27915b#e27915b4f978697f589a022029ecbc1665a9709c"
dependencies = [
"alloy",
"anyhow",
@@ -7575,6 +7824,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#0f251ba4541e2d136b953f10dae163686c0e815d"
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 +7862,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#0f251ba4541e2d136b953f10dae163686c0e815d"
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 +7921,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#0f251ba4541e2d136b953f10dae163686c0e815d"
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",
]
@@ -8084,6 +8403,15 @@ dependencies = [
"der",
]
[[package]]
name = "sppark"
version = "0.1.8"
source = "git+https://github.com/scroll-tech/sppark.git?branch=sp1-v3.0#07fe0de43a745a395dd718c735cdfe0cfc457b0a"
dependencies = [
"cc",
"which",
]
[[package]]
name = "stability"
version = "0.2.1"
@@ -8110,7 +8438,7 @@ dependencies = [
"cfg-if",
"libc",
"psm",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -8140,6 +8468,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 +8505,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"
@@ -8348,7 +8695,7 @@ dependencies = [
"getrandom 0.3.1",
"once_cell",
"rustix",
"windows-sys 0.59.0",
"windows-sys 0.52.0",
]
[[package]]
@@ -9019,12 +9366,37 @@ version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vek"
version = "0.15.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8085882662f9bc47fc8b0cdafa5e19df8f592f650c02b9083da8d45ac9eebd17"
dependencies = [
"approx",
"num-integer",
"num-traits",
"rustc_version 0.4.1",
]
[[package]]
name = "version_check"
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"
@@ -9212,6 +9584,18 @@ dependencies = [
"rustls-pki-types",
]
[[package]]
name = "which"
version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
dependencies = [
"either",
"home",
"once_cell",
"rustix",
]
[[package]]
name = "winapi"
version = "0.3.9"

View File

@@ -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 = "e27915b", features = [
"openvm",
] }
sbv-primitives = { git = "https://github.com/scroll-tech/stateless-block-verifier", branch = "zkvm/euclid-v2", features = [
@@ -45,3 +46,34 @@ clap = { version = "4.5", features = ["derive"] }
ctor = "0.2.8"
url = "2.5.4"
serde_bytes = "0.11.15"
[patch."https://github.com/openvm-org/stark-backend.git"]
openvm-stark-backend = { git = "ssh://git@github.com/scroll-tech/openvm-stark-gpu.git", branch = "main", features = ["gpu"] }
openvm-stark-sdk = { git = "ssh://git@github.com/scroll-tech/openvm-stark-gpu.git", branch = "main", features = ["gpu"] }
[patch."https://github.com/Plonky3/Plonky3.git"]
p3-air = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-field = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-commit = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-matrix = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-baby-bear = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", features = [
"nightly-features",
], branch = "openvm-v2" }
p3-util = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-challenger = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-dft = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-fri = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-goldilocks = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-keccak = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-keccak-air = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-blake3 = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-mds = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-merkle-tree = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-monty-31 = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-poseidon = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-poseidon2 = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-poseidon2-air = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-symmetric = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-uni-stark = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }
p3-maybe-rayon = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" } # the "parallel" feature is NOT on by default to allow single-threaded benchmarking
p3-bn254-fr = { git = "ssh://git@github.com/scroll-tech/plonky3-gpu.git", branch = "openvm-v2" }

View File

@@ -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"
}
}

View File

@@ -10,7 +10,7 @@ use scroll_proving_sdk::{
};
#[derive(Parser, Debug)]
#[clap(disable_version_flag = true)]
#[command(disable_version_flag = true)]
struct Args {
/// Path of config file
#[arg(long = "config", default_value = "conf/config.json")]

View File

@@ -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::{
@@ -181,9 +183,14 @@ impl LocalProver {
// coordinator
let config = self.config.circuits.get(hard_fork_name).unwrap();
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>
}
}
}

View File

@@ -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};

View File

@@ -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,
};

View File

@@ -0,0 +1,107 @@
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, ProverConfig,
};
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);
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()),
ProverConfig {
segment_len: Some((1 << 22) - 100),
},
)
.expect("Failed to setup chunk prover");
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()),
ProverConfig {
segment_len: Some((1 << 22) - 100),
},
)
.expect("Failed to setup batch prover");
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),
ProverConfig {
segment_len: Some((1 << 22) - 100),
},
)
.expect("Failed to setup bundle prover");
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")),
}
}
}