diff --git a/Cargo.lock b/Cargo.lock index 887b71c39ec9..d3d75146aeee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1313,14 +1313,14 @@ dependencies = [ [[package]] name = "circuit_encodings" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67617688c66640c84f9b98ff26d48f7898dca4faeb45241a4f21ec333788e7b" +checksum = "f5128d4b8fbb27ac453f573a95601058e74487bdafd22a3168cded66bf340c28" dependencies = [ "derivative", "serde", - "zk_evm 0.150.5", - "zkevm_circuits 0.150.5", + "zk_evm 0.150.6", + "zkevm_circuits 0.150.6", ] [[package]] @@ -1380,11 +1380,11 @@ dependencies = [ [[package]] name = "circuit_sequencer_api" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21017310971d4a051e4a52ad70eed11d1ae69defeca8314f73a3a4bad16705a9" +checksum = "093d0c2c0b39144ddb4e1e88d73d95067ce34ec7750808b2eed01edbb510b88e" dependencies = [ - "circuit_encodings 0.150.5", + "circuit_encodings 0.150.6", "derivative", "rayon", "serde", @@ -9342,9 +9342,9 @@ dependencies = [ [[package]] name = "zk_evm" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6e69931f24db5cf333b714721e8d80ff88bfdb7da8c3dc7882612ffddb8d27" +checksum = "c14bda6c101389145cd01fac900f1392876bc0284d98faf7f376237baa2cb19d" dependencies = [ "anyhow", "lazy_static", @@ -9352,7 +9352,7 @@ dependencies = [ "serde", "serde_json", "static_assertions", - "zk_evm_abstractions 0.150.5", + "zk_evm_abstractions 0.150.6", ] [[package]] @@ -9383,15 +9383,15 @@ dependencies = [ [[package]] name = "zk_evm_abstractions" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6b0720261ab55490fe3a96e96de30d5d7b277940b52ea7f52dbf564eb1748" +checksum = "a008f2442fc6a508bdd1f902380242cb6ff11b8b27acdac2677c6d9f75cbb004" dependencies = [ "anyhow", "num_enum 0.6.1", "serde", "static_assertions", - "zkevm_opcode_defs 0.150.5", + "zkevm_opcode_defs 0.150.6", ] [[package]] @@ -9440,9 +9440,9 @@ dependencies = [ [[package]] name = "zkevm_circuits" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784fa7cfb51e17c5ced112bca43da30b3468b2347b7af0427ad9638759fb140e" +checksum = "1f68518aedd5358b17224771bb78bacd912cf66011aeda98b1f887cfb9e0972f" dependencies = [ "arrayvec 0.7.6", "boojum", @@ -9454,7 +9454,7 @@ dependencies = [ "seq-macro", "serde", "smallvec", - "zkevm_opcode_defs 0.150.5", + "zkevm_opcode_defs 0.150.6", "zksync_cs_derive", ] @@ -9502,9 +9502,9 @@ dependencies = [ [[package]] name = "zkevm_opcode_defs" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79055eae1b6c1ab80793ed9d77d2964c9c896afa4b5dfed278cf58cd10acfe8f" +checksum = "762b5f1c1b283c5388995a85d40a05aef1c14f50eb904998b7e9364739f5b899" dependencies = [ "bitflags 2.6.0", "blake2 0.10.6", @@ -9628,7 +9628,7 @@ dependencies = [ "anyhow", "circuit_sequencer_api 0.140.3", "circuit_sequencer_api 0.141.2", - "circuit_sequencer_api 0.150.5", + "circuit_sequencer_api 0.150.6", "futures 0.3.30", "itertools 0.10.5", "num_cpus", @@ -9640,7 +9640,7 @@ dependencies = [ "vise", "zk_evm 0.133.0", "zk_evm 0.141.0", - "zk_evm 0.150.5", + "zk_evm 0.150.6", "zksync_contracts", "zksync_dal", "zksync_eth_client", @@ -10355,9 +10355,9 @@ dependencies = [ [[package]] name = "zksync_kzg" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb8a9c76c172a6d639855ee342b9a670e3ba472f5ae302f771b1c3ee777dc88" +checksum = "6c006b6b7a27cc50ff0c515b6d0b197dbb907bbf65d1d2ea42fc3ed21b315642" dependencies = [ "boojum", "derivative", @@ -10367,7 +10367,7 @@ dependencies = [ "serde", "serde_json", "serde_with", - "zkevm_circuits 0.150.5", + "zkevm_circuits 0.150.6", ] [[package]] @@ -10494,7 +10494,7 @@ dependencies = [ "circuit_sequencer_api 0.140.3", "circuit_sequencer_api 0.141.2", "circuit_sequencer_api 0.142.2", - "circuit_sequencer_api 0.150.5", + "circuit_sequencer_api 0.150.6", "ethabi", "hex", "itertools 0.10.5", @@ -10508,7 +10508,7 @@ dependencies = [ "zk_evm 0.133.0", "zk_evm 0.140.0", "zk_evm 0.141.0", - "zk_evm 0.150.5", + "zk_evm 0.150.6", "zksync_contracts", "zksync_eth_signer", "zksync_system_constants", @@ -10549,7 +10549,7 @@ dependencies = [ "tower-http", "tracing", "vise", - "zk_evm 0.150.5", + "zk_evm 0.150.6", "zksync_config", "zksync_consensus_roles", "zksync_contracts", @@ -10945,7 +10945,7 @@ version = "0.1.0" dependencies = [ "bincode", "chrono", - "circuit_sequencer_api 0.150.5", + "circuit_sequencer_api 0.150.6", "serde", "serde_json", "serde_with", @@ -11309,8 +11309,8 @@ source = "git+https://github.com/matter-labs/vm2.git?rev=a233d44bbe61dc6a758a754 dependencies = [ "enum_dispatch", "primitive-types", - "zk_evm_abstractions 0.150.5", - "zkevm_opcode_defs 0.150.5", + "zk_evm_abstractions 0.150.6", + "zkevm_opcode_defs 0.150.6", "zksync_vm2_interface", ] diff --git a/Cargo.toml b/Cargo.toml index 940d5dd036b7..4090f28cd0e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -218,15 +218,15 @@ circuit_sequencer_api_1_3_3 = { package = "circuit_sequencer_api", version = "0. circuit_sequencer_api_1_4_0 = { package = "circuit_sequencer_api", version = "0.140" } circuit_sequencer_api_1_4_1 = { package = "circuit_sequencer_api", version = "0.141" } circuit_sequencer_api_1_4_2 = { package = "circuit_sequencer_api", version = "0.142" } -circuit_sequencer_api_1_5_0 = { package = "circuit_sequencer_api", version = "=0.150.5" } +circuit_sequencer_api_1_5_0 = { package = "circuit_sequencer_api", version = "=0.150.6" } crypto_codegen = { package = "zksync_solidity_vk_codegen", version = "=0.30.1" } -kzg = { package = "zksync_kzg", version = "=0.150.5" } +kzg = { package = "zksync_kzg", version = "=0.150.6" } zk_evm = { version = "=0.133.0" } zk_evm_1_3_1 = { package = "zk_evm", version = "0.131.0-rc.2" } zk_evm_1_3_3 = { package = "zk_evm", version = "0.133" } zk_evm_1_4_0 = { package = "zk_evm", version = "0.140" } zk_evm_1_4_1 = { package = "zk_evm", version = "0.141" } -zk_evm_1_5_0 = { package = "zk_evm", version = "=0.150.5" } +zk_evm_1_5_0 = { package = "zk_evm", version = "=0.150.6" } # New VM; pinned to a specific commit because of instability zksync_vm2 = { git = "https://github.com/matter-labs/vm2.git", rev = "a233d44bbe61dc6a758a754c3b78fe4f83e56699" } diff --git a/prover/Cargo.lock b/prover/Cargo.lock index 1d584a473d96..206cef01ba16 100644 --- a/prover/Cargo.lock +++ b/prover/Cargo.lock @@ -304,7 +304,7 @@ version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f0e249228c6ad2d240c2dc94b714d711629d52bad946075d8e9b2f5391f0703" dependencies = [ - "bindgen 0.69.4", + "bindgen", "cc", "cmake", "dunce", @@ -461,29 +461,6 @@ dependencies = [ "serde", ] -[[package]] -name = "bindgen" -version = "0.59.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bd2a9a458e8f4304c52c43ebb0cfbd520289f8379a52e329a38afda99bf8eb8" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "clap 2.34.0", - "env_logger 0.9.3", - "lazy_static", - "lazycell", - "log", - "peeking_take_while", - "proc-macro2 1.0.85", - "quote 1.0.36", - "regex", - "rustc-hash", - "shlex", - "which", -] - [[package]] name = "bindgen" version = "0.69.4" @@ -674,9 +651,9 @@ dependencies = [ [[package]] name = "boojum-cuda" -version = "0.150.9" +version = "0.151.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f9a6d958dd58a0899737e5a1fc6597aefcf7980bf8be5be5329e701cbd45ca" +checksum = "98c681a3f867afe40bcc188e5cb5260bbf5699531823affa3cbe28f7ca9b7bc9" dependencies = [ "boojum", "cmake", @@ -822,11 +799,11 @@ dependencies = [ [[package]] name = "circuit_definitions" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b532214f063e5e0ee5c0fc1d3afd56dec541efa68b8985f14cc55cc324f4c48" +checksum = "492404ea63c934d8e894325f0a741723bf91cd035cb34a92fddd8617c4a00fd3" dependencies = [ - "circuit_encodings 0.150.5", + "circuit_encodings 0.150.6", "crossbeam", "derivative", "seq-macro", @@ -872,14 +849,14 @@ dependencies = [ [[package]] name = "circuit_encodings" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e67617688c66640c84f9b98ff26d48f7898dca4faeb45241a4f21ec333788e7b" +checksum = "f5128d4b8fbb27ac453f573a95601058e74487bdafd22a3168cded66bf340c28" dependencies = [ "derivative", "serde", - "zk_evm 0.150.5", - "zkevm_circuits 0.150.5", + "zk_evm 0.150.6", + "zkevm_circuits 0.150.6", ] [[package]] @@ -939,11 +916,11 @@ dependencies = [ [[package]] name = "circuit_sequencer_api" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21017310971d4a051e4a52ad70eed11d1ae69defeca8314f73a3a4bad16705a9" +checksum = "093d0c2c0b39144ddb4e1e88d73d95067ce34ec7750808b2eed01edbb510b88e" dependencies = [ - "circuit_encodings 0.150.5", + "circuit_encodings 0.150.6", "derivative", "rayon", "serde", @@ -1764,9 +1741,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "era_cudart" -version = "0.150.9" +version = "0.151.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f0d6e329b2c11d134c3140951209be968ef316ed64ddde75640eaed7f10264" +checksum = "c1e1990fee6e9d25b40524ce53ca7977a211155a17bc7277f4dd354633e4fc22" dependencies = [ "bitflags 2.6.0", "era_cudart_sys", @@ -1775,9 +1752,9 @@ dependencies = [ [[package]] name = "era_cudart_sys" -version = "0.150.9" +version = "0.151.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "060e8186234c7a281021fb95614e06e94e1fc7ab78938360a5c27af0f8fc6105" +checksum = "d84e8d300c28cd91ceb56340f66da8607409f44a45f5e694e23723630db8c852" dependencies = [ "serde_json", ] @@ -4103,12 +4080,6 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - [[package]] name = "pem" version = "3.0.4" @@ -5711,9 +5682,9 @@ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" [[package]] name = "shivini" -version = "0.150.9" +version = "0.151.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebb6d928451f0779f14da02ee9d51d4bde560328edc6471f0d5c5c11954345c4" +checksum = "92776ca824f49c255a7417939706d759e0fd3dd4217420d01da68beae04f0bd6" dependencies = [ "bincode", "blake2 0.10.6", @@ -7479,9 +7450,9 @@ dependencies = [ [[package]] name = "zk_evm" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6e69931f24db5cf333b714721e8d80ff88bfdb7da8c3dc7882612ffddb8d27" +checksum = "c14bda6c101389145cd01fac900f1392876bc0284d98faf7f376237baa2cb19d" dependencies = [ "anyhow", "lazy_static", @@ -7489,7 +7460,7 @@ dependencies = [ "serde", "serde_json", "static_assertions", - "zk_evm_abstractions 0.150.5", + "zk_evm_abstractions 0.150.6", ] [[package]] @@ -7520,22 +7491,22 @@ dependencies = [ [[package]] name = "zk_evm_abstractions" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6b0720261ab55490fe3a96e96de30d5d7b277940b52ea7f52dbf564eb1748" +checksum = "a008f2442fc6a508bdd1f902380242cb6ff11b8b27acdac2677c6d9f75cbb004" dependencies = [ "anyhow", "num_enum 0.6.1", "serde", "static_assertions", - "zkevm_opcode_defs 0.150.5", + "zkevm_opcode_defs 0.150.6", ] [[package]] name = "zkevm-assembly" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e99106038062537c05b4e6e7754d1bbba28ba16185a3e5ee5ad22e2f8be883bb" +checksum = "5dc743ac7b0d618536dc3ace798fd4b8af78b057884afda5785c7970e15d62d0" dependencies = [ "env_logger 0.9.3", "hex", @@ -7548,7 +7519,7 @@ dependencies = [ "smallvec", "structopt", "thiserror", - "zkevm_opcode_defs 0.150.5", + "zkevm_opcode_defs 0.150.6", ] [[package]] @@ -7597,9 +7568,9 @@ dependencies = [ [[package]] name = "zkevm_circuits" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784fa7cfb51e17c5ced112bca43da30b3468b2347b7af0427ad9638759fb140e" +checksum = "1f68518aedd5358b17224771bb78bacd912cf66011aeda98b1f887cfb9e0972f" dependencies = [ "arrayvec 0.7.4", "boojum", @@ -7611,7 +7582,7 @@ dependencies = [ "seq-macro", "serde", "smallvec", - "zkevm_opcode_defs 0.150.5", + "zkevm_opcode_defs 0.150.6", "zksync_cs_derive", ] @@ -7659,9 +7630,9 @@ dependencies = [ [[package]] name = "zkevm_opcode_defs" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79055eae1b6c1ab80793ed9d77d2964c9c896afa4b5dfed278cf58cd10acfe8f" +checksum = "762b5f1c1b283c5388995a85d40a05aef1c14f50eb904998b7e9364739f5b899" dependencies = [ "bitflags 2.6.0", "blake2 0.10.6", @@ -7676,13 +7647,13 @@ dependencies = [ [[package]] name = "zkevm_test_harness" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "550f82d3b7448c35168dc13bfadbccd5fd306097b6e1ea01793151c1c9137a36" +checksum = "73ad3e73d290a38a35dd245fd68cb6f498a8a8da4a52f846e88da3d3c31a34fd" dependencies = [ "bincode", "circuit_definitions", - "circuit_sequencer_api 0.150.5", + "circuit_sequencer_api 0.150.6", "codegen", "crossbeam", "derivative", @@ -7703,11 +7674,10 @@ dependencies = [ [[package]] name = "zksync-gpu-ffi" -version = "0.150.9" +version = "0.151.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86511b3957adfe415ecdbd1ee01c51aa3ca131a607e61ca024976312f613b0f9" +checksum = "d555e24b853359c5b076c52f9ff9e0ed62a7edc8c2f82f93517c524410c21ecb" dependencies = [ - "bindgen 0.59.2", "cmake", "crossbeam", "derivative", @@ -7719,9 +7689,9 @@ dependencies = [ [[package]] name = "zksync-gpu-prover" -version = "0.150.9" +version = "0.151.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e4c00f2db603d1b696bc2e9d822bb4c087050de5b65559067fc2232786cbc93" +checksum = "615dad34e5fe678ec3b3e029af3f19313bebb1b771a8ce963c9ab9a8cc3879d3" dependencies = [ "bit-vec", "cfg-if", @@ -7736,9 +7706,9 @@ dependencies = [ [[package]] name = "zksync-wrapper-prover" -version = "0.150.9" +version = "0.151.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58df1ec10e0d5eb58563bb01abda5ed185c9b9621502e361848ca40eb7868ac" +checksum = "80721b2da2643bd43f664ac65673ee078e6973c0a88d75b73bfaeac8e1bf5432" dependencies = [ "circuit_definitions", "zkevm_test_harness", @@ -8106,9 +8076,9 @@ dependencies = [ [[package]] name = "zksync_kzg" -version = "0.150.5" +version = "0.150.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edb8a9c76c172a6d639855ee342b9a670e3ba472f5ae302f771b1c3ee777dc88" +checksum = "6c006b6b7a27cc50ff0c515b6d0b197dbb907bbf65d1d2ea42fc3ed21b315642" dependencies = [ "boojum", "derivative", @@ -8118,7 +8088,7 @@ dependencies = [ "serde", "serde_json", "serde_with", - "zkevm_circuits 0.150.5", + "zkevm_circuits 0.150.6", ] [[package]] @@ -8154,7 +8124,7 @@ dependencies = [ "circuit_sequencer_api 0.140.3", "circuit_sequencer_api 0.141.2", "circuit_sequencer_api 0.142.2", - "circuit_sequencer_api 0.150.5", + "circuit_sequencer_api 0.150.6", "ethabi", "hex", "itertools 0.10.5", @@ -8166,7 +8136,7 @@ dependencies = [ "zk_evm 0.133.0", "zk_evm 0.140.0", "zk_evm 0.141.0", - "zk_evm 0.150.5", + "zk_evm 0.150.6", "zksync_contracts", "zksync_system_constants", "zksync_types", @@ -8218,7 +8188,7 @@ dependencies = [ "anyhow", "async-trait", "bincode", - "circuit_sequencer_api 0.150.5", + "circuit_sequencer_api 0.150.6", "clap 4.5.4", "ctrlc", "futures 0.3.30", @@ -8444,7 +8414,7 @@ name = "zksync_prover_interface" version = "0.1.0" dependencies = [ "chrono", - "circuit_sequencer_api 0.150.5", + "circuit_sequencer_api 0.150.6", "serde", "serde_with", "strum", @@ -8643,8 +8613,8 @@ source = "git+https://github.com/matter-labs/vm2.git?rev=a233d44bbe61dc6a758a754 dependencies = [ "enum_dispatch", "primitive-types", - "zk_evm_abstractions 0.150.5", - "zkevm_opcode_defs 0.150.5", + "zk_evm_abstractions 0.150.6", + "zkevm_opcode_defs 0.150.6", "zksync_vm2_interface", ] diff --git a/prover/Cargo.toml b/prover/Cargo.toml index 742eee649de1..61169dd43636 100644 --- a/prover/Cargo.toml +++ b/prover/Cargo.toml @@ -62,13 +62,13 @@ url = "2.5.2" vise = "0.2.0" # Proving dependencies -circuit_definitions = "=0.150.5" -circuit_sequencer_api = "=0.150.5" -zkevm_test_harness = "=0.150.5" +circuit_definitions = "=0.150.6" +circuit_sequencer_api = "=0.150.6" +zkevm_test_harness = "=0.150.6" # GPU proving dependencies -wrapper_prover = { package = "zksync-wrapper-prover", version = "=0.150.9" } -shivini = "=0.150.9" +wrapper_prover = { package = "zksync-wrapper-prover", version = "=0.151.0" } +shivini = "=0.151.0" # Core workspace dependencies zksync_multivm = { path = "../core/lib/multivm", version = "0.1.0" } diff --git a/prover/crates/bin/witness_generator/src/rounds/basic_circuits/utils.rs b/prover/crates/bin/witness_generator/src/rounds/basic_circuits/utils.rs index a8bc59bd45e5..31dc54814103 100644 --- a/prover/crates/bin/witness_generator/src/rounds/basic_circuits/utils.rs +++ b/prover/crates/bin/witness_generator/src/rounds/basic_circuits/utils.rs @@ -5,7 +5,7 @@ use std::{ }; use circuit_definitions::{ - circuit_definitions::base_layer::{ZkSyncBaseLayerCircuit, ZkSyncBaseLayerStorage}, + circuit_definitions::base_layer::ZkSyncBaseLayerStorage, encodings::recursion_request::RecursionQueueSimulator, zkevm_circuits::fsm_input_output::ClosedFormInputCompactFormWitness, }; @@ -21,7 +21,7 @@ use zksync_multivm::{ zk_evm_latest::ethereum_types::Address, }; use zksync_object_store::ObjectStore; -use zksync_prover_fri_types::{keys::ClosedFormInputKey, CircuitAuxData}; +use zksync_prover_fri_types::keys::ClosedFormInputKey; use zksync_prover_interface::inputs::WitnessInputData; use zksync_system_constants::BOOTLOADER_ADDRESS; use zksync_types::L1BatchNumber; @@ -31,8 +31,7 @@ use crate::{ rounds::basic_circuits::Witness, storage_oracle::StorageOracle, utils::{ - expand_bootloader_contents, save_circuit, save_ram_premutation_queue_witness, - ClosedFormInputWrapper, KZG_TRUSTED_SETUP_FILE, + expand_bootloader_contents, save_circuit, ClosedFormInputWrapper, KZG_TRUSTED_SETUP_FILE, }, witness::WitnessStorage, }; @@ -64,17 +63,38 @@ pub(super) async fn generate_witness( let (circuit_sender, mut circuit_receiver) = tokio::sync::mpsc::channel(1); let (queue_sender, mut queue_receiver) = tokio::sync::mpsc::channel(1); - let (ram_permutation_queue_sender, mut ram_permutation_queue_receiver) = - tokio::sync::mpsc::channel(1); let make_circuits_span = tracing::info_span!("make_circuits"); let make_circuits_span_copy = make_circuits_span.clone(); + + use std::{sync::mpsc::sync_channel, thread}; + let (artifacts_sender, artifacts_receiver) = sync_channel(1); + + let artifacts_receiver_handle = thread::spawn(move || { + let span = tracing::info_span!(parent: make_circuits_span_copy, "make_circuits_blocking"); + + while let Ok(artifact) = artifacts_receiver.recv() { + match artifact { + WitnessGenerationArtifact::BaseLayerCircuit(circuit) => { + let parent_span = span.clone(); + tracing::info_span!(parent: parent_span, "send_circuit").in_scope(|| { + circuit_sender + .blocking_send(circuit) + .expect("failed to send circuit from harness"); + }); + } + WitnessGenerationArtifact::RecursionQueue((a, b, c)) => queue_sender + .blocking_send((a as u8, b, c)) + .expect("failed to send recursion queue from harness"), + _ => {} + } + } + }); + // Blocking call from harness that does the CPU heavy lifting. // Provides circuits and recursion queue via callback functions and returns scheduler witnesses. // Circuits are "streamed" one by one as they're being generated. let make_circuits_handle = tokio::task::spawn_blocking(move || { - let span = tracing::info_span!(parent: make_circuits_span_copy, "make_circuits_blocking"); - let witness_storage = WitnessStorage::new(input.vm_run_data.witness_block_state); let storage_view = StorageView::new(witness_storage).to_rc_ptr(); @@ -91,33 +111,11 @@ pub(super) async fn generate_witness( .to_str() .expect("Path to KZG trusted setup is not a UTF-8 string"); - let artifacts_callback = |artifact: WitnessGenerationArtifact| match artifact { - WitnessGenerationArtifact::BaseLayerCircuit(circuit) => { - let parent_span = span.clone(); - tracing::info_span!(parent: parent_span, "send_circuit").in_scope(|| { - circuit_sender - .blocking_send(circuit) - .expect("failed to send circuit from harness"); - }); - } - WitnessGenerationArtifact::RecursionQueue((a, b, c)) => queue_sender - .blocking_send((a as u8, b, c)) - .expect("failed to send recursion queue from harness"), - a @ WitnessGenerationArtifact::MemoryQueueWitness(_) => { - let parent_span = span.clone(); - tracing::info_span!(parent: parent_span, "send_ram_permutation_queue_witness") - .in_scope(|| { - ram_permutation_queue_sender - .blocking_send(a) - .expect("failed to send ram permutation queue sitness from harness"); - }); - } - }; - let evm_emulator_code_hash = input.vm_run_data.evm_emulator_code_hash; // By convention, default AA is used instead of the EVM emulator if the latter is disabled. let evm_emulator_code_hash = evm_emulator_code_hash.unwrap_or(input.vm_run_data.default_account_code_hash); + let (scheduler_witness, block_witness) = zkevm_test_harness::external_calls::run( Address::zero(), BOOTLOADER_ADDRESS, @@ -132,9 +130,9 @@ pub(super) async fn generate_witness( geometry_config, storage_oracle, tree, - path, + path.to_owned(), input.eip_4844_blobs.blobs(), - artifacts_callback, + artifacts_sender, ); (scheduler_witness, block_witness) }) @@ -153,8 +151,6 @@ pub(super) async fn generate_witness( // If the order is tampered with, proving will fail (as the proof would be computed for a different sequence of instruction). let mut circuit_sequence = 0; - let mut ram_circuit_sequence = 0; - while let Some(circuit) = circuit_receiver .recv() .instrument(tracing::info_span!("wait_for_circuit")) @@ -169,26 +165,9 @@ pub(super) async fn generate_witness( .await .expect("failed to get permit for running save circuit task"); - let partial_circuit_aux_data = match &circuit { - ZkSyncBaseLayerCircuit::RAMPermutation(_) => { - let circuit_subsequence_number = ram_circuit_sequence; - ram_circuit_sequence += 1; - Some(CircuitAuxData { - circuit_subsequence_number, - }) - } - _ => None, - }; - save_circuit_handles.push(tokio::task::spawn(async move { - let (circuit_id, circuit_url) = save_circuit( - block_number, - circuit, - sequence, - partial_circuit_aux_data, - object_store, - ) - .await; + let (circuit_id, circuit_url) = + save_circuit(block_number, circuit, sequence, object_store).await; drop(permit); (circuit_id, circuit_url) })); @@ -196,57 +175,6 @@ pub(super) async fn generate_witness( } .instrument(save_circuits_span); - let mut save_ram_queue_witness_handles = vec![]; - - let save_ram_queue_witness_span = tracing::info_span!("save_circuits"); - - // Future which receives part of RAM permutation circuits witnesses and saves them async. - // Uses semaphore because these artifacts are of significant size - let ram_queue_witness_receiver_handle = async { - let mut sorted_sequence = 0; - let mut unsorted_sequence = 0; - - while let Some(witness_artifact) = ram_permutation_queue_receiver - .recv() - .instrument(tracing::info_span!("wait_for_ram_witness")) - .await - { - let object_store = object_store.clone(); - let semaphore = semaphore.clone(); - let permit = semaphore - .acquire_owned() - .await - .expect("failed to get permit for running save ram permutation queue witness task"); - let (is_sorted, witness, sequence) = match witness_artifact { - WitnessGenerationArtifact::MemoryQueueWitness((witness, sorted)) => { - let sequence = if sorted { - let sequence = sorted_sequence; - sorted_sequence += 1; - sequence - } else { - let sequence = unsorted_sequence; - unsorted_sequence += 1; - sequence - }; - (sorted, witness, sequence) - } - _ => panic!("Invalid artifact received"), - }; - save_ram_queue_witness_handles.push(tokio::task::spawn(async move { - let _ = save_ram_premutation_queue_witness( - block_number, - sequence, - is_sorted, - witness, - object_store, - ) - .await; - drop(permit); - })); - } - } - .instrument(save_ram_queue_witness_span); - let mut save_queue_handles = vec![]; let save_queues_span = tracing::info_span!("save_queues"); @@ -272,11 +200,10 @@ pub(super) async fn generate_witness( } .instrument(save_queues_span); - let (witnesses, _, _, _) = tokio::join!( + let (witnesses, _, _) = tokio::join!( make_circuits_handle, circuit_receiver_handle, - queue_receiver_handle, - ram_queue_witness_receiver_handle + queue_receiver_handle ); let (mut scheduler_witness, block_aux_witness) = witnesses.unwrap(); @@ -301,11 +228,7 @@ pub(super) async fn generate_witness( .filter(|(circuit_id, _, _)| circuits_present.contains(circuit_id)) .collect(); - let _: Vec<_> = futures::future::join_all(save_ram_queue_witness_handles) - .await - .into_iter() - .map(|result| result.expect("failed to save ram permutation queue witness")) - .collect(); + artifacts_receiver_handle.join().unwrap(); scheduler_witness.previous_block_meta_hash = input.previous_batch_metadata.meta_hash.0; scheduler_witness.previous_block_aux_hash = input.previous_batch_metadata.aux_hash.0; diff --git a/prover/crates/bin/witness_generator/src/utils.rs b/prover/crates/bin/witness_generator/src/utils.rs index 8524bdae9ff0..ea631f19cd85 100644 --- a/prover/crates/bin/witness_generator/src/utils.rs +++ b/prover/crates/bin/witness_generator/src/utils.rs @@ -3,10 +3,7 @@ use std::{ sync::Arc, }; -use circuit_definitions::{ - circuit_definitions::base_layer::ZkSyncBaseLayerCircuit, - encodings::memory_query::MemoryQueueStateWitnesses, -}; +use circuit_definitions::circuit_definitions::base_layer::ZkSyncBaseLayerCircuit; use once_cell::sync::Lazy; use zkevm_test_harness::boojum::field::goldilocks::GoldilocksField; use zksync_multivm::utils::get_used_bootloader_memory_bytes; @@ -24,8 +21,8 @@ use zksync_prover_fri_types::{ encodings::recursion_request::RecursionQueueSimulator, zkevm_circuits::scheduler::input::SchedulerCircuitInstanceWitness, }, - keys::{AggregationsKey, ClosedFormInputKey, FriCircuitKey, RamPermutationQueueWitnessKey}, - CircuitAuxData, CircuitWrapper, FriProofWrapper, RamPermutationQueueWitness, + keys::{AggregationsKey, ClosedFormInputKey, FriCircuitKey}, + CircuitWrapper, FriProofWrapper, }; use zksync_types::{basic_fri_types::AggregationRound, L1BatchNumber, ProtocolVersionId, U256}; @@ -121,7 +118,6 @@ pub async fn save_circuit( block_number: L1BatchNumber, circuit: ZkSyncBaseLayerCircuit, sequence_number: usize, - aux_data_for_partial_circuit: Option, object_store: Arc, ) -> (u8, String) { let circuit_id = circuit.numeric_circuit_type(); @@ -133,43 +129,12 @@ pub async fn save_circuit( depth: 0, }; - let blob_url = if let Some(aux_data_for_partial_circuit) = aux_data_for_partial_circuit { - object_store - .put( - circuit_key, - &CircuitWrapper::BasePartial((circuit, aux_data_for_partial_circuit)), - ) - .await - .unwrap() - } else { - object_store - .put(circuit_key, &CircuitWrapper::Base(circuit)) - .await - .unwrap() - }; - (circuit_id, blob_url) -} - -#[tracing::instrument( - skip_all, - fields(l1_batch = %block_number) -)] -pub async fn save_ram_premutation_queue_witness( - block_number: L1BatchNumber, - circuit_subsequence_number: usize, - is_sorted: bool, - witness: MemoryQueueStateWitnesses, - object_store: Arc, -) -> String { - let witness_key = RamPermutationQueueWitnessKey { - block_number, - circuit_subsequence_number, - is_sorted, - }; - object_store - .put(witness_key, &RamPermutationQueueWitness { witness }) + let blob_url = object_store + .put(circuit_key, &CircuitWrapper::Base(circuit)) .await - .unwrap() + .unwrap(); + + (circuit_id, blob_url) } #[tracing::instrument( diff --git a/prover/crates/lib/keystore/src/keystore.rs b/prover/crates/lib/keystore/src/keystore.rs index 6225943e3cd7..ab3b115bc635 100644 --- a/prover/crates/lib/keystore/src/keystore.rs +++ b/prover/crates/lib/keystore/src/keystore.rs @@ -470,6 +470,7 @@ impl Keystore { } /// Async loads mapping of all circuits to setup key, if successful + #[cfg(feature = "gpu")] pub async fn load_all_setup_key_mapping( &self, ) -> anyhow::Result>> {