diff --git a/.dockerignore b/.dockerignore index ee2e8af78dd3..c32286be6a01 100644 --- a/.dockerignore +++ b/.dockerignore @@ -39,7 +39,7 @@ contracts/.git !etc/multivm_bootloaders !cargo !bellman-cuda -!prover/vk_setup_data_generator_server_fri/data/ +!prover/crates/bin/vk_setup_data_generator_server_fri/data/ !.github/release-please/manifest.json !etc/env/file_based diff --git a/.github/release-please/manifest.json b/.github/release-please/manifest.json index b50534880a10..058b522b417e 100644 --- a/.github/release-please/manifest.json +++ b/.github/release-please/manifest.json @@ -1,4 +1,4 @@ { - "core": "24.9.0", + "core": "24.10.0", "prover": "16.0.0" } diff --git a/.github/workflows/build-docker-from-tag.yml b/.github/workflows/build-docker-from-tag.yml index 50c28d9677d8..7e5257796643 100644 --- a/.github/workflows/build-docker-from-tag.yml +++ b/.github/workflows/build-docker-from-tag.yml @@ -61,7 +61,7 @@ jobs: build-push-tee-prover-images: name: Build and push images - needs: [setup, changed_files] + needs: [setup] uses: ./.github/workflows/build-tee-prover-template.yml if: contains(github.ref_name, 'core') secrets: diff --git a/.github/workflows/build-prover-fri-gpu-gar.yml b/.github/workflows/build-prover-fri-gpu-gar.yml index 4a83af559e50..7805f7ba565b 100644 --- a/.github/workflows/build-prover-fri-gpu-gar.yml +++ b/.github/workflows/build-prover-fri-gpu-gar.yml @@ -47,7 +47,6 @@ jobs: PROVER_IMAGE=${{ inputs.image_tag_suffix }} push: true tags: | - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/prover-fri-gpu-gar:2.0-${{ inputs.image_tag_suffix }} us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/prover-fri-gpu-gar:2.0-${{ inputs.protocol_version }}-${{ inputs.image_tag_suffix }} - name: Login to Asia GAR @@ -56,9 +55,6 @@ jobs: - name: Build and push to Asia GAR run: | - docker buildx imagetools create \ - --tag asia-docker.pkg.dev/matterlabs-infra/matterlabs-docker/prover-fri-gpu-gar:2.0-${{ inputs.image_tag_suffix }} \ - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/prover-fri-gpu-gar:2.0-${{ inputs.image_tag_suffix }} docker buildx imagetools create \ --tag asia-docker.pkg.dev/matterlabs-infra/matterlabs-docker/prover-fri-gpu-gar:2.0-${{ inputs.protocol_version }}-${{ inputs.image_tag_suffix }} \ us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/prover-fri-gpu-gar:2.0-${{ inputs.protocol_version }}-${{ inputs.image_tag_suffix }} @@ -69,9 +65,6 @@ jobs: - name: Build and push to Europe GAR run: | - docker buildx imagetools create \ - --tag europe-docker.pkg.dev/matterlabs-infra/matterlabs-docker/prover-fri-gpu-gar:2.0-${{ inputs.image_tag_suffix }} \ - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/prover-fri-gpu-gar:2.0-${{ inputs.image_tag_suffix }} docker buildx imagetools create \ --tag europe-docker.pkg.dev/matterlabs-infra/matterlabs-docker/prover-fri-gpu-gar:2.0-${{ inputs.protocol_version }}-${{ inputs.image_tag_suffix }} \ us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/prover-fri-gpu-gar:2.0-${{ inputs.protocol_version }}-${{ inputs.image_tag_suffix }} diff --git a/.github/workflows/build-prover-template.yml b/.github/workflows/build-prover-template.yml index d03ae124b176..ba76740ee2df 100644 --- a/.github/workflows/build-prover-template.yml +++ b/.github/workflows/build-prover-template.yml @@ -199,9 +199,6 @@ jobs: - name: Login and push to Asia GAR run: | gcloud auth print-access-token --lifetime=7200 --impersonate-service-account=gha-ci-runners@matterlabs-infra.iam.gserviceaccount.com | docker login -u oauth2accesstoken --password-stdin https://asia-docker.pkg.dev - docker buildx imagetools create \ - --tag asia-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ inputs.image_tag_suffix }} \ - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ inputs.image_tag_suffix }} docker buildx imagetools create \ --tag asia-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ needs.build-images.outputs.protocol_version }}-${{ inputs.image_tag_suffix }} \ us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ needs.build-images.outputs.protocol_version }}-${{ inputs.image_tag_suffix }} @@ -209,9 +206,6 @@ jobs: - name: Login and push to Europe GAR run: | gcloud auth print-access-token --lifetime=7200 --impersonate-service-account=gha-ci-runners@matterlabs-infra.iam.gserviceaccount.com | docker login -u oauth2accesstoken --password-stdin https://europe-docker.pkg.dev - docker buildx imagetools create \ - --tag europe-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ inputs.image_tag_suffix }} \ - us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ inputs.image_tag_suffix }} docker buildx imagetools create \ --tag europe-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ needs.build-images.outputs.protocol_version }}-${{ inputs.image_tag_suffix }} \ us-docker.pkg.dev/matterlabs-infra/matterlabs-docker/${{ matrix.component }}:2.0-${{ needs.build-images.outputs.protocol_version }}-${{ inputs.image_tag_suffix }} diff --git a/.gitignore b/.gitignore index 32ed5815b017..3ffddc7a7930 100644 --- a/.gitignore +++ b/.gitignore @@ -108,7 +108,7 @@ hyperchain-*.yml /etc/hyperchains/artifacts # Prover keys that should not be commited -prover/vk_setup_data_generator_server_fri/data/setup_* +prover/crates/bin/vk_setup_data_generator_server_fri/data/setup_* # Zk Toolbox chains/era/configs/* diff --git a/Cargo.lock b/Cargo.lock index f73206e46e06..f3605beb7918 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4105,9 +4105,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ "bitflags 2.6.0", "cfg-if 1.0.0", @@ -4137,9 +4137,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -8624,7 +8624,7 @@ dependencies = [ [[package]] name = "zksync_external_node" -version = "24.9.0" +version = "24.10.0" dependencies = [ "anyhow", "assert_matches", diff --git a/Cargo.toml b/Cargo.toml index aa77cf2f7cc1..0ce4be5c8431 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,7 +79,7 @@ members = [ "core/tests/vm-benchmark/harness", # Parts of prover workspace that are needed for Core workspace - "prover/prover_dal" + "prover/crates/lib/prover_dal" ] resolver = "2" @@ -222,7 +222,7 @@ zksync_protobuf_build = "=0.1.0-rc.2" # "Local" dependencies zksync_multivm = { version = "0.1.0", path = "core/lib/multivm" } -zksync_prover_dal = { version = "0.1.0", path = "prover/prover_dal" } +zksync_prover_dal = { version = "0.1.0", path = "prover/crates/lib/prover_dal" } zksync_vlog = { version = "0.1.0", path = "core/lib/vlog" } zksync_vm_utils = { version = "0.1.0", path = "core/lib/vm_utils" } zksync_vm_benchmark_harness = { version = "0.1.0", path = "core/tests/vm-benchmark/harness" } diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index ee4aad02eaf6..45182e704e5a 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -1,5 +1,24 @@ # Changelog +## [24.10.0](https://github.com/matter-labs/zksync-era/compare/core-v24.9.0...core-v24.10.0) (2024-07-22) + + +### Features + +* Add blob size metrics ([#2411](https://github.com/matter-labs/zksync-era/issues/2411)) ([41c535a](https://github.com/matter-labs/zksync-era/commit/41c535af2bcc72000116277d5dd9e04b5c0b2372)) +* **en:** Switch EN to use node framework ([#2427](https://github.com/matter-labs/zksync-era/issues/2427)) ([0cee530](https://github.com/matter-labs/zksync-era/commit/0cee530b2f2e8304b7e20a093a32abe116463b57)) +* **eth-sender:** add early return in sending new transactions to not spam logs with errors ([#2425](https://github.com/matter-labs/zksync-era/issues/2425)) ([192f2a3](https://github.com/matter-labs/zksync-era/commit/192f2a374d83eaecb52f198fdcfa615262378530)) +* **eth-watch:** Integrate decentralized upgrades ([#2401](https://github.com/matter-labs/zksync-era/issues/2401)) ([5a48e10](https://github.com/matter-labs/zksync-era/commit/5a48e1026260024c6ae2b4d1100ee9b798a83e8d)) +* L1 batch signing (BFT-474) ([#2414](https://github.com/matter-labs/zksync-era/issues/2414)) ([ab699db](https://github.com/matter-labs/zksync-era/commit/ab699dbe8cffa8bd291d6054579061b47fd4aa0e)) +* **prover:** Make it possible to run prover out of GCP ([#2448](https://github.com/matter-labs/zksync-era/issues/2448)) ([c9da549](https://github.com/matter-labs/zksync-era/commit/c9da5497e2aa9d85f204ab7b74fefcfe941793ff)) +* **zk_toolbox:** Small adjustment for zk toolbox ([#2424](https://github.com/matter-labs/zksync-era/issues/2424)) ([ce43c42](https://github.com/matter-labs/zksync-era/commit/ce43c422fddccfe88c07ee22a2b8726dd0bd5f61)) + + +### Bug Fixes + +* **eth-sender:** add bump of min 10% when resending txs to avoid "replacement transaction underpriced" ([#2422](https://github.com/matter-labs/zksync-era/issues/2422)) ([a7bcf5d](https://github.com/matter-labs/zksync-era/commit/a7bcf5d7f75eb45384312d7c97f25a50a91e7a31)) +* Set attesters in Connection::adjust_genesis (BFT-489) ([#2429](https://github.com/matter-labs/zksync-era/issues/2429)) ([ca4cb3c](https://github.com/matter-labs/zksync-era/commit/ca4cb3cba04757dc1760397c667a838931cd2d11)) + ## [24.9.0](https://github.com/matter-labs/zksync-era/compare/core-v24.8.0...core-v24.9.0) (2024-07-10) diff --git a/core/bin/external_node/Cargo.toml b/core/bin/external_node/Cargo.toml index c083561897d2..84c0ddd16e09 100644 --- a/core/bin/external_node/Cargo.toml +++ b/core/bin/external_node/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "zksync_external_node" description = "Non-validator ZKsync node" -version = "24.9.0" # x-release-please-version +version = "24.10.0" # x-release-please-version edition.workspace = true authors.workspace = true homepage.workspace = true diff --git a/core/bin/zksync_server/src/main.rs b/core/bin/zksync_server/src/main.rs index b589d04aed66..a59705b8e587 100644 --- a/core/bin/zksync_server/src/main.rs +++ b/core/bin/zksync_server/src/main.rs @@ -91,12 +91,25 @@ fn main() -> anyhow::Result<()> { let tmp_config = load_env_config()?; let configs = match opt.config_path { - None => tmp_config.general(), + None => { + let mut configs = tmp_config.general(); + configs.consensus_config = + config::read_consensus_config().context("read_consensus_config()")?; + configs + } Some(path) => { let yaml = std::fs::read_to_string(&path).with_context(|| path.display().to_string())?; - decode_yaml_repr::(&yaml) - .context("failed decoding general YAML config")? + let mut configs = + decode_yaml_repr::(&yaml) + .context("failed decoding general YAML config")?; + // Fallback to the consensus_config.yaml file. + // TODO: remove once we move the consensus config to general config on stage + if configs.consensus_config.is_none() { + configs.consensus_config = + config::read_consensus_config().context("read_consensus_config()")?; + } + configs } }; @@ -154,8 +167,6 @@ fn main() -> anyhow::Result<()> { }, }; - let consensus = config::read_consensus_config().context("read_consensus_config()")?; - let contracts_config = match opt.contracts_config_path { None => ContractsConfig::from_env().context("contracts_config")?, Some(path) => { @@ -176,14 +187,7 @@ fn main() -> anyhow::Result<()> { } }; - let node = MainNodeBuilder::new( - configs, - wallets, - genesis, - contracts_config, - secrets, - consensus, - ); + let node = MainNodeBuilder::new(configs, wallets, genesis, contracts_config, secrets); if opt.genesis { // If genesis is requested, we don't need to run the node. diff --git a/core/bin/zksync_server/src/node_builder.rs b/core/bin/zksync_server/src/node_builder.rs index f8173579b57e..0eaa9b651f64 100644 --- a/core/bin/zksync_server/src/node_builder.rs +++ b/core/bin/zksync_server/src/node_builder.rs @@ -3,10 +3,7 @@ use anyhow::Context; use zksync_config::{ - configs::{ - consensus::ConsensusConfig, eth_sender::PubdataSendingMode, wallets::Wallets, - GeneralConfig, Secrets, - }, + configs::{eth_sender::PubdataSendingMode, wallets::Wallets, GeneralConfig, Secrets}, ContractsConfig, GenesisConfig, }; use zksync_core_leftovers::Component; @@ -86,7 +83,6 @@ pub struct MainNodeBuilder { genesis_config: GenesisConfig, contracts_config: ContractsConfig, secrets: Secrets, - consensus_config: Option, } impl MainNodeBuilder { @@ -96,7 +92,6 @@ impl MainNodeBuilder { genesis_config: GenesisConfig, contracts_config: ContractsConfig, secrets: Secrets, - consensus_config: Option, ) -> Self { Self { node: ZkStackServiceBuilder::new(), @@ -105,7 +100,6 @@ impl MainNodeBuilder { genesis_config, contracts_config, secrets, - consensus_config, } } @@ -456,6 +450,7 @@ impl MainNodeBuilder { fn add_consensus_layer(mut self) -> anyhow::Result { self.node.add_layer(MainNodeConsensusLayer { config: self + .configs .consensus_config .clone() .context("Consensus config has to be provided")?, diff --git a/core/lib/basic_types/src/prover_dal.rs b/core/lib/basic_types/src/prover_dal.rs index 29d36cc91f8f..edaad3798e82 100644 --- a/core/lib/basic_types/src/prover_dal.rs +++ b/core/lib/basic_types/src/prover_dal.rs @@ -5,9 +5,7 @@ use chrono::{DateTime, Duration, NaiveDateTime, NaiveTime, Utc}; use strum::{Display, EnumString}; use crate::{ - basic_fri_types::{AggregationRound, Eip4844Blobs}, - protocol_version::ProtocolVersionId, - L1BatchNumber, + basic_fri_types::AggregationRound, protocol_version::ProtocolVersionId, L1BatchNumber, }; #[derive(Debug, Clone)] @@ -255,7 +253,6 @@ pub struct ProverJobFriInfo { pub created_at: NaiveDateTime, pub updated_at: NaiveDateTime, pub time_taken: Option, - pub is_blob_cleaned: Option, pub depth: u32, pub is_node_final_proof: bool, pub proof_blob_url: Option, @@ -266,7 +263,6 @@ pub struct ProverJobFriInfo { #[derive(Debug, Clone)] pub struct BasicWitnessGeneratorJobInfo { pub l1_batch_number: L1BatchNumber, - pub merkle_tree_paths_blob_url: Option, pub witness_inputs_blob_url: Option, pub attempts: u32, pub status: WitnessJobStatus, @@ -275,10 +271,8 @@ pub struct BasicWitnessGeneratorJobInfo { pub updated_at: NaiveDateTime, pub processing_started_at: Option, pub time_taken: Option, - pub is_blob_cleaned: Option, pub protocol_version: Option, pub picked_by: Option, - pub eip_4844_blobs: Option, } #[derive(Debug, Clone)] @@ -294,7 +288,6 @@ pub struct LeafWitnessGeneratorJobInfo { pub updated_at: NaiveDateTime, pub processing_started_at: Option, pub time_taken: Option, - pub is_blob_cleaned: Option, pub number_of_basic_circuits: Option, pub protocol_version: Option, pub picked_by: Option, diff --git a/core/lib/config/src/configs/fri_prover.rs b/core/lib/config/src/configs/fri_prover.rs index 99e3d354536e..5cd25450531a 100644 --- a/core/lib/config/src/configs/fri_prover.rs +++ b/core/lib/config/src/configs/fri_prover.rs @@ -10,6 +10,18 @@ pub enum SetupLoadMode { FromMemory, } +/// Kind of cloud environment prover subsystem runs in. +/// +/// Currently will only affect how the prover zone is chosen. +#[derive(Debug, Default, Deserialize, Clone, Copy, PartialEq, Eq)] +pub enum CloudType { + /// Assumes that the prover runs in GCP. + #[default] + GCP, + /// Assumes that the prover runs locally. + Local, +} + /// Configuration for the fri prover application #[derive(Debug, Deserialize, Clone, PartialEq)] pub struct FriProverConfig { @@ -28,6 +40,8 @@ pub struct FriProverConfig { pub shall_save_to_public_bucket: bool, pub prover_object_store: Option, pub public_object_store: Option, + #[serde(default)] + pub cloud_type: CloudType, } impl FriProverConfig { diff --git a/core/lib/config/src/configs/general.rs b/core/lib/config/src/configs/general.rs index e80538b2a4b9..122d1e278553 100644 --- a/core/lib/config/src/configs/general.rs +++ b/core/lib/config/src/configs/general.rs @@ -2,6 +2,7 @@ use crate::{ configs::{ base_token_adjuster::BaseTokenAdjusterConfig, chain::{CircuitBreakerConfig, MempoolConfig, OperationsManagerConfig, StateKeeperConfig}, + consensus::ConsensusConfig, da_dispatcher::DADispatcherConfig, fri_prover_group::FriProverGroupConfig, house_keeper::HouseKeeperConfig, @@ -17,7 +18,7 @@ use crate::{ SnapshotsCreatorConfig, }; -#[derive(Debug)] +#[derive(Debug, PartialEq)] pub struct GeneralConfig { pub postgres_config: Option, pub api_config: Option, @@ -48,4 +49,5 @@ pub struct GeneralConfig { pub core_object_store: Option, pub base_token_adjuster: Option, pub external_price_api_client_config: Option, + pub consensus_config: Option, } diff --git a/core/lib/config/src/testonly.rs b/core/lib/config/src/testonly.rs index a5e51131c3a8..f3d6b98491be 100644 --- a/core/lib/config/src/testonly.rs +++ b/core/lib/config/src/testonly.rs @@ -235,24 +235,24 @@ impl Distribution for EncodeDist { } impl Distribution for EncodeDist { - fn sample(&self, g: &mut R) -> configs::ContractsConfig { + fn sample(&self, rng: &mut R) -> configs::ContractsConfig { configs::ContractsConfig { - governance_addr: g.gen(), - verifier_addr: g.gen(), - default_upgrade_addr: g.gen(), - diamond_proxy_addr: g.gen(), - validator_timelock_addr: g.gen(), - l1_erc20_bridge_proxy_addr: g.gen(), - l2_erc20_bridge_addr: g.gen(), - l1_shared_bridge_proxy_addr: g.gen(), - l2_shared_bridge_addr: g.gen(), - l1_weth_bridge_proxy_addr: g.gen(), - l2_weth_bridge_addr: g.gen(), - l2_testnet_paymaster_addr: g.gen(), - l1_multicall3_addr: g.gen(), - base_token_addr: g.gen(), - chain_admin_addr: g.gen(), - ecosystem_contracts: self.sample(g), + governance_addr: rng.gen(), + verifier_addr: rng.gen(), + default_upgrade_addr: rng.gen(), + diamond_proxy_addr: rng.gen(), + validator_timelock_addr: rng.gen(), + l1_erc20_bridge_proxy_addr: rng.gen(), + l2_erc20_bridge_addr: rng.gen(), + l1_shared_bridge_proxy_addr: rng.gen(), + l2_shared_bridge_addr: rng.gen(), + l1_weth_bridge_proxy_addr: rng.gen(), + l2_weth_bridge_addr: rng.gen(), + l2_testnet_paymaster_addr: rng.gen(), + l1_multicall3_addr: rng.gen(), + base_token_addr: rng.gen(), + chain_admin_addr: rng.gen(), + ecosystem_contracts: self.sample(rng), } } } @@ -438,6 +438,16 @@ impl Distribution for EncodeDist { } } +impl Distribution for EncodeDist { + fn sample(&self, rng: &mut R) -> configs::fri_prover::CloudType { + type T = configs::fri_prover::CloudType; + match rng.gen_range(0..1) { + 0 => T::GCP, + _ => T::Local, + } + } +} + impl Distribution for EncodeDist { fn sample(&self, rng: &mut R) -> configs::FriProverConfig { configs::FriProverConfig { @@ -454,6 +464,7 @@ impl Distribution for EncodeDist { availability_check_interval_in_secs: self.sample(rng), prover_object_store: self.sample(rng), public_object_store: self.sample(rng), + cloud_type: self.sample(rng), } } } @@ -876,3 +887,164 @@ impl Distribution for EncodeDist { } } } + +impl Distribution for EncodeDist { + fn sample(&self, rng: &mut R) -> configs::da_dispatcher::DADispatcherConfig { + configs::da_dispatcher::DADispatcherConfig { + polling_interval_ms: self.sample(rng), + max_rows_to_dispatch: self.sample(rng), + max_retries: self.sample(rng), + } + } +} + +impl Distribution for EncodeDist { + fn sample( + &self, + rng: &mut R, + ) -> configs::vm_runner::ProtectiveReadsWriterConfig { + configs::vm_runner::ProtectiveReadsWriterConfig { + db_path: self.sample(rng), + window_size: self.sample(rng), + first_processed_batch: L1BatchNumber(rng.gen()), + } + } +} + +impl Distribution for EncodeDist { + fn sample( + &self, + rng: &mut R, + ) -> configs::vm_runner::BasicWitnessInputProducerConfig { + configs::vm_runner::BasicWitnessInputProducerConfig { + db_path: self.sample(rng), + window_size: self.sample(rng), + first_processed_batch: L1BatchNumber(rng.gen()), + } + } +} + +impl Distribution for EncodeDist { + fn sample(&self, rng: &mut R) -> configs::CommitmentGeneratorConfig { + configs::CommitmentGeneratorConfig { + max_parallelism: self.sample(rng), + } + } +} + +impl Distribution for EncodeDist { + fn sample( + &self, + rng: &mut R, + ) -> configs::snapshot_recovery::TreeRecoveryConfig { + configs::snapshot_recovery::TreeRecoveryConfig { + chunk_size: self.sample(rng), + parallel_persistence_buffer: self.sample_opt(|| rng.gen()), + } + } +} + +impl Distribution for EncodeDist { + fn sample( + &self, + rng: &mut R, + ) -> configs::snapshot_recovery::PostgresRecoveryConfig { + configs::snapshot_recovery::PostgresRecoveryConfig { + max_concurrency: self.sample_opt(|| rng.gen()), + } + } +} + +impl Distribution for EncodeDist { + fn sample( + &self, + rng: &mut R, + ) -> configs::snapshot_recovery::SnapshotRecoveryConfig { + use configs::snapshot_recovery::{SnapshotRecoveryConfig, TreeRecoveryConfig}; + let tree: TreeRecoveryConfig = self.sample(rng); + SnapshotRecoveryConfig { + enabled: self.sample(rng), + l1_batch: self.sample_opt(|| L1BatchNumber(rng.gen())), + drop_storage_key_preimages: (tree != TreeRecoveryConfig::default()) && self.sample(rng), + tree, + postgres: self.sample(rng), + object_store: self.sample(rng), + } + } +} + +impl Distribution for EncodeDist { + fn sample(&self, rng: &mut R) -> configs::pruning::PruningConfig { + configs::pruning::PruningConfig { + enabled: self.sample(rng), + chunk_size: self.sample(rng), + removal_delay_sec: self.sample_opt(|| rng.gen()), + data_retention_sec: self.sample(rng), + } + } +} + +impl Distribution for EncodeDist { + fn sample( + &self, + rng: &mut R, + ) -> configs::base_token_adjuster::BaseTokenAdjusterConfig { + configs::base_token_adjuster::BaseTokenAdjusterConfig { + price_polling_interval_ms: self.sample(rng), + price_cache_update_interval_ms: self.sample(rng), + } + } +} + +impl Distribution for EncodeDist { + fn sample( + &self, + rng: &mut R, + ) -> configs::external_price_api_client::ExternalPriceApiClientConfig { + configs::external_price_api_client::ExternalPriceApiClientConfig { + source: self.sample(rng), + base_url: self.sample(rng), + api_key: self.sample(rng), + client_timeout_ms: self.sample(rng), + forced_numerator: self.sample(rng), + forced_denominator: self.sample(rng), + } + } +} + +impl Distribution for EncodeDist { + fn sample(&self, rng: &mut R) -> configs::GeneralConfig { + configs::GeneralConfig { + postgres_config: self.sample(rng), + api_config: self.sample(rng), + contract_verifier: self.sample(rng), + circuit_breaker_config: self.sample(rng), + mempool_config: self.sample(rng), + operations_manager_config: self.sample(rng), + state_keeper_config: self.sample(rng), + house_keeper_config: self.sample(rng), + proof_compressor_config: self.sample(rng), + prover_config: self.sample(rng), + prover_gateway: self.sample(rng), + witness_vector_generator: self.sample(rng), + prover_group_config: self.sample(rng), + witness_generator: self.sample(rng), + prometheus_config: self.sample(rng), + proof_data_handler_config: self.sample(rng), + db_config: self.sample(rng), + eth: self.sample(rng), + snapshot_creator: self.sample(rng), + observability: self.sample(rng), + da_dispatcher_config: self.sample(rng), + protective_reads_writer_config: self.sample(rng), + basic_witness_input_producer_config: self.sample(rng), + commitment_generator: self.sample(rng), + snapshot_recovery: self.sample(rng), + pruning: self.sample(rng), + core_object_store: self.sample(rng), + base_token_adjuster: self.sample(rng), + external_price_api_client_config: self.sample(rng), + consensus_config: self.sample(rng), + } + } +} diff --git a/core/lib/env_config/src/fri_prover.rs b/core/lib/env_config/src/fri_prover.rs index 96069d6514ea..bdcf5291ee05 100644 --- a/core/lib/env_config/src/fri_prover.rs +++ b/core/lib/env_config/src/fri_prover.rs @@ -18,7 +18,10 @@ impl FromEnv for FriProverConfig { #[cfg(test)] mod tests { use zksync_config::{ - configs::{fri_prover::SetupLoadMode, object_store::ObjectStoreMode}, + configs::{ + fri_prover::{CloudType, SetupLoadMode}, + object_store::ObjectStoreMode, + }, ObjectStoreConfig, }; @@ -57,6 +60,7 @@ mod tests { local_mirror_path: None, }), availability_check_interval_in_secs: Some(1_800), + cloud_type: CloudType::GCP, } } diff --git a/core/lib/protobuf_config/src/general.rs b/core/lib/protobuf_config/src/general.rs index 44ce9d8d1eba..31d1ea6bc1b7 100644 --- a/core/lib/protobuf_config/src/general.rs +++ b/core/lib/protobuf_config/src/general.rs @@ -56,6 +56,7 @@ impl ProtoRepr for proto::GeneralConfig { .context("snapshot_recovery")?, external_price_api_client_config: read_optional_repr(&self.external_price_api_client) .context("external_price_api_client")?, + consensus_config: read_optional_repr(&self.consensus).context("consensus")?, }) } @@ -105,6 +106,7 @@ impl ProtoRepr for proto::GeneralConfig { .external_price_api_client_config .as_ref() .map(ProtoRepr::build), + consensus: this.consensus_config.as_ref().map(ProtoRepr::build), } } } diff --git a/core/lib/protobuf_config/src/proto/config/general.proto b/core/lib/protobuf_config/src/proto/config/general.proto index be64f7bb97ee..37d507b9ab62 100644 --- a/core/lib/protobuf_config/src/proto/config/general.proto +++ b/core/lib/protobuf_config/src/proto/config/general.proto @@ -21,35 +21,37 @@ import "zksync/config/pruning.proto"; import "zksync/config/object_store.proto"; import "zksync/config/base_token_adjuster.proto"; import "zksync/config/external_price_api_client.proto"; +import "zksync/core/consensus.proto"; message GeneralConfig { - optional config.database.Postgres postgres = 1; - optional config.api.Api api = 2; - optional config.contract_verifier.ContractVerifier contract_verifier = 3; - optional config.circuit_breaker.CircuitBreaker circuit_breaker = 5; - optional config.chain.Mempool mempool = 6; - optional config.chain.OperationsManager operations_manager = 8; - optional config.chain.StateKeeper state_keeper = 9; - optional config.house_keeper.HouseKeeper house_keeper = 10; - optional config.prover.Prover prover = 12; - optional config.utils.Prometheus prometheus = 15; - optional config.database.DB db = 20; - optional config.eth.ETH eth = 22; - optional config.prover.WitnessGenerator witness_generator = 24; - optional config.prover.WitnessVectorGenerator witness_vector_generator = 25; - optional config.prover.ProofCompressor proof_compressor = 27; - optional config.prover.ProofDataHandler data_handler = 28; - optional config.prover.ProverGroup prover_group = 29; - optional config.prover.ProverGateway prover_gateway = 30; - optional config.snapshot_creator.SnapshotsCreator snapshot_creator = 31; - optional config.observability.Observability observability = 32; - optional config.vm_runner.ProtectiveReadsWriter protective_reads_writer = 33; - optional config.object_store.ObjectStore core_object_store = 34; - optional config.snapshot_recovery.SnapshotRecovery snapshot_recovery = 35; - optional config.pruning.Pruning pruning = 36; - optional config.commitment_generator.CommitmentGenerator commitment_generator = 37; - optional config.da_dispatcher.DataAvailabilityDispatcher da_dispatcher = 38; - optional config.base_token_adjuster.BaseTokenAdjuster base_token_adjuster = 39; - optional config.vm_runner.BasicWitnessInputProducer basic_witness_input_producer = 40; - optional config.external_price_api_client.ExternalPriceApiClient external_price_api_client = 41; + optional database.Postgres postgres = 1; + optional api.Api api = 2; + optional contract_verifier.ContractVerifier contract_verifier = 3; + optional circuit_breaker.CircuitBreaker circuit_breaker = 5; + optional chain.Mempool mempool = 6; + optional chain.OperationsManager operations_manager = 8; + optional chain.StateKeeper state_keeper = 9; + optional house_keeper.HouseKeeper house_keeper = 10; + optional prover.Prover prover = 12; + optional utils.Prometheus prometheus = 15; + optional database.DB db = 20; + optional eth.ETH eth = 22; + optional prover.WitnessGenerator witness_generator = 24; + optional prover.WitnessVectorGenerator witness_vector_generator = 25; + optional prover.ProofCompressor proof_compressor = 27; + optional prover.ProofDataHandler data_handler = 28; + optional prover.ProverGroup prover_group = 29; + optional prover.ProverGateway prover_gateway = 30; + optional snapshot_creator.SnapshotsCreator snapshot_creator = 31; + optional observability.Observability observability = 32; + optional vm_runner.ProtectiveReadsWriter protective_reads_writer = 33; + optional object_store.ObjectStore core_object_store = 34; + optional snapshot_recovery.SnapshotRecovery snapshot_recovery = 35; + optional pruning.Pruning pruning = 36; + optional commitment_generator.CommitmentGenerator commitment_generator = 37; + optional da_dispatcher.DataAvailabilityDispatcher da_dispatcher = 38; + optional base_token_adjuster.BaseTokenAdjuster base_token_adjuster = 39; + optional vm_runner.BasicWitnessInputProducer basic_witness_input_producer = 40; + optional external_price_api_client.ExternalPriceApiClient external_price_api_client = 41; + optional core.consensus.Config consensus = 42; } diff --git a/core/lib/protobuf_config/src/proto/config/prover.proto b/core/lib/protobuf_config/src/proto/config/prover.proto index c50ebdde4eef..80d45f40bbcb 100644 --- a/core/lib/protobuf_config/src/proto/config/prover.proto +++ b/core/lib/protobuf_config/src/proto/config/prover.proto @@ -21,6 +21,11 @@ enum SetupLoadMode { FROM_MEMORY = 1; } +enum CloudType { + GCP = 0; + LOCAL = 1; +} + message Prover { optional string setup_data_path = 1; // required; fs path? optional uint32 prometheus_port = 2; // required; u16 @@ -35,6 +40,7 @@ message Prover { optional bool shall_save_to_public_bucket = 13; // required optional config.object_store.ObjectStore public_object_store = 22; optional config.object_store.ObjectStore prover_object_store = 23; + optional CloudType cloud_type = 24; // optional reserved 5, 6, 9; reserved "base_layer_circuit_ids_to_be_verified", "recursive_layer_circuit_ids_to_be_verified", "witness_vector_generator_thread_count"; } diff --git a/core/lib/protobuf_config/src/prover.rs b/core/lib/protobuf_config/src/prover.rs index 50782ab8e968..e1c31ee1fccd 100644 --- a/core/lib/protobuf_config/src/prover.rs +++ b/core/lib/protobuf_config/src/prover.rs @@ -292,6 +292,24 @@ impl proto::SetupLoadMode { } } +impl proto::CloudType { + fn new(x: &configs::fri_prover::CloudType) -> Self { + use configs::fri_prover::CloudType as From; + match x { + From::GCP => Self::Gcp, + From::Local => Self::Local, + } + } + + fn parse(&self) -> configs::fri_prover::CloudType { + use configs::fri_prover::CloudType as To; + match self { + Self::Gcp => To::GCP, + Self::Local => To::Local, + } + } +} + impl ProtoRepr for proto::Prover { type Type = configs::FriProverConfig; fn read(&self) -> anyhow::Result { @@ -338,6 +356,13 @@ impl ProtoRepr for proto::Prover { .context("shall_save_to_public_bucket")?, public_object_store, prover_object_store, + cloud_type: self + .cloud_type + .map(proto::CloudType::try_from) + .transpose() + .context("cloud_type")? + .map(|x| x.parse()) + .unwrap_or_default(), }) } @@ -356,6 +381,7 @@ impl ProtoRepr for proto::Prover { shall_save_to_public_bucket: Some(this.shall_save_to_public_bucket), prover_object_store: this.prover_object_store.as_ref().map(ProtoRepr::build), public_object_store: this.public_object_store.as_ref().map(ProtoRepr::build), + cloud_type: Some(proto::CloudType::new(&this.cloud_type).into()), } } } diff --git a/core/lib/protobuf_config/src/tests.rs b/core/lib/protobuf_config/src/tests.rs index 3cb18c5bbf6d..695f404f64d1 100644 --- a/core/lib/protobuf_config/src/tests.rs +++ b/core/lib/protobuf_config/src/tests.rs @@ -42,6 +42,18 @@ fn test_encoding() { test_encode_all_formats::>(rng); test_encode_all_formats::>(rng); test_encode_all_formats::>(rng); + test_encode_all_formats::>(rng); + test_encode_all_formats::>(rng); + test_encode_all_formats::>(rng); + test_encode_all_formats::>(rng); + test_encode_all_formats::>(rng); + test_encode_all_formats::>(rng); + test_encode_all_formats::>(rng); + test_encode_all_formats::>(rng); + test_encode_all_formats::>( + rng, + ); + test_encode_all_formats::>(rng); } #[test] diff --git a/core/lib/state/src/lib.rs b/core/lib/state/src/lib.rs index 66577841fd45..74c60e4a3695 100644 --- a/core/lib/state/src/lib.rs +++ b/core/lib/state/src/lib.rs @@ -12,6 +12,7 @@ use std::{cell::RefCell, collections::HashMap, fmt, rc::Rc}; use zksync_types::{ + api::state_override::StateOverride, get_known_code_key, storage::{StorageKey, StorageValue}, H256, @@ -29,6 +30,7 @@ pub use self::{ }, shadow_storage::ShadowStorage, storage_factory::{BatchDiff, PgOrRocksdbStorage, ReadStorageFactory, RocksdbWithMemory}, + storage_overrides::StorageOverrides, storage_view::{StorageView, StorageViewCache, StorageViewMetrics}, witness::WitnessStorage, }; @@ -40,6 +42,7 @@ mod postgres; mod rocksdb; mod shadow_storage; mod storage_factory; +mod storage_overrides; mod storage_view; #[cfg(test)] mod test_utils; @@ -89,3 +92,9 @@ pub trait WriteStorage: ReadStorage { /// Smart pointer to [`WriteStorage`]. pub type StoragePtr = Rc>; + +/// Functionality to override the storage state. +pub trait OverrideStorage { + /// Apply state override to the storage. + fn apply_state_override(&mut self, overrides: &StateOverride); +} diff --git a/core/lib/state/src/storage_overrides.rs b/core/lib/state/src/storage_overrides.rs new file mode 100644 index 000000000000..f45dd6d3382f --- /dev/null +++ b/core/lib/state/src/storage_overrides.rs @@ -0,0 +1,150 @@ +use std::{cell::RefCell, collections::HashMap, fmt, rc::Rc}; + +use zksync_types::{ + api::state_override::{OverrideState, StateOverride}, + get_code_key, get_nonce_key, + utils::{decompose_full_nonce, nonces_to_full_nonce, storage_key_for_eth_balance}, + AccountTreeId, StorageKey, StorageValue, H256, U256, +}; +use zksync_utils::{bytecode::hash_bytecode, h256_to_u256, u256_to_h256}; + +use crate::{OverrideStorage, ReadStorage}; + +/// A storage view that allows to override some of the storage values. +#[derive(Debug)] +pub struct StorageOverrides { + storage_handle: S, + overridden_factory_deps: HashMap>, + overridden_account_state: HashMap>, + overridden_account_state_diff: HashMap>, + overridden_balance: HashMap, + overridden_nonce: HashMap, + overridden_code: HashMap, +} + +impl StorageOverrides { + /// Creates a new storage view based on the underlying storage. + pub fn new(storage: S) -> Self { + Self { + storage_handle: storage, + overridden_factory_deps: HashMap::new(), + overridden_account_state: HashMap::new(), + overridden_account_state_diff: HashMap::new(), + overridden_balance: HashMap::new(), + overridden_nonce: HashMap::new(), + overridden_code: HashMap::new(), + } + } + + /// Overrides a factory dependency code. + pub fn store_factory_dep(&mut self, hash: H256, code: Vec) { + self.overridden_factory_deps.insert(hash, code); + } + + /// Overrides an account entire state. + pub fn override_account_state(&mut self, account: AccountTreeId, state: HashMap) { + self.overridden_account_state.insert(account, state); + } + + /// Overrides an account state diff. + pub fn override_account_state_diff( + &mut self, + account: AccountTreeId, + state_diff: HashMap, + ) { + self.overridden_account_state_diff + .insert(account, state_diff); + } + + /// Make a Rc RefCell ptr to the storage + pub fn to_rc_ptr(self) -> Rc> { + Rc::new(RefCell::new(self)) + } +} + +impl ReadStorage for StorageOverrides { + fn read_value(&mut self, key: &StorageKey) -> StorageValue { + if let Some(balance) = self.overridden_balance.get(key) { + return u256_to_h256(*balance); + } + if let Some(code) = self.overridden_code.get(key) { + return *code; + } + + if let Some(nonce) = self.overridden_nonce.get(key) { + return u256_to_h256(*nonce); + } + + if let Some(account_state) = self.overridden_account_state.get(key.account()) { + if let Some(value) = account_state.get(key.key()) { + return *value; + } + return H256::zero(); + } + + if let Some(account_state_diff) = self.overridden_account_state_diff.get(key.account()) { + if let Some(value) = account_state_diff.get(key.key()) { + return *value; + } + } + + self.storage_handle.read_value(key) + } + + fn is_write_initial(&mut self, key: &StorageKey) -> bool { + self.storage_handle.is_write_initial(key) + } + + fn load_factory_dep(&mut self, hash: H256) -> Option> { + self.overridden_factory_deps + .get(&hash) + .cloned() + .or_else(|| self.storage_handle.load_factory_dep(hash)) + } + + fn get_enumeration_index(&mut self, key: &StorageKey) -> Option { + self.storage_handle.get_enumeration_index(key) + } +} + +impl OverrideStorage for StorageOverrides { + fn apply_state_override(&mut self, state_override: &StateOverride) { + for (account, overrides) in state_override.iter() { + if let Some(balance) = overrides.balance { + let balance_key = storage_key_for_eth_balance(account); + self.overridden_balance.insert(balance_key, balance); + } + + if let Some(nonce) = overrides.nonce { + let nonce_key = get_nonce_key(account); + let full_nonce = self.read_value(&nonce_key); + let (_, deployment_nonce) = decompose_full_nonce(h256_to_u256(full_nonce)); + let new_full_nonce = nonces_to_full_nonce(nonce, deployment_nonce); + self.overridden_nonce.insert(nonce_key, new_full_nonce); + } + + if let Some(code) = &overrides.code { + let code_key = get_code_key(account); + let code_hash = hash_bytecode(&code.0); + self.overridden_code.insert(code_key, code_hash); + self.store_factory_dep(code_hash, code.0.clone()); + } + + match &overrides.state { + Some(OverrideState::State(state)) => { + self.override_account_state(AccountTreeId::new(*account), state.clone()); + } + Some(OverrideState::StateDiff(state_diff)) => { + for (key, value) in state_diff { + let account_state = self + .overridden_account_state_diff + .entry(AccountTreeId::new(*account)) + .or_default(); + account_state.insert(*key, *value); + } + } + None => {} + } + } + } +} diff --git a/core/lib/state/src/storage_view.rs b/core/lib/state/src/storage_view.rs index 7dcfda2ba406..4d79298101f4 100644 --- a/core/lib/state/src/storage_view.rs +++ b/core/lib/state/src/storage_view.rs @@ -6,9 +6,9 @@ use std::{ time::{Duration, Instant}, }; -use zksync_types::{StorageKey, StorageValue, H256}; +use zksync_types::{api::state_override::StateOverride, StorageKey, StorageValue, H256}; -use crate::{ReadStorage, WriteStorage}; +use crate::{OverrideStorage, ReadStorage, WriteStorage}; /// Metrics for [`StorageView`]. #[derive(Debug, Default, Clone, Copy)] @@ -224,6 +224,12 @@ impl WriteStorage for StorageView { } } +impl OverrideStorage for StorageView { + fn apply_state_override(&mut self, state_override: &StateOverride) { + self.storage_handle.apply_state_override(state_override); + } +} + #[cfg(test)] mod test { use zksync_types::{AccountTreeId, Address, H256}; diff --git a/core/lib/types/src/api/mod.rs b/core/lib/types/src/api/mod.rs index a0039ba05672..751de9bd7040 100644 --- a/core/lib/types/src/api/mod.rs +++ b/core/lib/types/src/api/mod.rs @@ -18,6 +18,7 @@ use crate::{ }; pub mod en; +pub mod state_override; /// Block Number #[derive(Copy, Clone, Debug, PartialEq, Display)] diff --git a/core/lib/types/src/api/state_override.rs b/core/lib/types/src/api/state_override.rs new file mode 100644 index 000000000000..5c2395ae4bf2 --- /dev/null +++ b/core/lib/types/src/api/state_override.rs @@ -0,0 +1,70 @@ +use std::{collections::HashMap, ops::Deref}; + +use serde::{Deserialize, Deserializer, Serialize}; +use zksync_basic_types::{web3::Bytes, H256, U256}; + +use crate::Address; + +/// Collection of overridden accounts +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct StateOverride(HashMap); + +/// Account override for `eth_estimateGas`. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct OverrideAccount { + pub balance: Option, + pub nonce: Option, + pub code: Option, + #[serde(flatten, deserialize_with = "state_deserializer")] + pub state: Option, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub enum OverrideState { + State(HashMap), + StateDiff(HashMap), +} + +fn state_deserializer<'de, D>(deserializer: D) -> Result, D::Error> +where + D: Deserializer<'de>, +{ + let val = serde_json::Value::deserialize(deserializer)?; + let state: Option> = match val.get("state") { + Some(val) => serde_json::from_value(val.clone()).map_err(serde::de::Error::custom)?, + None => None, + }; + let state_diff: Option> = match val.get("stateDiff") { + Some(val) => serde_json::from_value(val.clone()).map_err(serde::de::Error::custom)?, + None => None, + }; + + match (state, state_diff) { + (Some(state), None) => Ok(Some(OverrideState::State(state))), + (None, Some(state_diff)) => Ok(Some(OverrideState::StateDiff(state_diff))), + (None, None) => Ok(None), + _ => Err(serde::de::Error::custom( + "Both 'state' and 'stateDiff' cannot be set simultaneously", + )), + } +} + +impl StateOverride { + pub fn new(state: HashMap) -> Self { + Self(state) + } + + pub fn get(&self, address: &Address) -> Option<&OverrideAccount> { + self.0.get(address) + } +} + +impl Deref for StateOverride { + type Target = HashMap; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} diff --git a/core/lib/types/src/transaction_request.rs b/core/lib/types/src/transaction_request.rs index a59b21409cd1..887dfcbff378 100644 --- a/core/lib/types/src/transaction_request.rs +++ b/core/lib/types/src/transaction_request.rs @@ -400,7 +400,9 @@ impl TransactionRequest { } // returns packed eth signature if it is present - fn get_packed_signature(&self) -> Result { + pub fn get_packed_signature( + &self, + ) -> Result { let packed_v = self .v .ok_or(SerializationTransactionError::IncompleteSignature)? diff --git a/core/lib/vlog/Cargo.toml b/core/lib/vlog/Cargo.toml index 17f0e88b8c84..eb1ed735519c 100644 --- a/core/lib/vlog/Cargo.toml +++ b/core/lib/vlog/Cargo.toml @@ -9,7 +9,6 @@ repository.workspace = true license.workspace = true keywords.workspace = true categories.workspace = true -publish = false [dependencies] anyhow.workspace = true diff --git a/core/lib/vm_utils/src/lib.rs b/core/lib/vm_utils/src/lib.rs index 9cec0e13be8b..b970d1a8c6b3 100644 --- a/core/lib/vm_utils/src/lib.rs +++ b/core/lib/vm_utils/src/lib.rs @@ -8,14 +8,14 @@ use zksync_multivm::{ vm_latest::HistoryEnabled, VmInstance, }; -use zksync_state::{PostgresStorage, StoragePtr, StorageView, WriteStorage}; +use zksync_state::{PostgresStorage, StorageOverrides, StoragePtr, StorageView, WriteStorage}; use zksync_types::{L1BatchNumber, L2ChainId, Transaction}; use crate::storage::L1BatchParamsProvider; pub type VmAndStorage<'a> = ( - VmInstance>, HistoryEnabled>, - StoragePtr>>, + VmInstance>>, HistoryEnabled>, + StoragePtr>>>, ); pub fn create_vm( @@ -52,7 +52,8 @@ pub fn create_vm( let storage_l2_block_number = first_l2_block_in_batch.number() - 1; let pg_storage = PostgresStorage::new(rt_handle.clone(), connection, storage_l2_block_number, true); - let storage_view = StorageView::new(pg_storage).to_rc_ptr(); + let storage_overrides = StorageOverrides::new(pg_storage); + let storage_view = StorageView::new(storage_overrides).to_rc_ptr(); let vm = VmInstance::new(l1_batch_env, system_env, storage_view.clone()); Ok((vm, storage_view)) diff --git a/core/lib/web3_decl/src/namespaces/eth.rs b/core/lib/web3_decl/src/namespaces/eth.rs index b0e311d339bc..10443443958b 100644 --- a/core/lib/web3_decl/src/namespaces/eth.rs +++ b/core/lib/web3_decl/src/namespaces/eth.rs @@ -2,7 +2,10 @@ use jsonrpsee::core::RpcResult; use jsonrpsee::proc_macros::rpc; use zksync_types::{ - api::{BlockId, BlockIdVariant, BlockNumber, Transaction, TransactionVariant}, + api::{ + state_override::StateOverride, BlockId, BlockIdVariant, BlockNumber, Transaction, + TransactionVariant, + }, transaction_request::CallRequest, Address, H256, }; @@ -31,10 +34,20 @@ pub trait EthNamespace { async fn chain_id(&self) -> RpcResult; #[method(name = "call")] - async fn call(&self, req: CallRequest, block: Option) -> RpcResult; + async fn call( + &self, + req: CallRequest, + block: Option, + state_override: Option, + ) -> RpcResult; #[method(name = "estimateGas")] - async fn estimate_gas(&self, req: CallRequest, _block: Option) -> RpcResult; + async fn estimate_gas( + &self, + req: CallRequest, + _block: Option, + state_override: Option, + ) -> RpcResult; #[method(name = "gasPrice")] async fn gas_price(&self) -> RpcResult; diff --git a/core/lib/web3_decl/src/namespaces/zks.rs b/core/lib/web3_decl/src/namespaces/zks.rs index b6861a9d2dd7..6f443dbded6a 100644 --- a/core/lib/web3_decl/src/namespaces/zks.rs +++ b/core/lib/web3_decl/src/namespaces/zks.rs @@ -5,8 +5,8 @@ use jsonrpsee::core::RpcResult; use jsonrpsee::proc_macros::rpc; use zksync_types::{ api::{ - BlockDetails, BridgeAddresses, L1BatchDetails, L2ToL1LogProof, Proof, ProtocolVersion, - TransactionDetailedResult, TransactionDetails, + state_override::StateOverride, BlockDetails, BridgeAddresses, L1BatchDetails, + L2ToL1LogProof, Proof, ProtocolVersion, TransactionDetailedResult, TransactionDetails, }, fee::Fee, fee_model::{FeeParams, PubdataIndependentBatchFeeModelInput}, @@ -29,10 +29,18 @@ use crate::{ )] pub trait ZksNamespace { #[method(name = "estimateFee")] - async fn estimate_fee(&self, req: CallRequest) -> RpcResult; + async fn estimate_fee( + &self, + req: CallRequest, + state_override: Option, + ) -> RpcResult; #[method(name = "estimateGasL1ToL2")] - async fn estimate_gas_l1_to_l2(&self, req: CallRequest) -> RpcResult; + async fn estimate_gas_l1_to_l2( + &self, + req: CallRequest, + state_override: Option, + ) -> RpcResult; #[method(name = "getBridgehubContract")] async fn get_bridgehub_contract(&self) -> RpcResult>; diff --git a/core/lib/zksync_core_leftovers/src/temp_config_store/mod.rs b/core/lib/zksync_core_leftovers/src/temp_config_store/mod.rs index f1761e8ff8f9..1ad688ed14cb 100644 --- a/core/lib/zksync_core_leftovers/src/temp_config_store/mod.rs +++ b/core/lib/zksync_core_leftovers/src/temp_config_store/mod.rs @@ -111,6 +111,7 @@ impl TempConfigStore { snapshot_recovery: self.snapshot_recovery.clone(), pruning: self.pruning.clone(), external_price_api_client_config: self.external_price_api_client_config.clone(), + consensus_config: None, } } diff --git a/core/node/api_server/src/execution_sandbox/apply.rs b/core/node/api_server/src/execution_sandbox/apply.rs index 0d607311a445..c30e5bc36c86 100644 --- a/core/node/api_server/src/execution_sandbox/apply.rs +++ b/core/node/api_server/src/execution_sandbox/apply.rs @@ -17,13 +17,16 @@ use zksync_multivm::{ vm_latest::{constants::BATCH_COMPUTATIONAL_GAS_LIMIT, HistoryDisabled}, VmInstance, }; -use zksync_state::{PostgresStorage, ReadStorage, StoragePtr, StorageView, WriteStorage}; +use zksync_state::{ + OverrideStorage, PostgresStorage, ReadStorage, StorageOverrides, StoragePtr, StorageView, + WriteStorage, +}; use zksync_system_constants::{ SYSTEM_CONTEXT_ADDRESS, SYSTEM_CONTEXT_CURRENT_L2_BLOCK_INFO_POSITION, SYSTEM_CONTEXT_CURRENT_TX_ROLLING_HASH_POSITION, ZKPORTER_IS_AVAILABLE, }; use zksync_types::{ - api, + api::{self, state_override::StateOverride}, block::{pack_block_info, unpack_block_info, L2BlockHasher}, fee_model::BatchFeeInput, get_nonce_key, @@ -38,7 +41,8 @@ use super::{ BlockArgs, TxExecutionArgs, TxSharedArgs, VmPermit, }; -type BoxedVm<'a> = Box>, HistoryDisabled>>; +type BoxedVm<'a> = + Box>>, HistoryDisabled>>; #[derive(Debug)] struct Sandbox<'a> { @@ -46,7 +50,7 @@ struct Sandbox<'a> { l1_batch_env: L1BatchEnv, execution_args: &'a TxExecutionArgs, l2_block_info_to_reset: Option, - storage_view: StorageView>, + storage_view: StorageView>>, } impl<'a> Sandbox<'a> { @@ -90,7 +94,9 @@ impl<'a> Sandbox<'a> { .context("cannot create `PostgresStorage`")? .with_caches(shared_args.caches.clone()); - let storage_view = StorageView::new(storage); + let storage_overrides = StorageOverrides::new(storage); + + let storage_view = StorageView::new(storage_overrides); let (system_env, l1_batch_env) = Self::prepare_env( shared_args, execution_args, @@ -259,7 +265,16 @@ impl<'a> Sandbox<'a> { mut self, tx: &Transaction, adjust_pubdata_price: bool, - ) -> (BoxedVm<'a>, StoragePtr>>) { + state_override: Option, + ) -> ( + BoxedVm<'a>, + StoragePtr>>>, + ) { + // Apply state override + if let Some(state_override) = state_override { + // Apply the state override + self.storage_view.apply_state_override(&state_override); + } self.setup_storage_view(tx); let protocol_version = self.system_env.version; if adjust_pubdata_price { @@ -294,9 +309,10 @@ pub(super) fn apply_vm_in_sandbox( execution_args: &TxExecutionArgs, connection_pool: &ConnectionPool, tx: Transaction, - block_args: BlockArgs, + block_args: BlockArgs, // Block arguments for the transaction. + state_override: Option, apply: impl FnOnce( - &mut VmInstance>, HistoryDisabled>, + &mut VmInstance>>, HistoryDisabled>, Transaction, ProtocolVersionId, ) -> T, @@ -321,7 +337,7 @@ pub(super) fn apply_vm_in_sandbox( block_args, ))?; let protocol_version = sandbox.system_env.version; - let (mut vm, storage_view) = sandbox.into_vm(&tx, adjust_pubdata_price); + let (mut vm, storage_view) = sandbox.into_vm(&tx, adjust_pubdata_price, state_override); SANDBOX_METRICS.sandbox[&SandboxStage::Initialization].observe(stage_started_at.elapsed()); span.exit(); @@ -331,6 +347,7 @@ pub(super) fn apply_vm_in_sandbox( tx.initiator_account(), tx.nonce().unwrap_or(Nonce(0)) ); + let execution_latency = SANDBOX_METRICS.sandbox[&SandboxStage::Execution].start(); let result = apply(&mut vm, tx, protocol_version); let vm_execution_took = execution_latency.observe(); diff --git a/core/node/api_server/src/execution_sandbox/execute.rs b/core/node/api_server/src/execution_sandbox/execute.rs index d15cf7a91439..f633b133ab00 100644 --- a/core/node/api_server/src/execution_sandbox/execute.rs +++ b/core/node/api_server/src/execution_sandbox/execute.rs @@ -17,6 +17,7 @@ use super::{ apply, testonly::MockTransactionExecutor, vm_metrics, ApiTracer, BlockArgs, TxSharedArgs, VmPermit, }; +use crate::execution_sandbox::api::state_override::StateOverride; #[derive(Debug)] pub(crate) struct TxExecutionArgs { @@ -111,6 +112,7 @@ impl TransactionExecutor { connection_pool: ConnectionPool, tx: Transaction, block_args: BlockArgs, + state_override: Option, custom_tracers: Vec, ) -> anyhow::Result { if let Self::Mock(mock_executor) = self { @@ -129,6 +131,7 @@ impl TransactionExecutor { &connection_pool, tx, block_args, + state_override, |vm, tx, _| { let storage_invocation_tracer = StorageInvocations::new(execution_args.missed_storage_invocation_limit); @@ -170,6 +173,7 @@ impl TransactionExecutor { block_args: BlockArgs, vm_execution_cache_misses_limit: Option, custom_tracers: Vec, + state_override: Option, ) -> anyhow::Result { let execution_args = TxExecutionArgs::for_eth_call( call_overrides.enforced_base_fee, @@ -189,6 +193,7 @@ impl TransactionExecutor { connection_pool, tx.into(), block_args, + state_override, custom_tracers, ) .await?; diff --git a/core/node/api_server/src/execution_sandbox/tests.rs b/core/node/api_server/src/execution_sandbox/tests.rs index e479066cacc2..0a8af35597b3 100644 --- a/core/node/api_server/src/execution_sandbox/tests.rs +++ b/core/node/api_server/src/execution_sandbox/tests.rs @@ -195,6 +195,7 @@ async fn test_instantiating_vm(pool: ConnectionPool, block_args: BlockArgs &pool, transaction.clone(), block_args, + None, |_, received_tx, _| { assert_eq!(received_tx, transaction); }, diff --git a/core/node/api_server/src/execution_sandbox/validate.rs b/core/node/api_server/src/execution_sandbox/validate.rs index 958fbc8a0742..5e958cada66e 100644 --- a/core/node/api_server/src/execution_sandbox/validate.rs +++ b/core/node/api_server/src/execution_sandbox/validate.rs @@ -72,6 +72,7 @@ impl TransactionExecutor { &connection_pool, tx, block_args, + None, |vm, tx, protocol_version| { let stage_latency = SANDBOX_METRICS.sandbox[&SandboxStage::Validation].start(); let span = tracing::debug_span!("validation").entered(); diff --git a/core/node/api_server/src/tx_sender/mod.rs b/core/node/api_server/src/tx_sender/mod.rs index 50b0be541bf0..15f9271d6428 100644 --- a/core/node/api_server/src/tx_sender/mod.rs +++ b/core/node/api_server/src/tx_sender/mod.rs @@ -24,6 +24,7 @@ use zksync_state_keeper::{ SequencerSealer, }; use zksync_types::{ + api::state_override::StateOverride, fee::{Fee, TransactionExecutionMetrics}, fee_model::BatchFeeInput, get_code_key, get_intrinsic_constants, @@ -385,6 +386,7 @@ impl TxSender { self.0.replica_connection_pool.clone(), tx.clone().into(), block_args, + None, vec![], ) .await?; @@ -656,6 +658,7 @@ impl TxSender { block_args: BlockArgs, base_fee: u64, vm_version: VmVersion, + state_override: Option, ) -> anyhow::Result<(VmExecutionResultAndLogs, TransactionExecutionMetrics)> { let gas_limit_with_overhead = tx_gas_limit + derive_overhead( @@ -703,6 +706,7 @@ impl TxSender { self.0.replica_connection_pool.clone(), tx.clone(), block_args, + state_override, vec![], ) .await?; @@ -733,6 +737,7 @@ impl TxSender { mut tx: Transaction, estimated_fee_scale_factor: f64, acceptable_overestimation: u64, + state_override: Option, ) -> Result { let estimation_started_at = Instant::now(); @@ -786,17 +791,25 @@ impl TxSender { ) })?; - if !tx.is_l1() - && account_code_hash == H256::zero() - && tx.execute.value > self.get_balance(&tx.initiator_account()).await? - { - tracing::info!( - "fee estimation failed on validation step. - account: {} does not have enough funds for for transferring tx.value: {}.", - &tx.initiator_account(), - tx.execute.value - ); - return Err(SubmitTxError::InsufficientFundsForTransfer); + if !tx.is_l1() && account_code_hash == H256::zero() { + let balance = match state_override + .as_ref() + .and_then(|overrides| overrides.get(&tx.initiator_account())) + .and_then(|account| account.balance) + { + Some(balance) => balance.to_owned(), + None => self.get_balance(&tx.initiator_account()).await?, + }; + + if tx.execute.value > balance { + tracing::info!( + "fee estimation failed on validation step. + account: {} does not have enough funds for for transferring tx.value: {}.", + &tx.initiator_account(), + tx.execute.value + ); + return Err(SubmitTxError::InsufficientFundsForTransfer); + } } // For L2 transactions we need a properly formatted signature @@ -836,6 +849,7 @@ impl TxSender { block_args, base_fee, protocol_version.into(), + state_override.clone(), ) .await .context("estimate_gas step failed")?; @@ -871,6 +885,7 @@ impl TxSender { block_args, base_fee, protocol_version.into(), + state_override.clone(), ) .await .context("estimate_gas step failed")?; @@ -903,6 +918,7 @@ impl TxSender { block_args, base_fee, protocol_version.into(), + state_override, ) .await .context("final estimate_gas step failed")?; @@ -973,6 +989,7 @@ impl TxSender { block_args: BlockArgs, call_overrides: CallOverrides, tx: L2Tx, + state_override: Option, ) -> Result, SubmitTxError> { let vm_permit = self.0.vm_concurrency_limiter.acquire().await; let vm_permit = vm_permit.ok_or(SubmitTxError::ServerShuttingDown)?; @@ -989,6 +1006,7 @@ impl TxSender { block_args, vm_execution_cache_misses_limit, vec![], + state_override, ) .await? .into_api_call_result() diff --git a/core/node/api_server/src/web3/backend_jsonrpsee/namespaces/eth.rs b/core/node/api_server/src/web3/backend_jsonrpsee/namespaces/eth.rs index c4a16b132421..ff8ce0356a05 100644 --- a/core/node/api_server/src/web3/backend_jsonrpsee/namespaces/eth.rs +++ b/core/node/api_server/src/web3/backend_jsonrpsee/namespaces/eth.rs @@ -1,7 +1,7 @@ use zksync_types::{ api::{ - Block, BlockId, BlockIdVariant, BlockNumber, Log, Transaction, TransactionId, - TransactionReceipt, TransactionVariant, + state_override::StateOverride, Block, BlockId, BlockIdVariant, BlockNumber, Log, + Transaction, TransactionId, TransactionReceipt, TransactionVariant, }, transaction_request::CallRequest, web3::{Bytes, FeeHistory, Index, SyncState}, @@ -27,14 +27,24 @@ impl EthNamespaceServer for EthNamespace { Ok(self.chain_id_impl()) } - async fn call(&self, req: CallRequest, block: Option) -> RpcResult { - self.call_impl(req, block.map(Into::into)) + async fn call( + &self, + req: CallRequest, + block: Option, + state_override: Option, + ) -> RpcResult { + self.call_impl(req, block.map(Into::into), state_override) .await .map_err(|err| self.current_method().map_err(err)) } - async fn estimate_gas(&self, req: CallRequest, block: Option) -> RpcResult { - self.estimate_gas_impl(req, block) + async fn estimate_gas( + &self, + req: CallRequest, + block: Option, + state_override: Option, + ) -> RpcResult { + self.estimate_gas_impl(req, block, state_override) .await .map_err(|err| self.current_method().map_err(err)) } diff --git a/core/node/api_server/src/web3/backend_jsonrpsee/namespaces/zks.rs b/core/node/api_server/src/web3/backend_jsonrpsee/namespaces/zks.rs index 45cb312dde6e..16bbde13509f 100644 --- a/core/node/api_server/src/web3/backend_jsonrpsee/namespaces/zks.rs +++ b/core/node/api_server/src/web3/backend_jsonrpsee/namespaces/zks.rs @@ -3,8 +3,9 @@ use std::collections::HashMap; use itertools::Itertools; use zksync_types::{ api::{ - ApiStorageLog, BlockDetails, BridgeAddresses, L1BatchDetails, L2ToL1LogProof, Log, Proof, - ProtocolVersion, TransactionDetailedResult, TransactionDetails, + state_override::StateOverride, ApiStorageLog, BlockDetails, BridgeAddresses, + L1BatchDetails, L2ToL1LogProof, Log, Proof, ProtocolVersion, TransactionDetailedResult, + TransactionDetails, }, fee::Fee, fee_model::{FeeParams, PubdataIndependentBatchFeeModelInput}, @@ -22,14 +23,22 @@ use crate::web3::ZksNamespace; #[async_trait] impl ZksNamespaceServer for ZksNamespace { - async fn estimate_fee(&self, req: CallRequest) -> RpcResult { - self.estimate_fee_impl(req) + async fn estimate_fee( + &self, + req: CallRequest, + state_override: Option, + ) -> RpcResult { + self.estimate_fee_impl(req, state_override) .await .map_err(|err| self.current_method().map_err(err)) } - async fn estimate_gas_l1_to_l2(&self, req: CallRequest) -> RpcResult { - self.estimate_l1_to_l2_gas_impl(req) + async fn estimate_gas_l1_to_l2( + &self, + req: CallRequest, + state_override: Option, + ) -> RpcResult { + self.estimate_l1_to_l2_gas_impl(req, state_override) .await .map_err(|err| self.current_method().map_err(err)) } diff --git a/core/node/api_server/src/web3/namespaces/debug.rs b/core/node/api_server/src/web3/namespaces/debug.rs index a2e6e2782ac5..2f2d1d44cba1 100644 --- a/core/node/api_server/src/web3/namespaces/debug.rs +++ b/core/node/api_server/src/web3/namespaces/debug.rs @@ -197,6 +197,7 @@ impl DebugNamespace { block_args, self.sender_config().vm_execution_cache_misses_limit, custom_tracers, + None, ) .await?; diff --git a/core/node/api_server/src/web3/namespaces/eth.rs b/core/node/api_server/src/web3/namespaces/eth.rs index 7b4710d1cd4a..68030763fd60 100644 --- a/core/node/api_server/src/web3/namespaces/eth.rs +++ b/core/node/api_server/src/web3/namespaces/eth.rs @@ -3,8 +3,8 @@ use zksync_dal::{CoreDal, DalError}; use zksync_system_constants::DEFAULT_L2_TX_GAS_PER_PUBDATA_BYTE; use zksync_types::{ api::{ - BlockId, BlockNumber, GetLogsFilter, Transaction, TransactionId, TransactionReceipt, - TransactionVariant, + state_override::StateOverride, BlockId, BlockNumber, GetLogsFilter, Transaction, + TransactionId, TransactionReceipt, TransactionVariant, }, l2::{L2Tx, TransactionType}, transaction_request::CallRequest, @@ -55,6 +55,7 @@ impl EthNamespace { &self, mut request: CallRequest, block_id: Option, + state_override: Option, ) -> Result { let block_id = block_id.unwrap_or(BlockId::Number(BlockNumber::Pending)); self.current_method().set_block_id(block_id); @@ -88,7 +89,7 @@ impl EthNamespace { let call_result: Vec = self .state .tx_sender - .eth_call(block_args, call_overrides, tx) + .eth_call(block_args, call_overrides, tx, state_override) .await?; Ok(call_result.into()) } @@ -97,6 +98,7 @@ impl EthNamespace { &self, request: CallRequest, _block: Option, + state_override: Option, ) -> Result { let mut request_with_gas_per_pubdata_overridden = request; self.state @@ -138,7 +140,12 @@ impl EthNamespace { let fee = self .state .tx_sender - .get_txs_fee_in_wei(tx.into(), scale_factor, acceptable_overestimation as u64) + .get_txs_fee_in_wei( + tx.into(), + scale_factor, + acceptable_overestimation as u64, + state_override, + ) .await?; Ok(fee.gas_limit) } diff --git a/core/node/api_server/src/web3/namespaces/zks.rs b/core/node/api_server/src/web3/namespaces/zks.rs index 2b3fbbcd55ca..4f88eb17e231 100644 --- a/core/node/api_server/src/web3/namespaces/zks.rs +++ b/core/node/api_server/src/web3/namespaces/zks.rs @@ -8,8 +8,8 @@ use zksync_multivm::interface::VmExecutionResultAndLogs; use zksync_system_constants::DEFAULT_L2_TX_GAS_PER_PUBDATA_BYTE; use zksync_types::{ api::{ - BlockDetails, BridgeAddresses, GetLogsFilter, L1BatchDetails, L2ToL1LogProof, Proof, - ProtocolVersion, StorageProof, TransactionDetails, + state_override::StateOverride, BlockDetails, BridgeAddresses, GetLogsFilter, + L1BatchDetails, L2ToL1LogProof, Proof, ProtocolVersion, StorageProof, TransactionDetails, }, fee::Fee, fee_model::{FeeParams, PubdataIndependentBatchFeeModelInput}, @@ -48,7 +48,11 @@ impl ZksNamespace { &self.state.current_method } - pub async fn estimate_fee_impl(&self, request: CallRequest) -> Result { + pub async fn estimate_fee_impl( + &self, + request: CallRequest, + state_override: Option, + ) -> Result { let mut request_with_gas_per_pubdata_overridden = request; self.state .set_nonce_for_call_request(&mut request_with_gas_per_pubdata_overridden) @@ -67,12 +71,13 @@ impl ZksNamespace { // not consider provided ones. tx.common_data.fee.max_priority_fee_per_gas = 0u64.into(); tx.common_data.fee.gas_per_pubdata_limit = U256::from(DEFAULT_L2_TX_GAS_PER_PUBDATA_BYTE); - self.estimate_fee(tx.into()).await + self.estimate_fee(tx.into(), state_override).await } pub async fn estimate_l1_to_l2_gas_impl( &self, request: CallRequest, + state_override: Option, ) -> Result { let mut request_with_gas_per_pubdata_overridden = request; // When we're estimating fee, we are trying to deduce values related to fee, so we should @@ -87,11 +92,15 @@ impl ZksNamespace { .try_into() .map_err(Web3Error::SerializationError)?; - let fee = self.estimate_fee(tx.into()).await?; + let fee = self.estimate_fee(tx.into(), state_override).await?; Ok(fee.gas_limit) } - async fn estimate_fee(&self, tx: Transaction) -> Result { + async fn estimate_fee( + &self, + tx: Transaction, + state_override: Option, + ) -> Result { let scale_factor = self.state.api_config.estimate_gas_scale_factor; let acceptable_overestimation = self.state.api_config.estimate_gas_acceptable_overestimation; @@ -99,7 +108,12 @@ impl ZksNamespace { Ok(self .state .tx_sender - .get_txs_fee_in_wei(tx, scale_factor, acceptable_overestimation as u64) + .get_txs_fee_in_wei( + tx, + scale_factor, + acceptable_overestimation as u64, + state_override, + ) .await?) } diff --git a/core/node/api_server/src/web3/tests/vm.rs b/core/node/api_server/src/web3/tests/vm.rs index 1bce1b732b13..61c24bcf9001 100644 --- a/core/node/api_server/src/web3/tests/vm.rs +++ b/core/node/api_server/src/web3/tests/vm.rs @@ -2,6 +2,7 @@ use std::sync::atomic::{AtomicU32, Ordering}; +use api::state_override::{OverrideAccount, StateOverride}; use itertools::Itertools; use zksync_multivm::{ interface::{ExecutionResult, VmRevertReason}, @@ -63,7 +64,9 @@ impl HttpTest for CallTest { client: &DynClient, _pool: &ConnectionPool, ) -> anyhow::Result<()> { - let call_result = client.call(Self::call_request(b"pending"), None).await?; + let call_result = client + .call(Self::call_request(b"pending"), None, None) + .await?; assert_eq!(call_result.0, b"output"); let valid_block_numbers_and_calldata = [ @@ -74,7 +77,7 @@ impl HttpTest for CallTest { for (number, calldata) in valid_block_numbers_and_calldata { let number = api::BlockIdVariant::BlockNumber(number); let call_result = client - .call(Self::call_request(calldata), Some(number)) + .call(Self::call_request(calldata), Some(number), None) .await?; assert_eq!(call_result.0, b"output"); } @@ -82,7 +85,7 @@ impl HttpTest for CallTest { let invalid_block_number = api::BlockNumber::from(100); let number = api::BlockIdVariant::BlockNumber(invalid_block_number); let error = client - .call(Self::call_request(b"100"), Some(number)) + .call(Self::call_request(b"100"), Some(number), None) .await .unwrap_err(); if let ClientError::Call(error) = error { @@ -120,7 +123,7 @@ impl HttpTest for CallTestAfterSnapshotRecovery { _pool: &ConnectionPool, ) -> anyhow::Result<()> { let call_result = client - .call(CallTest::call_request(b"pending"), None) + .call(CallTest::call_request(b"pending"), None, None) .await?; assert_eq!(call_result.0, b"output"); let pending_block_number = api::BlockIdVariant::BlockNumber(api::BlockNumber::Pending); @@ -128,6 +131,7 @@ impl HttpTest for CallTestAfterSnapshotRecovery { .call( CallTest::call_request(b"pending"), Some(pending_block_number), + None, ) .await?; assert_eq!(call_result.0, b"output"); @@ -137,7 +141,7 @@ impl HttpTest for CallTestAfterSnapshotRecovery { for number in pruned_block_numbers { let number = api::BlockIdVariant::BlockNumber(number.into()); let error = client - .call(CallTest::call_request(b"pruned"), Some(number)) + .call(CallTest::call_request(b"pruned"), Some(number), None) .await .unwrap_err(); assert_pruned_block_error(&error, first_local_l2_block); @@ -147,7 +151,7 @@ impl HttpTest for CallTestAfterSnapshotRecovery { for number in first_l2_block_numbers { let number = api::BlockIdVariant::BlockNumber(number); let call_result = client - .call(CallTest::call_request(b"first"), Some(number)) + .call(CallTest::call_request(b"first"), Some(number), None) .await?; assert_eq!(call_result.0, b"output"); } @@ -499,7 +503,7 @@ impl HttpTest for TraceCallTestAfterSnapshotRecovery { for number in pruned_block_numbers { let number = api::BlockIdVariant::BlockNumber(number.into()); let error = client - .call(CallTest::call_request(b"pruned"), Some(number)) + .call(CallTest::call_request(b"pruned"), Some(number), None) .await .unwrap_err(); assert_pruned_block_error(&error, first_local_l2_block); @@ -579,7 +583,7 @@ impl HttpTest for EstimateGasTest { for threshold in [10_000, 50_000, 100_000, 1_000_000] { self.gas_limit_threshold.store(threshold, Ordering::Relaxed); let output = client - .estimate_gas(l2_transaction.clone().into(), None) + .estimate_gas(l2_transaction.clone().into(), None, None) .await?; assert!( output >= U256::from(threshold), @@ -604,10 +608,15 @@ impl HttpTest for EstimateGasTest { let mut call_request = CallRequest::from(l2_transaction); call_request.from = Some(SendRawTransactionTest::private_key().address()); call_request.value = Some(1_000_000.into()); - client.estimate_gas(call_request.clone(), None).await?; + client + .estimate_gas(call_request.clone(), None, None) + .await?; call_request.value = Some(U256::max_value()); - let error = client.estimate_gas(call_request, None).await.unwrap_err(); + let error = client + .estimate_gas(call_request, None, None) + .await + .unwrap_err(); if let ClientError::Call(error) = error { let error_msg = error.message(); assert!( @@ -630,3 +639,108 @@ async fn estimate_gas_basics() { async fn estimate_gas_after_snapshot_recovery() { test_http_server(EstimateGasTest::new(true)).await; } + +#[derive(Debug)] +struct EstimateGasWithStateOverrideTest { + gas_limit_threshold: Arc, + snapshot_recovery: bool, +} + +impl EstimateGasWithStateOverrideTest { + fn new(snapshot_recovery: bool) -> Self { + Self { + gas_limit_threshold: Arc::default(), + snapshot_recovery, + } + } +} + +#[async_trait] +impl HttpTest for EstimateGasWithStateOverrideTest { + fn storage_initialization(&self) -> StorageInitialization { + let snapshot_recovery = self.snapshot_recovery; + SendRawTransactionTest { snapshot_recovery }.storage_initialization() + } + + fn transaction_executor(&self) -> MockTransactionExecutor { + let mut tx_executor = MockTransactionExecutor::default(); + let pending_block_number = if self.snapshot_recovery { + StorageInitialization::SNAPSHOT_RECOVERY_BLOCK + 2 + } else { + L2BlockNumber(1) + }; + let gas_limit_threshold = self.gas_limit_threshold.clone(); + tx_executor.set_call_responses(move |tx, block_args| { + assert_eq!(tx.execute.calldata(), [] as [u8; 0]); + assert_eq!(tx.nonce(), Some(Nonce(0))); + assert_eq!(block_args.resolved_block_number(), pending_block_number); + + let gas_limit_threshold = gas_limit_threshold.load(Ordering::SeqCst); + if tx.gas_limit() >= U256::from(gas_limit_threshold) { + ExecutionResult::Success { output: vec![] } + } else { + ExecutionResult::Revert { + output: VmRevertReason::VmError, + } + } + }); + tx_executor + } + + async fn test( + &self, + client: &DynClient, + _pool: &ConnectionPool, + ) -> anyhow::Result<()> { + // Transaction with balance override + let l2_transaction = create_l2_transaction(10, 100); + let mut call_request = CallRequest::from(l2_transaction); + call_request.from = Some(Address::random()); + call_request.value = Some(1_000_000.into()); + + let mut state_override_map = HashMap::new(); + state_override_map.insert( + call_request.from.unwrap(), + OverrideAccount { + balance: Some(U256::max_value()), + nonce: None, + code: None, + state: None, + }, + ); + let state_override = StateOverride::new(state_override_map); + + client + .estimate_gas(call_request.clone(), None, Some(state_override)) + .await?; + + // Transaction that should fail without balance override + let l2_transaction = create_l2_transaction(10, 100); + let mut call_request = CallRequest::from(l2_transaction); + call_request.from = Some(Address::random()); + call_request.value = Some(1_000_000.into()); + + let error = client + .estimate_gas(call_request.clone(), None, None) + .await + .unwrap_err(); + + if let ClientError::Call(error) = error { + let error_msg = error.message(); + assert!( + error_msg + .to_lowercase() + .contains("insufficient balance for transfer"), + "{error_msg}" + ); + } else { + panic!("Unexpected error: {error:?}"); + } + Ok(()) + } +} + +#[tokio::test] +async fn estimate_gas_with_state_override() { + test_http_server(EstimateGasWithStateOverrideTest::new(false)).await; +} diff --git a/core/node/eth_sender/src/eth_tx_manager.rs b/core/node/eth_sender/src/eth_tx_manager.rs index feac9311a727..d2ee4380d68b 100644 --- a/core/node/eth_sender/src/eth_tx_manager.rs +++ b/core/node/eth_sender/src/eth_tx_manager.rs @@ -586,10 +586,14 @@ impl EthTxManager { .await .unwrap(); - tracing::info!( - "Sending {} {operator_type:?} new transactions", - new_eth_tx.len() - ); + if !new_eth_tx.is_empty() { + tracing::info!( + "Sending {} {operator_type:?} new transactions", + new_eth_tx.len() + ); + } else { + tracing::trace!("No new transactions to send"); + } for tx in new_eth_tx { let result = self.send_eth_tx(storage, &tx, 0, current_block).await; // If one of the transactions doesn't succeed, this means we should return @@ -632,7 +636,7 @@ impl EthTxManager { storage: &mut Connection<'_, Core>, l1_block_numbers: L1BlockNumbers, ) { - tracing::info!("Loop iteration at block {}", l1_block_numbers.latest); + tracing::trace!("Loop iteration at block {}", l1_block_numbers.latest); // We can treat those two operators independently as they have different nonces and // aggregator makes sure that corresponding Commit transaction is confirmed before creating // a PublishProof transaction diff --git a/core/tests/loadnext/src/sdk/operations/deploy_contract.rs b/core/tests/loadnext/src/sdk/operations/deploy_contract.rs index af621249ed8b..3b4c7a5eb53f 100644 --- a/core/tests/loadnext/src/sdk/operations/deploy_contract.rs +++ b/core/tests/loadnext/src/sdk/operations/deploy_contract.rs @@ -155,7 +155,7 @@ where ); self.wallet .provider - .estimate_fee(l2_tx.into()) + .estimate_fee(l2_tx.into(), None) .await .map_err(Into::into) } diff --git a/core/tests/loadnext/src/sdk/operations/execute_contract.rs b/core/tests/loadnext/src/sdk/operations/execute_contract.rs index 18b93008a73a..d5fe57c7b79f 100644 --- a/core/tests/loadnext/src/sdk/operations/execute_contract.rs +++ b/core/tests/loadnext/src/sdk/operations/execute_contract.rs @@ -155,7 +155,7 @@ where ); self.wallet .provider - .estimate_fee(execute.into()) + .estimate_fee(execute.into(), None) .await .map_err(Into::into) } diff --git a/core/tests/loadnext/src/sdk/operations/transfer.rs b/core/tests/loadnext/src/sdk/operations/transfer.rs index 34bab615c7c5..94ee3aeb6082 100644 --- a/core/tests/loadnext/src/sdk/operations/transfer.rs +++ b/core/tests/loadnext/src/sdk/operations/transfer.rs @@ -181,7 +181,7 @@ where }; self.wallet .provider - .estimate_fee(l2_tx.into()) + .estimate_fee(l2_tx.into(), None) .await .map_err(Into::into) } diff --git a/core/tests/loadnext/src/sdk/wallet.rs b/core/tests/loadnext/src/sdk/wallet.rs index c46431f70f48..9d3bd73a9bf2 100644 --- a/core/tests/loadnext/src/sdk/wallet.rs +++ b/core/tests/loadnext/src/sdk/wallet.rs @@ -96,7 +96,7 @@ where }; let bytes = self .provider - .call(req, Some(BlockIdVariant::BlockNumber(block_number))) + .call(req, Some(BlockIdVariant::BlockNumber(block_number)), None) .await?; if bytes.0.len() == 32 { U256::from_big_endian(&bytes.0) diff --git a/core/tests/test_account/Cargo.toml b/core/tests/test_account/Cargo.toml index 6df10edd7dca..0dda4f8ac777 100644 --- a/core/tests/test_account/Cargo.toml +++ b/core/tests/test_account/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "zksync_test_account" -version = "0.1.0" +description = "ZKsync test account for writing unit tests" +version.workspace = true edition.workspace = true authors.workspace = true homepage.workspace = true @@ -8,7 +9,6 @@ repository.workspace = true license.workspace = true keywords.workspace = true categories.workspace = true -publish = false [dependencies] zksync_types.workspace = true diff --git a/core/tests/ts-integration/contracts/state-override/StateOverrideTest.sol b/core/tests/ts-integration/contracts/state-override/StateOverrideTest.sol new file mode 100644 index 000000000000..e8d02737cc15 --- /dev/null +++ b/core/tests/ts-integration/contracts/state-override/StateOverrideTest.sol @@ -0,0 +1,28 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.0; + +pragma solidity ^0.8.0; + +contract StateOverrideTest { + uint256 public someValue; + uint256 public anotherValue; + uint256 public initialValue = 100; + + function setValue(uint256 value) public { + someValue = value; + } + + function setAnotherValue(uint256 value) public { + anotherValue = value; + } + + function increment(uint256 value) public view returns (uint256) { + require(someValue > 0, "Initial state not set"); + return someValue + value; + } + + function sumValues() public view returns (uint256) { + require(someValue > 0 && anotherValue > 0, "Initial state not set"); + return someValue + anotherValue + initialValue; + } +} diff --git a/core/tests/ts-integration/tests/api/web3.test.ts b/core/tests/ts-integration/tests/api/web3.test.ts index 9b334488fcb8..e78ec452b2f5 100644 --- a/core/tests/ts-integration/tests/api/web3.test.ts +++ b/core/tests/ts-integration/tests/api/web3.test.ts @@ -19,7 +19,8 @@ const contracts = { counter: getTestContract('Counter'), events: getTestContract('Emitter'), outer: getTestContract('Outer'), - inner: getTestContract('Inner') + inner: getTestContract('Inner'), + stateOverride: getTestContract('StateOverrideTest') }; describe('web3 API compatibility tests', () => { @@ -679,13 +680,20 @@ describe('web3 API compatibility tests', () => { // There are around `0.5 * maxLogsLimit` logs in [tx1Receipt.blockNumber, tx1Receipt.blockNumber] range, // so query with such filter should succeed. - await expect(alice.provider.getLogs({ fromBlock: tx1Receipt.blockNumber, toBlock: tx1Receipt.blockNumber })) - .resolves; + await expect( + alice.provider.getLogs({ + fromBlock: tx1Receipt.blockNumber, + toBlock: tx1Receipt.blockNumber + }) + ).resolves; // There are at least `1.5 * maxLogsLimit` logs in [tx1Receipt.blockNumber, tx3Receipt.blockNumber] range, // so query with such filter should fail. await expect( - alice.provider.getLogs({ fromBlock: tx1Receipt.blockNumber, toBlock: tx3Receipt.blockNumber }) + alice.provider.getLogs({ + fromBlock: tx1Receipt.blockNumber, + toBlock: tx3Receipt.blockNumber + }) ).rejects.toThrow(`Query returned more than ${maxLogsLimit} results.`); }); @@ -961,6 +969,241 @@ describe('web3 API compatibility tests', () => { expect(txFromApi.signature.v! === 27 || 28); }); + describe('Storage override', () => { + test('Should be able to estimate_gas overriding the balance of the sender', async () => { + const balance = await alice.getBalance(); + const amount = balance + 1n; + + // Expect the transaction to be reverted without the overridden balance + await expect( + alice.provider.estimateGas({ + from: alice.address, + to: alice.address, + value: amount.toString() + }) + ).toBeRejected(); + + // Call estimate_gas overriding the balance of the sender using the eth_estimateGas endpoint + const response = await alice.provider.send('eth_estimateGas', [ + { + from: alice.address, + to: alice.address, + value: amount.toString() + }, + 'latest', + //override with the balance needed to send the transaction + { + [alice.address]: { + balance: amount.toString() + } + } + ]); + + // Assert that the response is successful + expect(response).toEqual(expect.stringMatching(HEX_VALUE_REGEX)); + }); + test('Should be able to estimate_gas overriding contract code', async () => { + // Deploy the first contract + const contract1 = await deployContract(alice, contracts.events, []); + const contract1Address = await contract1.getAddress(); + + // Deploy the second contract to extract the code that we are overriding the estimation with + const contract2 = await deployContract(alice, contracts.counter, []); + const contract2Address = await contract2.getAddress(); + + // Get the code of contract2 + const code = await alice.provider.getCode(contract2Address); + + // Get the calldata of the increment function of contract2 + const incrementFunctionData = contract2.interface.encodeFunctionData('increment', [1]); + + // Assert that the estimation fails because the increment function is not present in contract1 + expect( + alice.provider.estimateGas({ + to: contract1Address.toString(), + data: incrementFunctionData + }) + ).toBeRejected(); + + // Call estimate_gas overriding the code of contract1 with the code of contract2 using the eth_estimateGas endpoint + const response = await alice.provider.send('eth_estimateGas', [ + { + from: alice.address, + to: contract1Address.toString(), + data: incrementFunctionData + }, + 'latest', + { [contract1Address.toString()]: { code: code } } + ]); + + // Assert that the response is successful + expect(response).toEqual(expect.stringMatching(HEX_VALUE_REGEX)); + }); + + test('Should estimate gas by overriding state with State', async () => { + const contract = await deployContract(alice, contracts.stateOverride, []); + const contractAddress = await contract.getAddress(); + + const sumValuesFunctionData = contract.interface.encodeFunctionData('sumValues', []); + + // Ensure that the initial gas estimation fails due to contract requirements + await expect( + alice.provider.estimateGas({ + to: contractAddress.toString(), + data: sumValuesFunctionData + }) + ).toBeRejected(); + + // Override the entire contract state using State + const state = { + [contractAddress.toString()]: { + state: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x0000000000000000000000000000000000000000000000000000000000000001', + '0x0000000000000000000000000000000000000000000000000000000000000001': + '0x0000000000000000000000000000000000000000000000000000000000000002' + } + } + }; + + const response = await alice.provider.send('eth_estimateGas', [ + { + from: alice.address, + to: contractAddress.toString(), + data: sumValuesFunctionData + }, + 'latest', + state + ]); + + expect(response).toEqual(expect.stringMatching(HEX_VALUE_REGEX)); + }); + + test('Should estimate gas by overriding state with StateDiff', async () => { + const contract = await deployContract(alice, contracts.stateOverride, []); + const contractAddress = await contract.getAddress(); + const incrementFunctionData = contract.interface.encodeFunctionData('increment', [1]); + + // Ensure that the initial gas estimation fails due to contract requirements + await expect( + alice.provider.estimateGas({ + to: contractAddress.toString(), + data: incrementFunctionData + }) + ).toBeRejected(); + + // Override the contract state using StateDiff + const stateDiff = { + [contractAddress.toString()]: { + stateDiff: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x0000000000000000000000000000000000000000000000000000000000000001' + } + } + }; + + const response = await alice.provider.send('eth_estimateGas', [ + { + from: alice.address, + to: contractAddress.toString(), + data: incrementFunctionData + }, + 'latest', + stateDiff + ]); + + expect(response).toEqual(expect.stringMatching(HEX_VALUE_REGEX)); + }); + + test('Should call and succeed with overriding state with State', async () => { + const contract = await deployContract(alice, contracts.stateOverride, []); + const contractAddress = await contract.getAddress(); + const sumValuesFunctionData = contract.interface.encodeFunctionData('sumValues', []); + + // Ensure that the initial call fails due to contract requirements + await alice.provider + .call({ + to: contractAddress.toString(), + data: sumValuesFunctionData + }) + .catch((error) => { + const errorString = 'Initial state not set'; + expect(error.message).toContain(errorString); + }); + + // Override the contract state using State + const state = { + [contractAddress.toString()]: { + state: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x0000000000000000000000000000000000000000000000000000000000000001', + '0x0000000000000000000000000000000000000000000000000000000000000001': + '0x0000000000000000000000000000000000000000000000000000000000000002' + } + } + }; + + const response = await alice.provider.send('eth_call', [ + { + from: alice.address, + to: contractAddress.toString(), + data: sumValuesFunctionData + }, + 'latest', + state + ]); + + // The state replace the entire state of the contract, so the sum now would be + // 1 (0x1) + 2 (0x2) = 3 (0x3) + expect(response).toEqual('0x0000000000000000000000000000000000000000000000000000000000000003'); + }); + + test('Should call and succeed with overriding state with StateDiff', async () => { + const contract = await deployContract(alice, contracts.stateOverride, []); + const contractAddress = await contract.getAddress(); + const sumValuesFunctionData = contract.interface.encodeFunctionData('sumValues', []); + + // Ensure that the initial call fails due to contract requirements + await alice.provider + .call({ + to: contractAddress.toString(), + data: sumValuesFunctionData + }) + .catch((error) => { + const errorString = 'Initial state not set'; + expect(error.message).toContain(errorString); + }); + + // Override the contract state using State + const stateDiff = { + [contractAddress.toString()]: { + stateDiff: { + '0x0000000000000000000000000000000000000000000000000000000000000000': + '0x0000000000000000000000000000000000000000000000000000000000000001', + '0x0000000000000000000000000000000000000000000000000000000000000001': + '0x0000000000000000000000000000000000000000000000000000000000000002' + } + } + }; + + const response = await alice.provider.send('eth_call', [ + { + from: alice.address, + to: contractAddress.toString(), + data: sumValuesFunctionData + }, + 'latest', + stateDiff + ]); + + // The stateDiff only changes the specific slots provided in the override. + // The initial value of the storage slot at key 0x2 remains unchanged, which is 100 (0x64 in hex). + // Therefore, the sum of the values at the three storage slots is: + // 1 (0x1) + 2 (0x2) + 100 (0x64) = 103 (0x67 in hex). + // This is why the expected response is 0x67. + expect(response).toEqual('0x0000000000000000000000000000000000000000000000000000000000000067'); + }); + }); // We want to be sure that correct(outer) contract address is return in the transaction receipt, // when there is a contract that initializa another contract in the constructor test('Should check inner-outer contract address in the receipt of the deploy tx', async () => { diff --git a/deny.toml b/deny.toml index 59265ec085be..1e4a30ad6231 100644 --- a/deny.toml +++ b/deny.toml @@ -6,9 +6,7 @@ vulnerability = "deny" unmaintained = "warn" yanked = "warn" notice = "warn" -ignore = [ - "RUSTSEC-2023-0018", -] +ignore = [] [licenses] unlicensed = "deny" @@ -30,7 +28,7 @@ allow-osi-fsf-free = "neither" default = "deny" confidence-threshold = 0.8 exceptions = [ - { name = "ring", allow = ["OpenSSL"] }, + { name = "ring", allow = ["OpenSSL"] }, ] unused-allowed-license = "allow" diff --git a/docker/local-node/Dockerfile b/docker/local-node/Dockerfile index c0592f89d563..2e6b09ef3d10 100644 --- a/docker/local-node/Dockerfile +++ b/docker/local-node/Dockerfile @@ -64,7 +64,7 @@ COPY package.json / # Copy DAL - needed to setup database schemas. COPY core/lib/dal core/lib/dal -COPY prover/prover_dal prover/prover_dal +COPY prover/crates/lib/prover_dal prover/crates/lib/prover_dal RUN mkdir /etc/env/l1-inits && mkdir /etc/env/l2-inits diff --git a/docker/proof-fri-compressor/Dockerfile b/docker/proof-fri-compressor/Dockerfile index afa8477dcf72..2cf131abb4b8 100644 --- a/docker/proof-fri-compressor/Dockerfile +++ b/docker/proof-fri-compressor/Dockerfile @@ -14,7 +14,7 @@ FROM debian:bookworm-slim RUN apt-get update && apt-get install -y curl libpq5 ca-certificates && rm -rf /var/lib/apt/lists/* # copy VK required for proof wrapping -COPY prover/vk_setup_data_generator_server_fri/data/ /prover/vk_setup_data_generator_server_fri/data/ +COPY prover/crates/bin/vk_setup_data_generator_server_fri/data/ /prover/crates/bin/vk_setup_data_generator_server_fri/data/ # copy universal setup key required for proof compression COPY setup_2\^26.key /setup_2\^26.key diff --git a/docker/proof-fri-gpu-compressor/Dockerfile b/docker/proof-fri-gpu-compressor/Dockerfile index 8249f123081b..e6d2e0f11627 100644 --- a/docker/proof-fri-gpu-compressor/Dockerfile +++ b/docker/proof-fri-gpu-compressor/Dockerfile @@ -37,7 +37,7 @@ FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04 RUN apt-get update && apt-get install -y curl libpq5 ca-certificates && rm -rf /var/lib/apt/lists/* # copy VK required for proof wrapping -COPY prover/vk_setup_data_generator_server_fri/data/ /prover/vk_setup_data_generator_server_fri/data/ +COPY prover/crates/bin/vk_setup_data_generator_server_fri/data/ /prover/crates/bin/vk_setup_data_generator_server_fri/data/ COPY setup_2\^24.key /setup_2\^24.key diff --git a/docker/prover-fri-gateway/Dockerfile b/docker/prover-fri-gateway/Dockerfile index f5dfa027b418..c53f27818687 100644 --- a/docker/prover-fri-gateway/Dockerfile +++ b/docker/prover-fri-gateway/Dockerfile @@ -11,7 +11,7 @@ FROM debian:bookworm-slim RUN apt-get update && apt-get install -y curl libpq5 ca-certificates && rm -rf /var/lib/apt/lists/* # copy VK required for proof wrapping -COPY prover/vk_setup_data_generator_server_fri/data/ /prover/vk_setup_data_generator_server_fri/data/ +COPY prover/crates/bin/vk_setup_data_generator_server_fri/data/ /prover/crates/bin/vk_setup_data_generator_server_fri/data/ COPY --from=builder /usr/src/zksync/prover/target/release/zksync_prover_fri_gateway /usr/bin/ diff --git a/docker/prover-fri/Dockerfile b/docker/prover-fri/Dockerfile index 98a0d2d831dc..2dde8d9794ce 100644 --- a/docker/prover-fri/Dockerfile +++ b/docker/prover-fri/Dockerfile @@ -11,7 +11,7 @@ FROM debian:bookworm-slim RUN apt-get update && apt-get install -y curl libpq5 ca-certificates && rm -rf /var/lib/apt/lists/* # copy VK required for protocol version -COPY prover/vk_setup_data_generator_server_fri/data/ /prover/vk_setup_data_generator_server_fri/data/ +COPY prover/crates/bin/vk_setup_data_generator_server_fri/data/ /prover/crates/bin/vk_setup_data_generator_server_fri/data/ COPY --from=builder /usr/src/zksync/prover/target/release/zksync_prover_fri /usr/bin/ diff --git a/docker/prover-gpu-fri-gar/Dockerfile b/docker/prover-gpu-fri-gar/Dockerfile index bd70be7ee4b4..248f6aaf35fe 100644 --- a/docker/prover-gpu-fri-gar/Dockerfile +++ b/docker/prover-gpu-fri-gar/Dockerfile @@ -9,7 +9,7 @@ COPY *.bin / RUN apt-get update && apt-get install -y libpq5 ca-certificates openssl && rm -rf /var/lib/apt/lists/* # copy finalization hints required for assembly generation -COPY --from=prover prover/vk_setup_data_generator_server_fri/data/ /prover/vk_setup_data_generator_server_fri/data/ +COPY --from=prover prover/crates/bin/vk_setup_data_generator_server_fri/data/ /prover/crates/bin/vk_setup_data_generator_server_fri/data/ COPY --from=prover /usr/bin/zksync_prover_fri /usr/bin/ ENTRYPOINT ["zksync_prover_fri"] diff --git a/docker/prover-gpu-fri/Dockerfile b/docker/prover-gpu-fri/Dockerfile index 1093ed9e4ebf..0894c1c0c47d 100644 --- a/docker/prover-gpu-fri/Dockerfile +++ b/docker/prover-gpu-fri/Dockerfile @@ -31,7 +31,7 @@ FROM nvidia/cuda:12.2.0-runtime-ubuntu22.04 RUN apt-get update && apt-get install -y curl libpq5 ca-certificates && rm -rf /var/lib/apt/lists/* # copy finalization hints required for assembly generation -COPY prover/vk_setup_data_generator_server_fri/data/ /prover/vk_setup_data_generator_server_fri/data/ +COPY prover/crates/bin/vk_setup_data_generator_server_fri/data/ /prover/crates/bin/vk_setup_data_generator_server_fri/data/ COPY --from=builder /usr/src/zksync/prover/target/release/zksync_prover_fri /usr/bin/ diff --git a/docker/witness-generator/Dockerfile b/docker/witness-generator/Dockerfile index 595168702b70..3f8affbd2a9b 100644 --- a/docker/witness-generator/Dockerfile +++ b/docker/witness-generator/Dockerfile @@ -11,7 +11,7 @@ FROM debian:bookworm-slim RUN apt-get update && apt-get install -y curl libpq5 ca-certificates && rm -rf /var/lib/apt/lists/* -COPY prover/vk_setup_data_generator_server_fri/data/ /prover/vk_setup_data_generator_server_fri/data/ +COPY prover/crates/bin/vk_setup_data_generator_server_fri/data/ /prover/crates/bin/vk_setup_data_generator_server_fri/data/ COPY --from=builder /usr/src/zksync/prover/target/release/zksync_witness_generator /usr/bin/ diff --git a/docker/witness-vector-generator/Dockerfile b/docker/witness-vector-generator/Dockerfile index 9064595fcbed..d1bc1e29c5fa 100644 --- a/docker/witness-vector-generator/Dockerfile +++ b/docker/witness-vector-generator/Dockerfile @@ -12,7 +12,7 @@ FROM debian:bookworm-slim RUN apt-get update && apt-get install -y curl libpq5 ca-certificates && rm -rf /var/lib/apt/lists/* # copy finalization hints required for witness vector generation -COPY prover/vk_setup_data_generator_server_fri/data/ /prover/vk_setup_data_generator_server_fri/data/ +COPY prover/crates/bin/vk_setup_data_generator_server_fri/data/ /prover/crates/bin/vk_setup_data_generator_server_fri/data/ COPY --from=builder /usr/src/zksync/prover/target/release/zksync_witness_vector_generator /usr/bin/ diff --git a/docs/guides/advanced/zk_intuition.md b/docs/guides/advanced/zk_intuition.md index e567ebf7ca82..6e0224a3237f 100644 --- a/docs/guides/advanced/zk_intuition.md +++ b/docs/guides/advanced/zk_intuition.md @@ -144,7 +144,8 @@ version 1.4.0. [bellman cuda repo]: https://github.com/matter-labs/era-bellman-cuda [example ecrecover circuit]: https://github.com/matter-labs/era-sync_vm/blob/v1.3.2/src/glue/ecrecover_circuit/mod.rs#L157 -[separate witness binary]: https://github.com/matter-labs/zksync-era/blob/main/prover/witness_generator/src/main.rs +[separate witness binary]: + https://github.com/matter-labs/zksync-era/blob/main/prover/crates/bin/witness_generator/src/main.rs [zkevm_test_harness witness]: https://github.com/matter-labs/era-zkevm_test_harness/blob/fb47657ae3b6ff6e4bb5199964d3d37212978200/src/external_calls.rs#L579 [heavy_ops_service repo]: https://github.com/matter-labs/era-heavy-ops-service diff --git a/infrastructure/zk/src/database.ts b/infrastructure/zk/src/database.ts index 2d11bca447d2..c818bd3be93f 100644 --- a/infrastructure/zk/src/database.ts +++ b/infrastructure/zk/src/database.ts @@ -10,7 +10,7 @@ export async function reset(opts: DbOpts) { export enum DalPath { CoreDal = 'core/lib/dal', - ProverDal = 'prover/prover_dal' + ProverDal = 'prover/crates/lib/prover_dal' } export interface DbOpts { diff --git a/infrastructure/zk/src/docker.ts b/infrastructure/zk/src/docker.ts index 7f42fca1d022..19b03bcb2111 100644 --- a/infrastructure/zk/src/docker.ts +++ b/infrastructure/zk/src/docker.ts @@ -75,13 +75,7 @@ function defaultTagList(image: string, imageTagSha: string, imageTagShaTS: strin 'server-v2', 'external-node', 'contract-verifier', - 'witness-generator', - 'prover-fri', - 'prover-gpu-fri', - 'witness-vector-generator', 'prover-fri-gateway', - 'proof-fri-compressor', - 'proof-fri-gpu-compressor', 'snapshots-creator' ].includes(image) ? ['latest', 'latest2.0', `2.0-${imageTagSha}`, `${imageTagSha}`, `2.0-${imageTagShaTS}`, `${imageTagShaTS}`] diff --git a/infrastructure/zk/src/format_sql.ts b/infrastructure/zk/src/format_sql.ts index 7f18d4a46388..09f655f54867 100644 --- a/infrastructure/zk/src/format_sql.ts +++ b/infrastructure/zk/src/format_sql.ts @@ -159,7 +159,7 @@ async function formatFile(filePath: string, check: boolean) { export async function formatSqlxQueries(check: boolean) { process.chdir(`${process.env.ZKSYNC_HOME}`); const { stdout: filesRaw } = await utils.exec( - 'find core/lib/dal -type f -name "*.rs" && find prover/prover_dal -type f -name "*.rs"' + 'find core/lib/dal -type f -name "*.rs" && find prover/crates/lib/prover_dal -type f -name "*.rs"' ); const files = filesRaw.trim().split('\n'); const formatResults = await Promise.all(files.map((file) => formatFile(file, check))); diff --git a/prover/Cargo.toml b/prover/Cargo.toml index 6eebafbc520f..ffb034059c8a 100644 --- a/prover/Cargo.toml +++ b/prover/Cargo.toml @@ -1,17 +1,7 @@ [workspace] members = [ - # lib - "prover_fri_utils", - "prover_fri_types", - # binaries - "witness_generator", - "vk_setup_data_generator_server_fri", - "prover_fri", - "witness_vector_generator", - "prover_fri_gateway", - "proof_fri_compressor", - "prover_cli", - "prover_version", + "crates/bin/*", + "crates/lib/*", ] resolver = "2" @@ -94,10 +84,10 @@ zksync_contracts = { path = "../core/lib/contracts" } zksync_core_leftovers = { path = "../core/lib/zksync_core_leftovers" } # Prover workspace dependencies -zksync_prover_dal = { path = "prover_dal" } -zksync_prover_fri_types = { path = "prover_fri_types" } -zksync_prover_fri_utils = { path = "prover_fri_utils" } -vk_setup_data_generator_server_fri = { path = "vk_setup_data_generator_server_fri" } +zksync_prover_dal = { path = "crates/lib/prover_dal" } +zksync_prover_fri_types = { path = "crates/lib/prover_fri_types" } +zksync_prover_fri_utils = { path = "crates/lib/prover_fri_utils" } +vk_setup_data_generator_server_fri = { path = "crates/bin/vk_setup_data_generator_server_fri" } # for `perf` profiling [profile.perf] diff --git a/prover/proof_fri_compressor/Cargo.toml b/prover/crates/bin/proof_fri_compressor/Cargo.toml similarity index 99% rename from prover/proof_fri_compressor/Cargo.toml rename to prover/crates/bin/proof_fri_compressor/Cargo.toml index 14fc44d5a3b2..0c01a40874f2 100644 --- a/prover/proof_fri_compressor/Cargo.toml +++ b/prover/crates/bin/proof_fri_compressor/Cargo.toml @@ -41,5 +41,6 @@ serde = { workspace = true, features = ["derive"] } wrapper_prover = { workspace = true, optional = true } [features] +default = [] gpu = ["wrapper_prover"] diff --git a/prover/proof_fri_compressor/README.md b/prover/crates/bin/proof_fri_compressor/README.md similarity index 100% rename from prover/proof_fri_compressor/README.md rename to prover/crates/bin/proof_fri_compressor/README.md diff --git a/prover/proof_fri_compressor/src/compressor.rs b/prover/crates/bin/proof_fri_compressor/src/compressor.rs similarity index 100% rename from prover/proof_fri_compressor/src/compressor.rs rename to prover/crates/bin/proof_fri_compressor/src/compressor.rs diff --git a/prover/proof_fri_compressor/src/initial_setup_keys.rs b/prover/crates/bin/proof_fri_compressor/src/initial_setup_keys.rs similarity index 100% rename from prover/proof_fri_compressor/src/initial_setup_keys.rs rename to prover/crates/bin/proof_fri_compressor/src/initial_setup_keys.rs diff --git a/prover/proof_fri_compressor/src/main.rs b/prover/crates/bin/proof_fri_compressor/src/main.rs similarity index 100% rename from prover/proof_fri_compressor/src/main.rs rename to prover/crates/bin/proof_fri_compressor/src/main.rs diff --git a/prover/proof_fri_compressor/src/metrics.rs b/prover/crates/bin/proof_fri_compressor/src/metrics.rs similarity index 100% rename from prover/proof_fri_compressor/src/metrics.rs rename to prover/crates/bin/proof_fri_compressor/src/metrics.rs diff --git a/prover/prover_cli/Cargo.toml b/prover/crates/bin/prover_cli/Cargo.toml similarity index 100% rename from prover/prover_cli/Cargo.toml rename to prover/crates/bin/prover_cli/Cargo.toml diff --git a/prover/prover_cli/README.md b/prover/crates/bin/prover_cli/README.md similarity index 99% rename from prover/prover_cli/README.md rename to prover/crates/bin/prover_cli/README.md index 053744914b97..6a9091aef25e 100644 --- a/prover/prover_cli/README.md +++ b/prover/crates/bin/prover_cli/README.md @@ -6,7 +6,7 @@ CLI tool for performing maintenance of a ZKsync Prover ``` git clone git@github.com:matter-labs/zksync-era.git -cargo install --path prover/prover_cli/ +cargo install -p prover_cli ``` > This should be `cargo install zksync-prover-cli` or something similar ideally. diff --git a/prover/prover_cli/src/cli.rs b/prover/crates/bin/prover_cli/src/cli.rs similarity index 100% rename from prover/prover_cli/src/cli.rs rename to prover/crates/bin/prover_cli/src/cli.rs diff --git a/prover/prover_cli/src/commands/config.rs b/prover/crates/bin/prover_cli/src/commands/config.rs similarity index 100% rename from prover/prover_cli/src/commands/config.rs rename to prover/crates/bin/prover_cli/src/commands/config.rs diff --git a/prover/prover_cli/src/commands/debug_proof.rs b/prover/crates/bin/prover_cli/src/commands/debug_proof.rs similarity index 100% rename from prover/prover_cli/src/commands/debug_proof.rs rename to prover/crates/bin/prover_cli/src/commands/debug_proof.rs diff --git a/prover/prover_cli/src/commands/delete.rs b/prover/crates/bin/prover_cli/src/commands/delete.rs similarity index 100% rename from prover/prover_cli/src/commands/delete.rs rename to prover/crates/bin/prover_cli/src/commands/delete.rs diff --git a/prover/prover_cli/src/commands/get_file_info.rs b/prover/crates/bin/prover_cli/src/commands/get_file_info.rs similarity index 100% rename from prover/prover_cli/src/commands/get_file_info.rs rename to prover/crates/bin/prover_cli/src/commands/get_file_info.rs diff --git a/prover/prover_cli/src/commands/mod.rs b/prover/crates/bin/prover_cli/src/commands/mod.rs similarity index 100% rename from prover/prover_cli/src/commands/mod.rs rename to prover/crates/bin/prover_cli/src/commands/mod.rs diff --git a/prover/prover_cli/src/commands/requeue.rs b/prover/crates/bin/prover_cli/src/commands/requeue.rs similarity index 100% rename from prover/prover_cli/src/commands/requeue.rs rename to prover/crates/bin/prover_cli/src/commands/requeue.rs diff --git a/prover/prover_cli/src/commands/restart.rs b/prover/crates/bin/prover_cli/src/commands/restart.rs similarity index 100% rename from prover/prover_cli/src/commands/restart.rs rename to prover/crates/bin/prover_cli/src/commands/restart.rs diff --git a/prover/prover_cli/src/commands/stats.rs b/prover/crates/bin/prover_cli/src/commands/stats.rs similarity index 100% rename from prover/prover_cli/src/commands/stats.rs rename to prover/crates/bin/prover_cli/src/commands/stats.rs diff --git a/prover/prover_cli/src/commands/status/batch.rs b/prover/crates/bin/prover_cli/src/commands/status/batch.rs similarity index 100% rename from prover/prover_cli/src/commands/status/batch.rs rename to prover/crates/bin/prover_cli/src/commands/status/batch.rs diff --git a/prover/prover_cli/src/commands/status/l1.rs b/prover/crates/bin/prover_cli/src/commands/status/l1.rs similarity index 100% rename from prover/prover_cli/src/commands/status/l1.rs rename to prover/crates/bin/prover_cli/src/commands/status/l1.rs diff --git a/prover/prover_cli/src/commands/status/mod.rs b/prover/crates/bin/prover_cli/src/commands/status/mod.rs similarity index 100% rename from prover/prover_cli/src/commands/status/mod.rs rename to prover/crates/bin/prover_cli/src/commands/status/mod.rs diff --git a/prover/prover_cli/src/commands/status/utils.rs b/prover/crates/bin/prover_cli/src/commands/status/utils.rs similarity index 100% rename from prover/prover_cli/src/commands/status/utils.rs rename to prover/crates/bin/prover_cli/src/commands/status/utils.rs diff --git a/prover/prover_cli/src/config/mod.rs b/prover/crates/bin/prover_cli/src/config/mod.rs similarity index 100% rename from prover/prover_cli/src/config/mod.rs rename to prover/crates/bin/prover_cli/src/config/mod.rs diff --git a/prover/prover_cli/src/examples/pliconfig b/prover/crates/bin/prover_cli/src/examples/pliconfig similarity index 100% rename from prover/prover_cli/src/examples/pliconfig rename to prover/crates/bin/prover_cli/src/examples/pliconfig diff --git a/prover/prover_cli/src/helper.rs b/prover/crates/bin/prover_cli/src/helper.rs similarity index 100% rename from prover/prover_cli/src/helper.rs rename to prover/crates/bin/prover_cli/src/helper.rs diff --git a/prover/prover_cli/src/lib.rs b/prover/crates/bin/prover_cli/src/lib.rs similarity index 100% rename from prover/prover_cli/src/lib.rs rename to prover/crates/bin/prover_cli/src/lib.rs diff --git a/prover/prover_cli/src/main.rs b/prover/crates/bin/prover_cli/src/main.rs similarity index 100% rename from prover/prover_cli/src/main.rs rename to prover/crates/bin/prover_cli/src/main.rs diff --git a/prover/prover_fri/Cargo.toml b/prover/crates/bin/prover_fri/Cargo.toml similarity index 100% rename from prover/prover_fri/Cargo.toml rename to prover/crates/bin/prover_fri/Cargo.toml diff --git a/prover/prover_fri/README.md b/prover/crates/bin/prover_fri/README.md similarity index 100% rename from prover/prover_fri/README.md rename to prover/crates/bin/prover_fri/README.md diff --git a/prover/prover_fri/src/gpu_prover_availability_checker.rs b/prover/crates/bin/prover_fri/src/gpu_prover_availability_checker.rs similarity index 96% rename from prover/prover_fri/src/gpu_prover_availability_checker.rs rename to prover/crates/bin/prover_fri/src/gpu_prover_availability_checker.rs index 4b51b26e5d38..6e154ba553a9 100644 --- a/prover/prover_fri/src/gpu_prover_availability_checker.rs +++ b/prover/crates/bin/prover_fri/src/gpu_prover_availability_checker.rs @@ -4,6 +4,7 @@ pub mod availability_checker { use tokio::sync::Notify; use zksync_prover_dal::{ConnectionPool, Prover, ProverDal}; + use zksync_prover_fri_utils::region_fetcher::Zone; use zksync_types::prover_dal::{GpuProverInstanceStatus, SocketAddress}; use crate::metrics::{KillingReason, METRICS}; @@ -12,7 +13,7 @@ pub mod availability_checker { /// If the prover instance is not found in the database or marked as dead, the availability checker will shut down the prover. pub struct AvailabilityChecker { address: SocketAddress, - zone: String, + zone: Zone, polling_interval: Duration, pool: ConnectionPool, } @@ -20,7 +21,7 @@ pub mod availability_checker { impl AvailabilityChecker { pub fn new( address: SocketAddress, - zone: String, + zone: Zone, polling_interval_secs: u32, pool: ConnectionPool, ) -> Self { @@ -46,7 +47,7 @@ pub mod availability_checker { .await .unwrap() .fri_gpu_prover_queue_dal() - .get_prover_instance_status(self.address.clone(), self.zone.clone()) + .get_prover_instance_status(self.address.clone(), self.zone.to_string()) .await; // If the prover instance is not found in the database or marked as dead, we should shut down the prover diff --git a/prover/prover_fri/src/gpu_prover_job_processor.rs b/prover/crates/bin/prover_fri/src/gpu_prover_job_processor.rs similarity index 98% rename from prover/prover_fri/src/gpu_prover_job_processor.rs rename to prover/crates/bin/prover_fri/src/gpu_prover_job_processor.rs index cbd363e9b4f4..6148ca3e0aed 100644 --- a/prover/prover_fri/src/gpu_prover_job_processor.rs +++ b/prover/crates/bin/prover_fri/src/gpu_prover_job_processor.rs @@ -28,6 +28,7 @@ pub mod gpu_prover { }, CircuitWrapper, FriProofWrapper, ProverServiceDataKey, WitnessVectorArtifacts, }; + use zksync_prover_fri_utils::region_fetcher::Zone; use zksync_queued_job_processor::{async_trait, JobProcessor}; use zksync_types::{ basic_fri_types::CircuitIdRoundTuple, protocol_version::ProtocolSemanticVersion, @@ -64,7 +65,7 @@ pub mod gpu_prover { witness_vector_queue: SharedWitnessVectorQueue, prover_context: ProverContext, address: SocketAddress, - zone: String, + zone: Zone, protocol_version: ProtocolSemanticVersion, } @@ -79,7 +80,7 @@ pub mod gpu_prover { circuit_ids_for_round_to_be_proven: Vec, witness_vector_queue: SharedWitnessVectorQueue, address: SocketAddress, - zone: String, + zone: Zone, protocol_version: ProtocolSemanticVersion, ) -> Self { Prover { @@ -230,7 +231,7 @@ pub mod gpu_prover { .fri_gpu_prover_queue_dal() .update_prover_instance_from_full_to_available( self.address.clone(), - self.zone.clone(), + self.zone.to_string(), ) .await; } diff --git a/prover/prover_fri/src/lib.rs b/prover/crates/bin/prover_fri/src/lib.rs similarity index 100% rename from prover/prover_fri/src/lib.rs rename to prover/crates/bin/prover_fri/src/lib.rs diff --git a/prover/prover_fri/src/main.rs b/prover/crates/bin/prover_fri/src/main.rs similarity index 95% rename from prover/prover_fri/src/main.rs rename to prover/crates/bin/prover_fri/src/main.rs index dfab8648d74c..e4b2fd5a6709 100644 --- a/prover/prover_fri/src/main.rs +++ b/prover/crates/bin/prover_fri/src/main.rs @@ -16,7 +16,10 @@ use zksync_env_config::FromEnv; use zksync_object_store::{ObjectStore, ObjectStoreFactory}; use zksync_prover_dal::{ConnectionPool, Prover, ProverDal}; use zksync_prover_fri_types::PROVER_PROTOCOL_SEMANTIC_VERSION; -use zksync_prover_fri_utils::{get_all_circuit_id_round_tuples_for, region_fetcher::get_zone}; +use zksync_prover_fri_utils::{ + get_all_circuit_id_round_tuples_for, + region_fetcher::{RegionFetcher, Zone}, +}; use zksync_queued_job_processor::JobProcessor; use zksync_types::{ basic_fri_types::CircuitIdRoundTuple, @@ -32,24 +35,20 @@ mod prover_job_processor; mod socket_listener; mod utils; -async fn graceful_shutdown(port: u16) -> anyhow::Result> { +async fn graceful_shutdown(zone: Zone, port: u16) -> anyhow::Result> { let database_secrets = DatabaseSecrets::from_env().context("DatabaseSecrets::from_env()")?; let pool = ConnectionPool::::singleton(database_secrets.prover_url()?) .build() .await .context("failed to build a connection pool")?; let host = local_ip().context("Failed obtaining local IP address")?; - let zone_url = &FriProverConfig::from_env() - .context("FriProverConfig::from_env()")? - .zone_read_url; - let zone = get_zone(zone_url).await.context("get_zone()")?; let address = SocketAddress { host, port }; Ok(async move { pool.connection() .await .unwrap() .fri_gpu_prover_queue_dal() - .update_prover_instance_status(address, GpuProverInstanceStatus::Dead, zone) + .update_prover_instance_status(address, GpuProverInstanceStatus::Dead, zone.to_string()) .await }) } @@ -107,6 +106,13 @@ async fn main() -> anyhow::Result<()> { }) .context("Error setting Ctrl+C handler")?; + let zone = RegionFetcher::new( + prover_config.cloud_type, + prover_config.zone_read_url.clone(), + ) + .get_zone() + .await?; + let (stop_sender, stop_receiver) = tokio::sync::watch::channel(false); let prover_object_store_config = prover_config .prover_object_store @@ -156,6 +162,7 @@ async fn main() -> anyhow::Result<()> { let prover_tasks = get_prover_tasks( prover_config, + zone.clone(), stop_receiver.clone(), object_store_factory, public_blob_store, @@ -174,7 +181,7 @@ async fn main() -> anyhow::Result<()> { tokio::select! { _ = tasks.wait_single() => { if cfg!(feature = "gpu") { - graceful_shutdown(port) + graceful_shutdown(zone, port) .await .context("failed to prepare graceful shutdown future")? .await; @@ -194,6 +201,7 @@ async fn main() -> anyhow::Result<()> { #[cfg(not(feature = "gpu"))] async fn get_prover_tasks( prover_config: FriProverConfig, + _zone: Zone, stop_receiver: Receiver, store_factory: ObjectStoreFactory, public_blob_store: Option>, @@ -228,6 +236,7 @@ async fn get_prover_tasks( #[cfg(feature = "gpu")] async fn get_prover_tasks( prover_config: FriProverConfig, + zone: Zone, stop_receiver: Receiver, store_factory: ObjectStoreFactory, public_blob_store: Option>, @@ -246,9 +255,6 @@ async fn get_prover_tasks( let shared_witness_vector_queue = Arc::new(Mutex::new(witness_vector_queue)); let consumer = shared_witness_vector_queue.clone(); - let zone = get_zone(&prover_config.zone_read_url) - .await - .context("get_zone()")?; let local_ip = local_ip().context("Failed obtaining local IP address")?; let address = SocketAddress { host: local_ip, diff --git a/prover/prover_fri/src/metrics.rs b/prover/crates/bin/prover_fri/src/metrics.rs similarity index 100% rename from prover/prover_fri/src/metrics.rs rename to prover/crates/bin/prover_fri/src/metrics.rs diff --git a/prover/prover_fri/src/prover_job_processor.rs b/prover/crates/bin/prover_fri/src/prover_job_processor.rs similarity index 100% rename from prover/prover_fri/src/prover_job_processor.rs rename to prover/crates/bin/prover_fri/src/prover_job_processor.rs diff --git a/prover/prover_fri/src/socket_listener.rs b/prover/crates/bin/prover_fri/src/socket_listener.rs similarity index 97% rename from prover/prover_fri/src/socket_listener.rs rename to prover/crates/bin/prover_fri/src/socket_listener.rs index 5e857e651bcf..e65471409e1e 100644 --- a/prover/prover_fri/src/socket_listener.rs +++ b/prover/crates/bin/prover_fri/src/socket_listener.rs @@ -11,6 +11,7 @@ pub mod gpu_socket_listener { use zksync_object_store::bincode; use zksync_prover_dal::{ConnectionPool, Prover, ProverDal}; use zksync_prover_fri_types::WitnessVectorArtifacts; + use zksync_prover_fri_utils::region_fetcher::Zone; use zksync_types::{ protocol_version::ProtocolSemanticVersion, prover_dal::{GpuProverInstanceStatus, SocketAddress}, @@ -26,7 +27,7 @@ pub mod gpu_socket_listener { queue: SharedWitnessVectorQueue, pool: ConnectionPool, specialized_prover_group_id: u8, - zone: String, + zone: Zone, protocol_version: ProtocolSemanticVersion, } @@ -36,7 +37,7 @@ pub mod gpu_socket_listener { queue: SharedWitnessVectorQueue, pool: ConnectionPool, specialized_prover_group_id: u8, - zone: String, + zone: Zone, protocol_version: ProtocolSemanticVersion, ) -> Self { Self { @@ -68,7 +69,7 @@ pub mod gpu_socket_listener { .insert_prover_instance( self.address.clone(), self.specialized_prover_group_id, - self.zone.clone(), + self.zone.to_string(), self.protocol_version, ) .await; @@ -154,7 +155,7 @@ pub mod gpu_socket_listener { .await .unwrap() .fri_gpu_prover_queue_dal() - .update_prover_instance_status(self.address.clone(), status, self.zone.clone()) + .update_prover_instance_status(self.address.clone(), status, self.zone.to_string()) .await; tracing::info!( "Marked prover as {:?} after {:?}", diff --git a/prover/prover_fri/src/utils.rs b/prover/crates/bin/prover_fri/src/utils.rs similarity index 100% rename from prover/prover_fri/src/utils.rs rename to prover/crates/bin/prover_fri/src/utils.rs diff --git a/prover/prover_fri/tests/basic_test.rs b/prover/crates/bin/prover_fri/tests/basic_test.rs similarity index 100% rename from prover/prover_fri/tests/basic_test.rs rename to prover/crates/bin/prover_fri/tests/basic_test.rs diff --git a/prover/prover_fri/tests/data/proofs_fri/proof_1293714.bin b/prover/crates/bin/prover_fri/tests/data/proofs_fri/proof_1293714.bin similarity index 100% rename from prover/prover_fri/tests/data/proofs_fri/proof_1293714.bin rename to prover/crates/bin/prover_fri/tests/data/proofs_fri/proof_1293714.bin diff --git a/prover/prover_fri/tests/data/proofs_fri/proof_5176866.bin b/prover/crates/bin/prover_fri/tests/data/proofs_fri/proof_5176866.bin similarity index 100% rename from prover/prover_fri/tests/data/proofs_fri/proof_5176866.bin rename to prover/crates/bin/prover_fri/tests/data/proofs_fri/proof_5176866.bin diff --git a/prover/prover_fri/tests/data/prover_jobs_fri/114499_479_6_BasicCircuits_0.bin b/prover/crates/bin/prover_fri/tests/data/prover_jobs_fri/114499_479_6_BasicCircuits_0.bin similarity index 100% rename from prover/prover_fri/tests/data/prover_jobs_fri/114499_479_6_BasicCircuits_0.bin rename to prover/crates/bin/prover_fri/tests/data/prover_jobs_fri/114499_479_6_BasicCircuits_0.bin diff --git a/prover/prover_fri/tests/data/prover_jobs_fri/128623_1086_1_BasicCircuits_0.bin b/prover/crates/bin/prover_fri/tests/data/prover_jobs_fri/128623_1086_1_BasicCircuits_0.bin similarity index 100% rename from prover/prover_fri/tests/data/prover_jobs_fri/128623_1086_1_BasicCircuits_0.bin rename to prover/crates/bin/prover_fri/tests/data/prover_jobs_fri/128623_1086_1_BasicCircuits_0.bin diff --git a/prover/prover_fri_gateway/Cargo.toml b/prover/crates/bin/prover_fri_gateway/Cargo.toml similarity index 100% rename from prover/prover_fri_gateway/Cargo.toml rename to prover/crates/bin/prover_fri_gateway/Cargo.toml diff --git a/prover/prover_fri_gateway/README.md b/prover/crates/bin/prover_fri_gateway/README.md similarity index 100% rename from prover/prover_fri_gateway/README.md rename to prover/crates/bin/prover_fri_gateway/README.md diff --git a/prover/crates/bin/prover_fri_gateway/src/client.rs b/prover/crates/bin/prover_fri_gateway/src/client.rs new file mode 100644 index 000000000000..5f1ad79ef36f --- /dev/null +++ b/prover/crates/bin/prover_fri_gateway/src/client.rs @@ -0,0 +1,51 @@ +use std::sync::Arc; + +use serde::{de::DeserializeOwned, Serialize}; +use zksync_object_store::ObjectStore; +use zksync_prover_dal::{ConnectionPool, Prover}; + +/// A tiny wrapper over the reqwest client that also stores +/// the objects commonly needed when interacting with prover API. +#[derive(Debug)] +pub(crate) struct ProverApiClient { + pub(crate) blob_store: Arc, + pub(crate) pool: ConnectionPool, + pub(crate) api_url: String, + pub(crate) client: reqwest::Client, +} + +impl ProverApiClient { + pub(crate) fn new( + blob_store: Arc, + pool: ConnectionPool, + api_url: String, + ) -> Self { + Self { + blob_store, + pool, + api_url, + client: reqwest::Client::new(), + } + } + + pub(crate) async fn send_http_request( + &self, + request: Req, + endpoint: &str, + ) -> Result + where + Req: Serialize, + Resp: DeserializeOwned, + { + tracing::info!("Sending request to {}", endpoint); + + self.client + .post(endpoint) + .json(&request) + .send() + .await? + .error_for_status()? + .json::() + .await + } +} diff --git a/prover/prover_fri_gateway/src/main.rs b/prover/crates/bin/prover_fri_gateway/src/main.rs similarity index 77% rename from prover/prover_fri_gateway/src/main.rs rename to prover/crates/bin/prover_fri_gateway/src/main.rs index caa165331116..c204fb7395f2 100644 --- a/prover/prover_fri_gateway/src/main.rs +++ b/prover/crates/bin/prover_fri_gateway/src/main.rs @@ -2,22 +2,22 @@ use std::time::Duration; use anyhow::Context as _; use clap::Parser; -use reqwest::Client; +use proof_gen_data_fetcher::ProofGenDataFetcher; +use proof_submitter::ProofSubmitter; use tokio::sync::{oneshot, watch}; +use traits::PeriodicApi as _; use zksync_core_leftovers::temp_config_store::{load_database_secrets, load_general_config}; use zksync_env_config::object_store::ProverObjectStoreConfig; use zksync_object_store::ObjectStoreFactory; use zksync_prover_dal::{ConnectionPool, Prover}; -use zksync_prover_interface::api::{ProofGenerationDataRequest, SubmitProofRequest}; use zksync_utils::wait_for_tasks::ManagedTasks; use zksync_vlog::prometheus::PrometheusExporterConfig; -use crate::api_data_fetcher::{PeriodicApiStruct, PROOF_GENERATION_DATA_PATH, SUBMIT_PROOF_PATH}; - -mod api_data_fetcher; +mod client; mod metrics; mod proof_gen_data_fetcher; mod proof_submitter; +mod traits; #[tokio::main] async fn main() -> anyhow::Result<()> { @@ -65,20 +65,16 @@ async fn main() -> anyhow::Result<()> { ); let store_factory = ObjectStoreFactory::new(object_store_config.0); - let proof_submitter = PeriodicApiStruct { - blob_store: store_factory.create_store().await?, - pool: pool.clone(), - api_url: format!("{}{SUBMIT_PROOF_PATH}", config.api_url), - poll_duration: config.api_poll_duration(), - client: Client::new(), - }; - let proof_gen_data_fetcher = PeriodicApiStruct { - blob_store: store_factory.create_store().await?, + let proof_submitter = ProofSubmitter::new( + store_factory.create_store().await?, + config.api_url.clone(), + pool.clone(), + ); + let proof_gen_data_fetcher = ProofGenDataFetcher::new( + store_factory.create_store().await?, + config.api_url.clone(), pool, - api_url: format!("{}{PROOF_GENERATION_DATA_PATH}", config.api_url), - poll_duration: config.api_poll_duration(), - client: Client::new(), - }; + ); let (stop_sender, stop_receiver) = watch::channel(false); @@ -98,10 +94,8 @@ async fn main() -> anyhow::Result<()> { PrometheusExporterConfig::pull(config.prometheus_listener_port) .run(stop_receiver.clone()), ), - tokio::spawn( - proof_gen_data_fetcher.run::(stop_receiver.clone()), - ), - tokio::spawn(proof_submitter.run::(stop_receiver)), + tokio::spawn(proof_gen_data_fetcher.run(config.api_poll_duration(), stop_receiver.clone())), + tokio::spawn(proof_submitter.run(config.api_poll_duration(), stop_receiver)), ]; let mut tasks = ManagedTasks::new(tasks); diff --git a/prover/prover_fri_gateway/src/metrics.rs b/prover/crates/bin/prover_fri_gateway/src/metrics.rs similarity index 100% rename from prover/prover_fri_gateway/src/metrics.rs rename to prover/crates/bin/prover_fri_gateway/src/metrics.rs diff --git a/prover/prover_fri_gateway/src/proof_gen_data_fetcher.rs b/prover/crates/bin/prover_fri_gateway/src/proof_gen_data_fetcher.rs similarity index 57% rename from prover/prover_fri_gateway/src/proof_gen_data_fetcher.rs rename to prover/crates/bin/prover_fri_gateway/src/proof_gen_data_fetcher.rs index 9dcc93a4be77..809df8ae8225 100644 --- a/prover/prover_fri_gateway/src/proof_gen_data_fetcher.rs +++ b/prover/crates/bin/prover_fri_gateway/src/proof_gen_data_fetcher.rs @@ -1,23 +1,42 @@ +use std::sync::Arc; + use async_trait::async_trait; -use zksync_prover_dal::ProverDal; +use zksync_object_store::ObjectStore; +use zksync_prover_dal::{ConnectionPool, Prover, ProverDal}; use zksync_prover_interface::api::{ ProofGenerationData, ProofGenerationDataRequest, ProofGenerationDataResponse, }; -use crate::api_data_fetcher::{PeriodicApi, PeriodicApiStruct}; +use crate::{client::ProverApiClient, traits::PeriodicApi}; + +/// Poller structure that will periodically check the prover API for new proof generation data. +/// Fetched data is stored to the database/object store for further processing. +#[derive(Debug)] +pub struct ProofGenDataFetcher(ProverApiClient); + +/// The path to the API endpoint that returns the next proof generation data. +const PROOF_GENERATION_DATA_PATH: &str = "/proof_generation_data"; + +impl ProofGenDataFetcher { + pub(crate) fn new( + blob_store: Arc, + base_url: String, + pool: ConnectionPool, + ) -> Self { + let api_url = format!("{base_url}{PROOF_GENERATION_DATA_PATH}"); + let inner = ProverApiClient::new(blob_store, pool, api_url); + Self(inner) + } +} -impl PeriodicApiStruct { +impl ProofGenDataFetcher { async fn save_proof_gen_data(&self, data: ProofGenerationData) { - let store = &*self.blob_store; - let merkle_paths = store - .put(data.l1_batch_number, &data.witness_input_data.merkle_paths) - .await - .expect("Failed to save proof generation data to GCS"); + let store = &*self.0.blob_store; let witness_inputs = store .put(data.l1_batch_number, &data.witness_input_data) .await .expect("Failed to save proof generation data to GCS"); - let mut connection = self.pool.connection().await.unwrap(); + let mut connection = self.0.pool.connection().await.unwrap(); connection .fri_protocol_versions_dal() @@ -26,20 +45,15 @@ impl PeriodicApiStruct { connection .fri_witness_generator_dal() - .save_witness_inputs( - data.l1_batch_number, - &merkle_paths, - &witness_inputs, - data.protocol_version, - data.witness_input_data.eip_4844_blobs, - ) + .save_witness_inputs(data.l1_batch_number, &witness_inputs, data.protocol_version) .await; } } #[async_trait] -impl PeriodicApi for PeriodicApiStruct { +impl PeriodicApi for ProofGenDataFetcher { type JobId = (); + type Request = ProofGenerationDataRequest; type Response = ProofGenerationDataResponse; const SERVICE_NAME: &'static str = "ProofGenDataFetcher"; @@ -53,7 +67,7 @@ impl PeriodicApi for PeriodicApiStruct { _: (), request: ProofGenerationDataRequest, ) -> reqwest::Result { - self.send_http_request(request, &self.api_url).await + self.0.send_http_request(request, &self.0.api_url).await } async fn handle_response(&self, _: (), response: Self::Response) { diff --git a/prover/prover_fri_gateway/src/proof_submitter.rs b/prover/crates/bin/prover_fri_gateway/src/proof_submitter.rs similarity index 66% rename from prover/prover_fri_gateway/src/proof_submitter.rs rename to prover/crates/bin/prover_fri_gateway/src/proof_submitter.rs index 8b20ab67b516..2a74781b59dd 100644 --- a/prover/prover_fri_gateway/src/proof_submitter.rs +++ b/prover/crates/bin/prover_fri_gateway/src/proof_submitter.rs @@ -1,13 +1,37 @@ +use std::sync::Arc; + use async_trait::async_trait; -use zksync_prover_dal::ProverDal; +use zksync_object_store::ObjectStore; +use zksync_prover_dal::{ConnectionPool, Prover, ProverDal}; use zksync_prover_interface::api::{SubmitProofRequest, SubmitProofResponse}; use zksync_types::{prover_dal::ProofCompressionJobStatus, L1BatchNumber}; -use crate::api_data_fetcher::{PeriodicApi, PeriodicApiStruct}; +use crate::{client::ProverApiClient, traits::PeriodicApi}; + +/// The path to the API endpoint that submits the proof. +const SUBMIT_PROOF_PATH: &str = "/submit_proof"; -impl PeriodicApiStruct { +/// Poller structure that will periodically check the database for new proofs to submit. +/// Once a new proof is detected, it will be sent to the prover API. +#[derive(Debug)] +pub struct ProofSubmitter(ProverApiClient); + +impl ProofSubmitter { + pub(crate) fn new( + blob_store: Arc, + base_url: String, + pool: ConnectionPool, + ) -> Self { + let api_url = format!("{base_url}{SUBMIT_PROOF_PATH}"); + let inner = ProverApiClient::new(blob_store, pool, api_url); + Self(inner) + } +} + +impl ProofSubmitter { async fn next_submit_proof_request(&self) -> Option<(L1BatchNumber, SubmitProofRequest)> { let (l1_batch_number, protocol_version, status) = self + .0 .pool .connection() .await @@ -19,6 +43,7 @@ impl PeriodicApiStruct { let request = match status { ProofCompressionJobStatus::Successful => { let proof = self + .0 .blob_store .get((l1_batch_number, protocol_version)) .await @@ -36,7 +61,8 @@ impl PeriodicApiStruct { } async fn save_successful_sent_proof(&self, l1_batch_number: L1BatchNumber) { - self.pool + self.0 + .pool .connection() .await .unwrap() @@ -47,8 +73,9 @@ impl PeriodicApiStruct { } #[async_trait] -impl PeriodicApi for PeriodicApiStruct { +impl PeriodicApi for ProofSubmitter { type JobId = L1BatchNumber; + type Request = SubmitProofRequest; type Response = SubmitProofResponse; const SERVICE_NAME: &'static str = "ProofSubmitter"; @@ -62,8 +89,8 @@ impl PeriodicApi for PeriodicApiStruct { job_id: Self::JobId, request: SubmitProofRequest, ) -> reqwest::Result { - let endpoint = format!("{}/{job_id}", self.api_url); - self.send_http_request(request, &endpoint).await + let endpoint = format!("{}/{job_id}", self.0.api_url); + self.0.send_http_request(request, &endpoint).await } async fn handle_response(&self, job_id: L1BatchNumber, response: Self::Response) { diff --git a/prover/crates/bin/prover_fri_gateway/src/traits.rs b/prover/crates/bin/prover_fri_gateway/src/traits.rs new file mode 100644 index 000000000000..e54ffe2414ce --- /dev/null +++ b/prover/crates/bin/prover_fri_gateway/src/traits.rs @@ -0,0 +1,62 @@ +use std::time::Duration; + +use tokio::sync::watch; + +use crate::metrics::METRICS; + +/// Trait for fetching data from an API periodically. +#[async_trait::async_trait] +pub(crate) trait PeriodicApi: Sync + Send + 'static + Sized { + type JobId: Send + Copy; + type Request: Send; + type Response: Send; + + const SERVICE_NAME: &'static str; + + /// Returns the next request to be sent to the API and the endpoint to send it to. + async fn get_next_request(&self) -> Option<(Self::JobId, Self::Request)>; + + /// Handles the response from the API. + async fn send_request( + &self, + job_id: Self::JobId, + request: Self::Request, + ) -> reqwest::Result; + + async fn handle_response(&self, job_id: Self::JobId, response: Self::Response); + + async fn run( + self, + poll_duration: Duration, + mut stop_receiver: watch::Receiver, + ) -> anyhow::Result<()> { + tracing::info!( + "Starting periodic job: {} with frequency: {:?}", + Self::SERVICE_NAME, + poll_duration + ); + + loop { + if *stop_receiver.borrow() { + tracing::warn!("Stop signal received, shutting down {}", Self::SERVICE_NAME); + return Ok(()); + } + + if let Some((job_id, request)) = self.get_next_request().await { + match self.send_request(job_id, request).await { + Ok(response) => { + self.handle_response(job_id, response).await; + } + Err(err) => { + METRICS.http_error[&Self::SERVICE_NAME].inc(); + tracing::error!("HTTP request failed due to error: {}", err); + } + } + } + // Exit condition will be checked on the next iteration. + tokio::time::timeout(poll_duration, stop_receiver.changed()) + .await + .ok(); + } + } +} diff --git a/prover/prover_version/Cargo.toml b/prover/crates/bin/prover_version/Cargo.toml similarity index 100% rename from prover/prover_version/Cargo.toml rename to prover/crates/bin/prover_version/Cargo.toml diff --git a/prover/prover_version/src/main.rs b/prover/crates/bin/prover_version/src/main.rs similarity index 100% rename from prover/prover_version/src/main.rs rename to prover/crates/bin/prover_version/src/main.rs diff --git a/prover/vk_setup_data_generator_server_fri/Cargo.toml b/prover/crates/bin/vk_setup_data_generator_server_fri/Cargo.toml similarity index 100% rename from prover/vk_setup_data_generator_server_fri/Cargo.toml rename to prover/crates/bin/vk_setup_data_generator_server_fri/Cargo.toml diff --git a/prover/vk_setup_data_generator_server_fri/README.md b/prover/crates/bin/vk_setup_data_generator_server_fri/README.md similarity index 100% rename from prover/vk_setup_data_generator_server_fri/README.md rename to prover/crates/bin/vk_setup_data_generator_server_fri/README.md diff --git a/prover/vk_setup_data_generator_server_fri/data/commitments.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/commitments.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/commitments.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/commitments.json diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_1.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_1.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_1.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_1.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_10.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_10.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_10.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_10.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_11.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_11.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_11.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_11.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_12.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_12.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_12.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_12.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_13.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_13.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_13.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_13.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_14.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_14.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_14.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_14.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_15.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_15.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_15.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_15.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_2.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_2.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_2.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_2.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_255.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_255.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_255.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_255.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_3.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_3.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_3.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_3.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_4.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_4.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_4.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_4.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_5.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_5.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_5.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_5.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_6.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_6.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_6.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_6.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_7.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_7.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_7.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_7.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_8.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_8.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_8.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_8.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_9.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_9.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_basic_9.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_basic_9.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_10.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_10.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_10.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_10.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_11.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_11.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_11.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_11.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_12.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_12.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_12.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_12.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_13.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_13.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_13.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_13.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_14.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_14.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_14.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_14.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_15.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_15.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_15.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_15.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_16.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_16.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_16.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_16.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_17.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_17.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_17.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_17.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_18.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_18.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_18.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_18.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_3.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_3.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_3.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_3.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_4.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_4.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_4.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_4.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_5.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_5.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_5.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_5.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_6.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_6.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_6.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_6.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_7.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_7.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_7.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_7.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_8.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_8.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_8.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_8.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_9.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_9.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_9.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_leaf_9.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_node.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_node.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_node.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_node.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_recursion_tip.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_recursion_tip.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_recursion_tip.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_recursion_tip.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/finalization_hints_scheduler.bin b/prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_scheduler.bin similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/finalization_hints_scheduler.bin rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/finalization_hints_scheduler.bin diff --git a/prover/vk_setup_data_generator_server_fri/data/snark_verification_scheduler_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/snark_verification_scheduler_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/snark_verification_scheduler_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/snark_verification_scheduler_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_10_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_10_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_10_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_10_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_11_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_11_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_11_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_11_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_12_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_12_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_12_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_12_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_13_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_13_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_13_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_13_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_14_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_14_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_14_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_14_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_15_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_15_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_15_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_15_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_1_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_1_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_1_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_1_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_255_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_255_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_255_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_255_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_2_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_2_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_2_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_2_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_3_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_3_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_3_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_3_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_4_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_4_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_4_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_4_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_5_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_5_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_5_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_5_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_6_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_6_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_6_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_6_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_7_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_7_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_7_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_7_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_8_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_8_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_8_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_8_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_basic_9_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_9_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_basic_9_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_basic_9_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_10_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_10_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_10_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_10_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_11_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_11_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_11_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_11_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_12_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_12_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_12_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_12_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_13_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_13_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_13_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_13_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_14_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_14_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_14_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_14_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_15_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_15_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_15_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_15_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_16_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_16_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_16_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_16_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_17_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_17_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_17_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_17_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_18_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_18_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_18_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_18_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_3_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_3_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_3_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_3_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_4_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_4_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_4_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_4_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_5_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_5_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_5_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_5_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_6_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_6_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_6_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_6_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_7_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_7_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_7_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_7_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_8_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_8_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_8_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_8_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_leaf_9_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_9_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_leaf_9_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_leaf_9_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_node_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_node_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_node_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_node_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_recursion_tip_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_recursion_tip_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_recursion_tip_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_recursion_tip_key.json diff --git a/prover/vk_setup_data_generator_server_fri/data/verification_scheduler_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_scheduler_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/data/verification_scheduler_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/data/verification_scheduler_key.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/0.24.0/commitments.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/0.24.0/commitments.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/0.24.0/commitments.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/0.24.0/commitments.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/0.24.0/snark_verification_scheduler_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/0.24.0/snark_verification_scheduler_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/0.24.0/snark_verification_scheduler_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/0.24.0/snark_verification_scheduler_key.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/0.24.1/commitments.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/0.24.1/commitments.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/0.24.1/commitments.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/0.24.1/commitments.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/0.24.1/snark_verification_scheduler_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/0.24.1/snark_verification_scheduler_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/0.24.1/snark_verification_scheduler_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/0.24.1/snark_verification_scheduler_key.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/18/commitments.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/18/commitments.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/18/commitments.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/18/commitments.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/18/snark_verification_scheduler_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/18/snark_verification_scheduler_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/18/snark_verification_scheduler_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/18/snark_verification_scheduler_key.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/19/commitments.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/19/commitments.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/19/commitments.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/19/commitments.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/19/snark_verification_scheduler_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/19/snark_verification_scheduler_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/19/snark_verification_scheduler_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/19/snark_verification_scheduler_key.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/20/commitments.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/20/commitments.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/20/commitments.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/20/commitments.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/20/snark_verification_scheduler_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/20/snark_verification_scheduler_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/20/snark_verification_scheduler_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/20/snark_verification_scheduler_key.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/21/commitments.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/21/commitments.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/21/commitments.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/21/commitments.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/21/snark_verification_scheduler_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/21/snark_verification_scheduler_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/21/snark_verification_scheduler_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/21/snark_verification_scheduler_key.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/22/commitments.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/22/commitments.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/22/commitments.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/22/commitments.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/22/snark_verification_scheduler_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/22/snark_verification_scheduler_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/22/snark_verification_scheduler_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/22/snark_verification_scheduler_key.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/23/commitments.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/23/commitments.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/23/commitments.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/23/commitments.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/23/snark_verification_scheduler_key.json b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/23/snark_verification_scheduler_key.json similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/23/snark_verification_scheduler_key.json rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/23/snark_verification_scheduler_key.json diff --git a/prover/vk_setup_data_generator_server_fri/historical_data/README.md b/prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/README.md similarity index 100% rename from prover/vk_setup_data_generator_server_fri/historical_data/README.md rename to prover/crates/bin/vk_setup_data_generator_server_fri/historical_data/README.md diff --git a/prover/vk_setup_data_generator_server_fri/src/commitment_generator.rs b/prover/crates/bin/vk_setup_data_generator_server_fri/src/commitment_generator.rs similarity index 100% rename from prover/vk_setup_data_generator_server_fri/src/commitment_generator.rs rename to prover/crates/bin/vk_setup_data_generator_server_fri/src/commitment_generator.rs diff --git a/prover/vk_setup_data_generator_server_fri/src/commitment_utils.rs b/prover/crates/bin/vk_setup_data_generator_server_fri/src/commitment_utils.rs similarity index 100% rename from prover/vk_setup_data_generator_server_fri/src/commitment_utils.rs rename to prover/crates/bin/vk_setup_data_generator_server_fri/src/commitment_utils.rs diff --git a/prover/vk_setup_data_generator_server_fri/src/keystore.rs b/prover/crates/bin/vk_setup_data_generator_server_fri/src/keystore.rs similarity index 99% rename from prover/vk_setup_data_generator_server_fri/src/keystore.rs rename to prover/crates/bin/vk_setup_data_generator_server_fri/src/keystore.rs index 70aaff9fc4a4..e886b5d1b0c0 100644 --- a/prover/vk_setup_data_generator_server_fri/src/keystore.rs +++ b/prover/crates/bin/vk_setup_data_generator_server_fri/src/keystore.rs @@ -47,7 +47,7 @@ pub struct Keystore { fn get_base_path() -> PathBuf { let path = core_workspace_dir_or_current_dir(); - let new_path = path.join("prover/vk_setup_data_generator_server_fri/data"); + let new_path = path.join("prover/crates/bin/vk_setup_data_generator_server_fri/data"); if new_path.exists() { return new_path; } @@ -56,7 +56,7 @@ fn get_base_path() -> PathBuf { components.next_back().unwrap(); components .as_path() - .join("prover/vk_setup_data_generator_server_fri/data") + .join("prover/crates/bin/vk_setup_data_generator_server_fri/data") } impl Default for Keystore { diff --git a/prover/vk_setup_data_generator_server_fri/src/lib.rs b/prover/crates/bin/vk_setup_data_generator_server_fri/src/lib.rs similarity index 100% rename from prover/vk_setup_data_generator_server_fri/src/lib.rs rename to prover/crates/bin/vk_setup_data_generator_server_fri/src/lib.rs diff --git a/prover/vk_setup_data_generator_server_fri/src/main.rs b/prover/crates/bin/vk_setup_data_generator_server_fri/src/main.rs similarity index 100% rename from prover/vk_setup_data_generator_server_fri/src/main.rs rename to prover/crates/bin/vk_setup_data_generator_server_fri/src/main.rs diff --git a/prover/vk_setup_data_generator_server_fri/src/setup_data_generator.rs b/prover/crates/bin/vk_setup_data_generator_server_fri/src/setup_data_generator.rs similarity index 100% rename from prover/vk_setup_data_generator_server_fri/src/setup_data_generator.rs rename to prover/crates/bin/vk_setup_data_generator_server_fri/src/setup_data_generator.rs diff --git a/prover/vk_setup_data_generator_server_fri/src/tests.rs b/prover/crates/bin/vk_setup_data_generator_server_fri/src/tests.rs similarity index 100% rename from prover/vk_setup_data_generator_server_fri/src/tests.rs rename to prover/crates/bin/vk_setup_data_generator_server_fri/src/tests.rs diff --git a/prover/vk_setup_data_generator_server_fri/src/utils.rs b/prover/crates/bin/vk_setup_data_generator_server_fri/src/utils.rs similarity index 100% rename from prover/vk_setup_data_generator_server_fri/src/utils.rs rename to prover/crates/bin/vk_setup_data_generator_server_fri/src/utils.rs diff --git a/prover/vk_setup_data_generator_server_fri/src/vk_commitment_helper.rs b/prover/crates/bin/vk_setup_data_generator_server_fri/src/vk_commitment_helper.rs similarity index 100% rename from prover/vk_setup_data_generator_server_fri/src/vk_commitment_helper.rs rename to prover/crates/bin/vk_setup_data_generator_server_fri/src/vk_commitment_helper.rs diff --git a/prover/witness_generator/Cargo.toml b/prover/crates/bin/witness_generator/Cargo.toml similarity index 100% rename from prover/witness_generator/Cargo.toml rename to prover/crates/bin/witness_generator/Cargo.toml diff --git a/prover/witness_generator/README.md b/prover/crates/bin/witness_generator/README.md similarity index 100% rename from prover/witness_generator/README.md rename to prover/crates/bin/witness_generator/README.md diff --git a/prover/witness_generator/src/basic_circuits.rs b/prover/crates/bin/witness_generator/src/basic_circuits.rs similarity index 100% rename from prover/witness_generator/src/basic_circuits.rs rename to prover/crates/bin/witness_generator/src/basic_circuits.rs diff --git a/prover/witness_generator/src/leaf_aggregation.rs b/prover/crates/bin/witness_generator/src/leaf_aggregation.rs similarity index 100% rename from prover/witness_generator/src/leaf_aggregation.rs rename to prover/crates/bin/witness_generator/src/leaf_aggregation.rs diff --git a/prover/witness_generator/src/lib.rs b/prover/crates/bin/witness_generator/src/lib.rs similarity index 100% rename from prover/witness_generator/src/lib.rs rename to prover/crates/bin/witness_generator/src/lib.rs diff --git a/prover/witness_generator/src/main.rs b/prover/crates/bin/witness_generator/src/main.rs similarity index 100% rename from prover/witness_generator/src/main.rs rename to prover/crates/bin/witness_generator/src/main.rs diff --git a/prover/witness_generator/src/metrics.rs b/prover/crates/bin/witness_generator/src/metrics.rs similarity index 100% rename from prover/witness_generator/src/metrics.rs rename to prover/crates/bin/witness_generator/src/metrics.rs diff --git a/prover/witness_generator/src/node_aggregation.rs b/prover/crates/bin/witness_generator/src/node_aggregation.rs similarity index 100% rename from prover/witness_generator/src/node_aggregation.rs rename to prover/crates/bin/witness_generator/src/node_aggregation.rs diff --git a/prover/witness_generator/src/precalculated_merkle_paths_provider.rs b/prover/crates/bin/witness_generator/src/precalculated_merkle_paths_provider.rs similarity index 100% rename from prover/witness_generator/src/precalculated_merkle_paths_provider.rs rename to prover/crates/bin/witness_generator/src/precalculated_merkle_paths_provider.rs diff --git a/prover/witness_generator/src/recursion_tip.rs b/prover/crates/bin/witness_generator/src/recursion_tip.rs similarity index 100% rename from prover/witness_generator/src/recursion_tip.rs rename to prover/crates/bin/witness_generator/src/recursion_tip.rs diff --git a/prover/witness_generator/src/scheduler.rs b/prover/crates/bin/witness_generator/src/scheduler.rs similarity index 100% rename from prover/witness_generator/src/scheduler.rs rename to prover/crates/bin/witness_generator/src/scheduler.rs diff --git a/prover/witness_generator/src/storage_oracle.rs b/prover/crates/bin/witness_generator/src/storage_oracle.rs similarity index 100% rename from prover/witness_generator/src/storage_oracle.rs rename to prover/crates/bin/witness_generator/src/storage_oracle.rs diff --git a/prover/witness_generator/src/tests.rs b/prover/crates/bin/witness_generator/src/tests.rs similarity index 100% rename from prover/witness_generator/src/tests.rs rename to prover/crates/bin/witness_generator/src/tests.rs diff --git a/prover/witness_generator/src/trusted_setup.json b/prover/crates/bin/witness_generator/src/trusted_setup.json similarity index 100% rename from prover/witness_generator/src/trusted_setup.json rename to prover/crates/bin/witness_generator/src/trusted_setup.json diff --git a/prover/witness_generator/src/utils.rs b/prover/crates/bin/witness_generator/src/utils.rs similarity index 100% rename from prover/witness_generator/src/utils.rs rename to prover/crates/bin/witness_generator/src/utils.rs diff --git a/prover/witness_generator/tests/basic_test.rs b/prover/crates/bin/witness_generator/tests/basic_test.rs similarity index 100% rename from prover/witness_generator/tests/basic_test.rs rename to prover/crates/bin/witness_generator/tests/basic_test.rs diff --git a/prover/witness_generator/tests/data/leaf/leaf_aggregation_witness_jobs_fri/closed_form_inputs_125010_4.bin b/prover/crates/bin/witness_generator/tests/data/leaf/leaf_aggregation_witness_jobs_fri/closed_form_inputs_125010_4.bin similarity index 100% rename from prover/witness_generator/tests/data/leaf/leaf_aggregation_witness_jobs_fri/closed_form_inputs_125010_4.bin rename to prover/crates/bin/witness_generator/tests/data/leaf/leaf_aggregation_witness_jobs_fri/closed_form_inputs_125010_4.bin diff --git a/prover/witness_generator/tests/data/leaf/node_aggregation_witness_jobs_fri/aggregations_125010_6_0.bin b/prover/crates/bin/witness_generator/tests/data/leaf/node_aggregation_witness_jobs_fri/aggregations_125010_6_0.bin similarity index 100% rename from prover/witness_generator/tests/data/leaf/node_aggregation_witness_jobs_fri/aggregations_125010_6_0.bin rename to prover/crates/bin/witness_generator/tests/data/leaf/node_aggregation_witness_jobs_fri/aggregations_125010_6_0.bin diff --git a/prover/witness_generator/tests/data/leaf/proofs_fri/proof_4639043.bin b/prover/crates/bin/witness_generator/tests/data/leaf/proofs_fri/proof_4639043.bin similarity index 100% rename from prover/witness_generator/tests/data/leaf/proofs_fri/proof_4639043.bin rename to prover/crates/bin/witness_generator/tests/data/leaf/proofs_fri/proof_4639043.bin diff --git a/prover/witness_generator/tests/data/leaf/proofs_fri/proof_4639044.bin b/prover/crates/bin/witness_generator/tests/data/leaf/proofs_fri/proof_4639044.bin similarity index 100% rename from prover/witness_generator/tests/data/leaf/proofs_fri/proof_4639044.bin rename to prover/crates/bin/witness_generator/tests/data/leaf/proofs_fri/proof_4639044.bin diff --git a/prover/witness_generator/tests/data/leaf/proofs_fri/proof_4639045.bin b/prover/crates/bin/witness_generator/tests/data/leaf/proofs_fri/proof_4639045.bin similarity index 100% rename from prover/witness_generator/tests/data/leaf/proofs_fri/proof_4639045.bin rename to prover/crates/bin/witness_generator/tests/data/leaf/proofs_fri/proof_4639045.bin diff --git a/prover/witness_generator/tests/data/node/node_aggregation_witness_jobs_fri/aggregations_127856_8_0.bin b/prover/crates/bin/witness_generator/tests/data/node/node_aggregation_witness_jobs_fri/aggregations_127856_8_0.bin similarity index 100% rename from prover/witness_generator/tests/data/node/node_aggregation_witness_jobs_fri/aggregations_127856_8_0.bin rename to prover/crates/bin/witness_generator/tests/data/node/node_aggregation_witness_jobs_fri/aggregations_127856_8_0.bin diff --git a/prover/witness_generator/tests/data/node/node_aggregation_witness_jobs_fri/aggregations_127856_8_1.bin b/prover/crates/bin/witness_generator/tests/data/node/node_aggregation_witness_jobs_fri/aggregations_127856_8_1.bin similarity index 100% rename from prover/witness_generator/tests/data/node/node_aggregation_witness_jobs_fri/aggregations_127856_8_1.bin rename to prover/crates/bin/witness_generator/tests/data/node/node_aggregation_witness_jobs_fri/aggregations_127856_8_1.bin diff --git a/prover/witness_generator/tests/data/node/proofs_fri/proof_5211320.bin b/prover/crates/bin/witness_generator/tests/data/node/proofs_fri/proof_5211320.bin similarity index 100% rename from prover/witness_generator/tests/data/node/proofs_fri/proof_5211320.bin rename to prover/crates/bin/witness_generator/tests/data/node/proofs_fri/proof_5211320.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627082.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627082.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627082.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627082.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627083.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627083.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627083.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627083.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627084.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627084.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627084.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627084.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627085.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627085.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627085.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627085.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627086.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627086.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627086.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627086.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627090.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627090.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627090.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627090.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627091.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627091.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627091.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627091.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627092.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627092.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627092.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627092.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627093.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627093.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627093.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627093.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627094.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627094.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5627094.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5627094.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5629097.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5629097.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5629097.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5629097.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5631320.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5631320.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5631320.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5631320.bin diff --git a/prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5639969.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5639969.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/proofs_fri/proof_5639969.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/proofs_fri/proof_5639969.bin diff --git a/prover/witness_generator/tests/data/scheduler/prover_jobs_fri/128599_0_1_Scheduler_0.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/prover_jobs_fri/128599_0_1_Scheduler_0.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/prover_jobs_fri/128599_0_1_Scheduler_0.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/prover_jobs_fri/128599_0_1_Scheduler_0.bin diff --git a/prover/witness_generator/tests/data/scheduler/scheduler_witness_jobs_fri/scheduler_witness_128599.bin b/prover/crates/bin/witness_generator/tests/data/scheduler/scheduler_witness_jobs_fri/scheduler_witness_128599.bin similarity index 100% rename from prover/witness_generator/tests/data/scheduler/scheduler_witness_jobs_fri/scheduler_witness_128599.bin rename to prover/crates/bin/witness_generator/tests/data/scheduler/scheduler_witness_jobs_fri/scheduler_witness_128599.bin diff --git a/prover/witness_vector_generator/Cargo.toml b/prover/crates/bin/witness_vector_generator/Cargo.toml similarity index 100% rename from prover/witness_vector_generator/Cargo.toml rename to prover/crates/bin/witness_vector_generator/Cargo.toml diff --git a/prover/witness_vector_generator/README.md b/prover/crates/bin/witness_vector_generator/README.md similarity index 100% rename from prover/witness_vector_generator/README.md rename to prover/crates/bin/witness_vector_generator/README.md diff --git a/prover/witness_vector_generator/src/generator.rs b/prover/crates/bin/witness_vector_generator/src/generator.rs similarity index 97% rename from prover/witness_vector_generator/src/generator.rs rename to prover/crates/bin/witness_vector_generator/src/generator.rs index d2b13beccd61..5574f0f1578d 100644 --- a/prover/witness_vector_generator/src/generator.rs +++ b/prover/crates/bin/witness_vector_generator/src/generator.rs @@ -15,7 +15,7 @@ use zksync_prover_fri_types::{ WitnessVectorArtifacts, }; use zksync_prover_fri_utils::{ - fetch_next_circuit, get_numeric_circuit_id, socket_utils::send_assembly, + fetch_next_circuit, get_numeric_circuit_id, region_fetcher::Zone, socket_utils::send_assembly, }; use zksync_queued_job_processor::JobProcessor; use zksync_types::{ @@ -30,7 +30,7 @@ pub struct WitnessVectorGenerator { object_store: Arc, pool: ConnectionPool, circuit_ids_for_round_to_be_proven: Vec, - zone: String, + zone: Zone, config: FriWitnessVectorGeneratorConfig, protocol_version: ProtocolSemanticVersion, max_attempts: u32, @@ -43,7 +43,7 @@ impl WitnessVectorGenerator { object_store: Arc, prover_connection_pool: ConnectionPool, circuit_ids_for_round_to_be_proven: Vec, - zone: String, + zone: Zone, config: FriWitnessVectorGeneratorConfig, protocol_version: ProtocolSemanticVersion, max_attempts: u32, @@ -167,7 +167,7 @@ impl JobProcessor for WitnessVectorGenerator { .lock_available_prover( self.config.max_prover_reservation_duration(), self.config.specialized_group_id, - self.zone.clone(), + self.zone.to_string(), self.protocol_version, ) .await; @@ -179,7 +179,8 @@ impl JobProcessor for WitnessVectorGenerator { now.elapsed() ); let result = send_assembly(job_id, &serialized, &address); - handle_send_result(&result, job_id, &address, &self.pool, self.zone.clone()).await; + handle_send_result(&result, job_id, &address, &self.pool, self.zone.to_string()) + .await; if result.is_ok() { METRICS.prover_waiting_time[&circuit_type].observe(now.elapsed()); diff --git a/prover/witness_vector_generator/src/lib.rs b/prover/crates/bin/witness_vector_generator/src/lib.rs similarity index 100% rename from prover/witness_vector_generator/src/lib.rs rename to prover/crates/bin/witness_vector_generator/src/lib.rs diff --git a/prover/witness_vector_generator/src/main.rs b/prover/crates/bin/witness_vector_generator/src/main.rs similarity index 92% rename from prover/witness_vector_generator/src/main.rs rename to prover/crates/bin/witness_vector_generator/src/main.rs index cb61be4227c9..58db6d6d5eb4 100644 --- a/prover/witness_vector_generator/src/main.rs +++ b/prover/crates/bin/witness_vector_generator/src/main.rs @@ -11,7 +11,7 @@ use zksync_env_config::object_store::ProverObjectStoreConfig; use zksync_object_store::ObjectStoreFactory; use zksync_prover_dal::ConnectionPool; use zksync_prover_fri_types::PROVER_PROTOCOL_SEMANTIC_VERSION; -use zksync_prover_fri_utils::{get_all_circuit_id_round_tuples_for, region_fetcher::get_zone}; +use zksync_prover_fri_utils::{get_all_circuit_id_round_tuples_for, region_fetcher::RegionFetcher}; use zksync_queued_job_processor::JobProcessor; use zksync_utils::wait_for_tasks::ManagedTasks; use zksync_vlog::prometheus::PrometheusExporterConfig; @@ -95,9 +95,14 @@ async fn main() -> anyhow::Result<()> { .unwrap_or_default(); let circuit_ids_for_round_to_be_proven = get_all_circuit_id_round_tuples_for(circuit_ids_for_round_to_be_proven); - let fri_prover_config = general_config.prover_config.context("prover config")?; - let zone_url = &fri_prover_config.zone_read_url; - let zone = get_zone(zone_url).await.context("get_zone()")?; + let prover_config = general_config.prover_config.context("prover config")?; + let zone = RegionFetcher::new( + prover_config.cloud_type, + prover_config.zone_read_url.clone(), + ) + .get_zone() + .await + .context("get_zone()")?; let protocol_version = PROVER_PROTOCOL_SEMANTIC_VERSION; @@ -108,8 +113,8 @@ async fn main() -> anyhow::Result<()> { zone.clone(), config, protocol_version, - fri_prover_config.max_attempts, - Some(fri_prover_config.setup_data_path.clone()), + prover_config.max_attempts, + Some(prover_config.setup_data_path.clone()), ); let (stop_sender, stop_receiver) = watch::channel(false); diff --git a/prover/witness_vector_generator/src/metrics.rs b/prover/crates/bin/witness_vector_generator/src/metrics.rs similarity index 100% rename from prover/witness_vector_generator/src/metrics.rs rename to prover/crates/bin/witness_vector_generator/src/metrics.rs diff --git a/prover/witness_vector_generator/tests/basic_test.rs b/prover/crates/bin/witness_vector_generator/tests/basic_test.rs similarity index 100% rename from prover/witness_vector_generator/tests/basic_test.rs rename to prover/crates/bin/witness_vector_generator/tests/basic_test.rs diff --git a/prover/witness_vector_generator/tests/data/base_layer_main_vm.bin b/prover/crates/bin/witness_vector_generator/tests/data/base_layer_main_vm.bin similarity index 100% rename from prover/witness_vector_generator/tests/data/base_layer_main_vm.bin rename to prover/crates/bin/witness_vector_generator/tests/data/base_layer_main_vm.bin diff --git a/prover/prover_dal/.sqlx/query-00b88ec7fcf40bb18e0018b7c76f6e1df560ab1e8935564355236e90b6147d2f.json b/prover/crates/lib/prover_dal/.sqlx/query-00b88ec7fcf40bb18e0018b7c76f6e1df560ab1e8935564355236e90b6147d2f.json similarity index 100% rename from prover/prover_dal/.sqlx/query-00b88ec7fcf40bb18e0018b7c76f6e1df560ab1e8935564355236e90b6147d2f.json rename to prover/crates/lib/prover_dal/.sqlx/query-00b88ec7fcf40bb18e0018b7c76f6e1df560ab1e8935564355236e90b6147d2f.json diff --git a/prover/prover_dal/.sqlx/query-02f2010c60dfa5b93d3f2ee7594579b23540815afa1c6a8d4c36bba951861fe7.json b/prover/crates/lib/prover_dal/.sqlx/query-02f2010c60dfa5b93d3f2ee7594579b23540815afa1c6a8d4c36bba951861fe7.json similarity index 100% rename from prover/prover_dal/.sqlx/query-02f2010c60dfa5b93d3f2ee7594579b23540815afa1c6a8d4c36bba951861fe7.json rename to prover/crates/lib/prover_dal/.sqlx/query-02f2010c60dfa5b93d3f2ee7594579b23540815afa1c6a8d4c36bba951861fe7.json diff --git a/prover/prover_dal/.sqlx/query-069f04bdfafbe2e3628ac3ded93dab9b63eee7f21c450a723e4ba011edc8e2bb.json b/prover/crates/lib/prover_dal/.sqlx/query-069f04bdfafbe2e3628ac3ded93dab9b63eee7f21c450a723e4ba011edc8e2bb.json similarity index 100% rename from prover/prover_dal/.sqlx/query-069f04bdfafbe2e3628ac3ded93dab9b63eee7f21c450a723e4ba011edc8e2bb.json rename to prover/crates/lib/prover_dal/.sqlx/query-069f04bdfafbe2e3628ac3ded93dab9b63eee7f21c450a723e4ba011edc8e2bb.json diff --git a/prover/prover_dal/.sqlx/query-081e2b928f0816c41d6645c1dedbb3402044d201e85e114ff4582394c32bd2bf.json b/prover/crates/lib/prover_dal/.sqlx/query-081e2b928f0816c41d6645c1dedbb3402044d201e85e114ff4582394c32bd2bf.json similarity index 100% rename from prover/prover_dal/.sqlx/query-081e2b928f0816c41d6645c1dedbb3402044d201e85e114ff4582394c32bd2bf.json rename to prover/crates/lib/prover_dal/.sqlx/query-081e2b928f0816c41d6645c1dedbb3402044d201e85e114ff4582394c32bd2bf.json diff --git a/prover/prover_dal/.sqlx/query-0a1ec4690d6b4a67d6ad16badcbf113a19feb73c4cf9876855523499998b99c0.json b/prover/crates/lib/prover_dal/.sqlx/query-0a1ec4690d6b4a67d6ad16badcbf113a19feb73c4cf9876855523499998b99c0.json similarity index 100% rename from prover/prover_dal/.sqlx/query-0a1ec4690d6b4a67d6ad16badcbf113a19feb73c4cf9876855523499998b99c0.json rename to prover/crates/lib/prover_dal/.sqlx/query-0a1ec4690d6b4a67d6ad16badcbf113a19feb73c4cf9876855523499998b99c0.json diff --git a/prover/prover_dal/.sqlx/query-0b70c98c2edd8370ad09ac553c18dbc21cccb9a95e3db1c93da239845a5e9036.json b/prover/crates/lib/prover_dal/.sqlx/query-0b70c98c2edd8370ad09ac553c18dbc21cccb9a95e3db1c93da239845a5e9036.json similarity index 100% rename from prover/prover_dal/.sqlx/query-0b70c98c2edd8370ad09ac553c18dbc21cccb9a95e3db1c93da239845a5e9036.json rename to prover/crates/lib/prover_dal/.sqlx/query-0b70c98c2edd8370ad09ac553c18dbc21cccb9a95e3db1c93da239845a5e9036.json diff --git a/prover/prover_dal/.sqlx/query-16548daf69e9ff0528904be2e142254a457665179d9cf0a3c0b18c3fe09e4838.json b/prover/crates/lib/prover_dal/.sqlx/query-16548daf69e9ff0528904be2e142254a457665179d9cf0a3c0b18c3fe09e4838.json similarity index 100% rename from prover/prover_dal/.sqlx/query-16548daf69e9ff0528904be2e142254a457665179d9cf0a3c0b18c3fe09e4838.json rename to prover/crates/lib/prover_dal/.sqlx/query-16548daf69e9ff0528904be2e142254a457665179d9cf0a3c0b18c3fe09e4838.json diff --git a/prover/prover_dal/.sqlx/query-1849cfa3167eed2809e7724a63198f5e2450cc4faee2f80b37fbd5626324dbeb.json b/prover/crates/lib/prover_dal/.sqlx/query-1849cfa3167eed2809e7724a63198f5e2450cc4faee2f80b37fbd5626324dbeb.json similarity index 100% rename from prover/prover_dal/.sqlx/query-1849cfa3167eed2809e7724a63198f5e2450cc4faee2f80b37fbd5626324dbeb.json rename to prover/crates/lib/prover_dal/.sqlx/query-1849cfa3167eed2809e7724a63198f5e2450cc4faee2f80b37fbd5626324dbeb.json diff --git a/prover/prover_dal/.sqlx/query-2095e5646c382ccbc6e3bafdeddaae31358088e142dff51c9f0bde8f386900d3.json b/prover/crates/lib/prover_dal/.sqlx/query-2095e5646c382ccbc6e3bafdeddaae31358088e142dff51c9f0bde8f386900d3.json similarity index 100% rename from prover/prover_dal/.sqlx/query-2095e5646c382ccbc6e3bafdeddaae31358088e142dff51c9f0bde8f386900d3.json rename to prover/crates/lib/prover_dal/.sqlx/query-2095e5646c382ccbc6e3bafdeddaae31358088e142dff51c9f0bde8f386900d3.json diff --git a/prover/prover_dal/.sqlx/query-21621153e545859d71188e2421f5d2832571464e74b5fed92cf54617573c84ec.json b/prover/crates/lib/prover_dal/.sqlx/query-21621153e545859d71188e2421f5d2832571464e74b5fed92cf54617573c84ec.json similarity index 94% rename from prover/prover_dal/.sqlx/query-21621153e545859d71188e2421f5d2832571464e74b5fed92cf54617573c84ec.json rename to prover/crates/lib/prover_dal/.sqlx/query-21621153e545859d71188e2421f5d2832571464e74b5fed92cf54617573c84ec.json index e24d2c979a35..b5f056e1ecd9 100644 --- a/prover/prover_dal/.sqlx/query-21621153e545859d71188e2421f5d2832571464e74b5fed92cf54617573c84ec.json +++ b/prover/crates/lib/prover_dal/.sqlx/query-21621153e545859d71188e2421f5d2832571464e74b5fed92cf54617573c84ec.json @@ -60,26 +60,21 @@ }, { "ordinal": 11, - "name": "is_blob_cleaned", - "type_info": "Bool" - }, - { - "ordinal": 12, "name": "number_of_basic_circuits", "type_info": "Int4" }, { - "ordinal": 13, + "ordinal": 12, "name": "protocol_version", "type_info": "Int4" }, { - "ordinal": 14, + "ordinal": 13, "name": "picked_by", "type_info": "Text" }, { - "ordinal": 15, + "ordinal": 14, "name": "protocol_version_patch", "type_info": "Int4" } @@ -104,7 +99,6 @@ true, true, true, - true, false ] }, diff --git a/prover/prover_dal/.sqlx/query-28397b5a0b7af832d2a4d3d7011a68a48db6a64afcd41bbe0e17d98fa38fdb19.json b/prover/crates/lib/prover_dal/.sqlx/query-28397b5a0b7af832d2a4d3d7011a68a48db6a64afcd41bbe0e17d98fa38fdb19.json similarity index 100% rename from prover/prover_dal/.sqlx/query-28397b5a0b7af832d2a4d3d7011a68a48db6a64afcd41bbe0e17d98fa38fdb19.json rename to prover/crates/lib/prover_dal/.sqlx/query-28397b5a0b7af832d2a4d3d7011a68a48db6a64afcd41bbe0e17d98fa38fdb19.json diff --git a/prover/prover_dal/.sqlx/query-285d0ff850fa5c9af36564fcb14dd8547a1ad20492ec37c3c0be5639e5d49952.json b/prover/crates/lib/prover_dal/.sqlx/query-285d0ff850fa5c9af36564fcb14dd8547a1ad20492ec37c3c0be5639e5d49952.json similarity index 100% rename from prover/prover_dal/.sqlx/query-285d0ff850fa5c9af36564fcb14dd8547a1ad20492ec37c3c0be5639e5d49952.json rename to prover/crates/lib/prover_dal/.sqlx/query-285d0ff850fa5c9af36564fcb14dd8547a1ad20492ec37c3c0be5639e5d49952.json diff --git a/prover/prover_dal/.sqlx/query-28f03acf565c4b50fe86f606c18a8b699386b3c5b4e02d5ce046f0f2e0ddc388.json b/prover/crates/lib/prover_dal/.sqlx/query-28f03acf565c4b50fe86f606c18a8b699386b3c5b4e02d5ce046f0f2e0ddc388.json similarity index 100% rename from prover/prover_dal/.sqlx/query-28f03acf565c4b50fe86f606c18a8b699386b3c5b4e02d5ce046f0f2e0ddc388.json rename to prover/crates/lib/prover_dal/.sqlx/query-28f03acf565c4b50fe86f606c18a8b699386b3c5b4e02d5ce046f0f2e0ddc388.json diff --git a/prover/prover_dal/.sqlx/query-29ff260b02f7b955f9fe0b657b87def3a97275b66ad33d214054dc9048ddf584.json b/prover/crates/lib/prover_dal/.sqlx/query-29ff260b02f7b955f9fe0b657b87def3a97275b66ad33d214054dc9048ddf584.json similarity index 100% rename from prover/prover_dal/.sqlx/query-29ff260b02f7b955f9fe0b657b87def3a97275b66ad33d214054dc9048ddf584.json rename to prover/crates/lib/prover_dal/.sqlx/query-29ff260b02f7b955f9fe0b657b87def3a97275b66ad33d214054dc9048ddf584.json diff --git a/prover/prover_dal/.sqlx/query-2ab2f83b273c5aa88c1eefc8f70a8ea23052f714cd74c1d28ae1203ce8f0eaa9.json b/prover/crates/lib/prover_dal/.sqlx/query-2ab2f83b273c5aa88c1eefc8f70a8ea23052f714cd74c1d28ae1203ce8f0eaa9.json similarity index 100% rename from prover/prover_dal/.sqlx/query-2ab2f83b273c5aa88c1eefc8f70a8ea23052f714cd74c1d28ae1203ce8f0eaa9.json rename to prover/crates/lib/prover_dal/.sqlx/query-2ab2f83b273c5aa88c1eefc8f70a8ea23052f714cd74c1d28ae1203ce8f0eaa9.json diff --git a/prover/prover_dal/.sqlx/query-2b626262c8003817ee02978f77452554ccfb5b83f00efdc12bed0f60ef439785.json b/prover/crates/lib/prover_dal/.sqlx/query-2b626262c8003817ee02978f77452554ccfb5b83f00efdc12bed0f60ef439785.json similarity index 100% rename from prover/prover_dal/.sqlx/query-2b626262c8003817ee02978f77452554ccfb5b83f00efdc12bed0f60ef439785.json rename to prover/crates/lib/prover_dal/.sqlx/query-2b626262c8003817ee02978f77452554ccfb5b83f00efdc12bed0f60ef439785.json diff --git a/prover/prover_dal/.sqlx/query-2dc6b7bf08cced8791354fc47e319d03f894f40d2ec528382b5643c3d51ec8e7.json b/prover/crates/lib/prover_dal/.sqlx/query-2dc6b7bf08cced8791354fc47e319d03f894f40d2ec528382b5643c3d51ec8e7.json similarity index 100% rename from prover/prover_dal/.sqlx/query-2dc6b7bf08cced8791354fc47e319d03f894f40d2ec528382b5643c3d51ec8e7.json rename to prover/crates/lib/prover_dal/.sqlx/query-2dc6b7bf08cced8791354fc47e319d03f894f40d2ec528382b5643c3d51ec8e7.json diff --git a/prover/prover_dal/.sqlx/query-2df88abaae97b6f916b104375bd7249ec09c0daf4368021788207370213a6d94.json b/prover/crates/lib/prover_dal/.sqlx/query-2df88abaae97b6f916b104375bd7249ec09c0daf4368021788207370213a6d94.json similarity index 100% rename from prover/prover_dal/.sqlx/query-2df88abaae97b6f916b104375bd7249ec09c0daf4368021788207370213a6d94.json rename to prover/crates/lib/prover_dal/.sqlx/query-2df88abaae97b6f916b104375bd7249ec09c0daf4368021788207370213a6d94.json diff --git a/prover/prover_dal/.sqlx/query-2e6e2b68efc28114f44616b68fcf1d4d9a4b83a8b42846d8373ea13b96d612cf.json b/prover/crates/lib/prover_dal/.sqlx/query-2e6e2b68efc28114f44616b68fcf1d4d9a4b83a8b42846d8373ea13b96d612cf.json similarity index 100% rename from prover/prover_dal/.sqlx/query-2e6e2b68efc28114f44616b68fcf1d4d9a4b83a8b42846d8373ea13b96d612cf.json rename to prover/crates/lib/prover_dal/.sqlx/query-2e6e2b68efc28114f44616b68fcf1d4d9a4b83a8b42846d8373ea13b96d612cf.json diff --git a/prover/prover_dal/.sqlx/query-3902f6a8e09cd5ad560d23fe0269fd5b3d210a117bb0027d58c6cb4debd63f33.json b/prover/crates/lib/prover_dal/.sqlx/query-3902f6a8e09cd5ad560d23fe0269fd5b3d210a117bb0027d58c6cb4debd63f33.json similarity index 100% rename from prover/prover_dal/.sqlx/query-3902f6a8e09cd5ad560d23fe0269fd5b3d210a117bb0027d58c6cb4debd63f33.json rename to prover/crates/lib/prover_dal/.sqlx/query-3902f6a8e09cd5ad560d23fe0269fd5b3d210a117bb0027d58c6cb4debd63f33.json diff --git a/prover/prover_dal/.sqlx/query-3941da180ee62a7c5d4e392ff4fe2d3a6ebb3657862b91e3ece34119f098fc2d.json b/prover/crates/lib/prover_dal/.sqlx/query-3941da180ee62a7c5d4e392ff4fe2d3a6ebb3657862b91e3ece34119f098fc2d.json similarity index 100% rename from prover/prover_dal/.sqlx/query-3941da180ee62a7c5d4e392ff4fe2d3a6ebb3657862b91e3ece34119f098fc2d.json rename to prover/crates/lib/prover_dal/.sqlx/query-3941da180ee62a7c5d4e392ff4fe2d3a6ebb3657862b91e3ece34119f098fc2d.json diff --git a/prover/prover_dal/.sqlx/query-3c3abbf689fa64c6da7de69fd916769dbb04d3a61cf232892236c974660ffe64.json b/prover/crates/lib/prover_dal/.sqlx/query-3c3abbf689fa64c6da7de69fd916769dbb04d3a61cf232892236c974660ffe64.json similarity index 100% rename from prover/prover_dal/.sqlx/query-3c3abbf689fa64c6da7de69fd916769dbb04d3a61cf232892236c974660ffe64.json rename to prover/crates/lib/prover_dal/.sqlx/query-3c3abbf689fa64c6da7de69fd916769dbb04d3a61cf232892236c974660ffe64.json diff --git a/prover/prover_dal/.sqlx/query-3e0a1ebc684810c09ff83784bdd0ad195b0dd2a8ce56b1a9eb531103130b5e3e.json b/prover/crates/lib/prover_dal/.sqlx/query-3e0a1ebc684810c09ff83784bdd0ad195b0dd2a8ce56b1a9eb531103130b5e3e.json similarity index 100% rename from prover/prover_dal/.sqlx/query-3e0a1ebc684810c09ff83784bdd0ad195b0dd2a8ce56b1a9eb531103130b5e3e.json rename to prover/crates/lib/prover_dal/.sqlx/query-3e0a1ebc684810c09ff83784bdd0ad195b0dd2a8ce56b1a9eb531103130b5e3e.json diff --git a/prover/prover_dal/.sqlx/query-3ec365c5c81f4678a905ae5bbd48b87ead36f593488437c6f67da629ca81e4fa.json b/prover/crates/lib/prover_dal/.sqlx/query-3ec365c5c81f4678a905ae5bbd48b87ead36f593488437c6f67da629ca81e4fa.json similarity index 100% rename from prover/prover_dal/.sqlx/query-3ec365c5c81f4678a905ae5bbd48b87ead36f593488437c6f67da629ca81e4fa.json rename to prover/crates/lib/prover_dal/.sqlx/query-3ec365c5c81f4678a905ae5bbd48b87ead36f593488437c6f67da629ca81e4fa.json diff --git a/prover/prover_dal/.sqlx/query-412ef600a2f6025d8c22c2df8a497ed410fa47b268a66f1fc56d469c06ae50af.json b/prover/crates/lib/prover_dal/.sqlx/query-412ef600a2f6025d8c22c2df8a497ed410fa47b268a66f1fc56d469c06ae50af.json similarity index 100% rename from prover/prover_dal/.sqlx/query-412ef600a2f6025d8c22c2df8a497ed410fa47b268a66f1fc56d469c06ae50af.json rename to prover/crates/lib/prover_dal/.sqlx/query-412ef600a2f6025d8c22c2df8a497ed410fa47b268a66f1fc56d469c06ae50af.json diff --git a/prover/prover_dal/.sqlx/query-41af30620f8a1f20b8a6c46be162601d35fd2881ac1fd070f0f1a8add4bc388d.json b/prover/crates/lib/prover_dal/.sqlx/query-41af30620f8a1f20b8a6c46be162601d35fd2881ac1fd070f0f1a8add4bc388d.json similarity index 100% rename from prover/prover_dal/.sqlx/query-41af30620f8a1f20b8a6c46be162601d35fd2881ac1fd070f0f1a8add4bc388d.json rename to prover/crates/lib/prover_dal/.sqlx/query-41af30620f8a1f20b8a6c46be162601d35fd2881ac1fd070f0f1a8add4bc388d.json diff --git a/prover/prover_dal/.sqlx/query-46c4696fff5a4b8cc5cb46b05645da82065836fe17687ffad04126a6a8b2b27c.json b/prover/crates/lib/prover_dal/.sqlx/query-46c4696fff5a4b8cc5cb46b05645da82065836fe17687ffad04126a6a8b2b27c.json similarity index 100% rename from prover/prover_dal/.sqlx/query-46c4696fff5a4b8cc5cb46b05645da82065836fe17687ffad04126a6a8b2b27c.json rename to prover/crates/lib/prover_dal/.sqlx/query-46c4696fff5a4b8cc5cb46b05645da82065836fe17687ffad04126a6a8b2b27c.json diff --git a/prover/prover_dal/.sqlx/query-534822a226068cde83ad8c30b569a8f447824a5ab466bb6eea1710e8aeaa2c56.json b/prover/crates/lib/prover_dal/.sqlx/query-534822a226068cde83ad8c30b569a8f447824a5ab466bb6eea1710e8aeaa2c56.json similarity index 100% rename from prover/prover_dal/.sqlx/query-534822a226068cde83ad8c30b569a8f447824a5ab466bb6eea1710e8aeaa2c56.json rename to prover/crates/lib/prover_dal/.sqlx/query-534822a226068cde83ad8c30b569a8f447824a5ab466bb6eea1710e8aeaa2c56.json diff --git a/prover/prover_dal/.sqlx/query-53f78fdee39b113d2f55f6f951bd94f28b7b2b60d551d552a9b0bab1f1791e39.json b/prover/crates/lib/prover_dal/.sqlx/query-53f78fdee39b113d2f55f6f951bd94f28b7b2b60d551d552a9b0bab1f1791e39.json similarity index 100% rename from prover/prover_dal/.sqlx/query-53f78fdee39b113d2f55f6f951bd94f28b7b2b60d551d552a9b0bab1f1791e39.json rename to prover/crates/lib/prover_dal/.sqlx/query-53f78fdee39b113d2f55f6f951bd94f28b7b2b60d551d552a9b0bab1f1791e39.json diff --git a/prover/prover_dal/.sqlx/query-542af2ff4259182310363ac0213592895215e22fd4cf0dfe69b83277f8d05db3.json b/prover/crates/lib/prover_dal/.sqlx/query-542af2ff4259182310363ac0213592895215e22fd4cf0dfe69b83277f8d05db3.json similarity index 100% rename from prover/prover_dal/.sqlx/query-542af2ff4259182310363ac0213592895215e22fd4cf0dfe69b83277f8d05db3.json rename to prover/crates/lib/prover_dal/.sqlx/query-542af2ff4259182310363ac0213592895215e22fd4cf0dfe69b83277f8d05db3.json diff --git a/prover/prover_dal/.sqlx/query-5db868e03dc6901a0afa06f82a37a1a04821495487a80595cc9b523dac6ac8e9.json b/prover/crates/lib/prover_dal/.sqlx/query-5db868e03dc6901a0afa06f82a37a1a04821495487a80595cc9b523dac6ac8e9.json similarity index 100% rename from prover/prover_dal/.sqlx/query-5db868e03dc6901a0afa06f82a37a1a04821495487a80595cc9b523dac6ac8e9.json rename to prover/crates/lib/prover_dal/.sqlx/query-5db868e03dc6901a0afa06f82a37a1a04821495487a80595cc9b523dac6ac8e9.json diff --git a/prover/prover_dal/.sqlx/query-5e781f84ec41edd0941fa84de837effac442434c6e734d977e6682a7484abe7f.json b/prover/crates/lib/prover_dal/.sqlx/query-5e781f84ec41edd0941fa84de837effac442434c6e734d977e6682a7484abe7f.json similarity index 100% rename from prover/prover_dal/.sqlx/query-5e781f84ec41edd0941fa84de837effac442434c6e734d977e6682a7484abe7f.json rename to prover/crates/lib/prover_dal/.sqlx/query-5e781f84ec41edd0941fa84de837effac442434c6e734d977e6682a7484abe7f.json diff --git a/prover/prover_dal/.sqlx/query-61b2b858d4636809c21838635aa52aeb5f06c26f68d131dd242f6ed68816c513.json b/prover/crates/lib/prover_dal/.sqlx/query-61b2b858d4636809c21838635aa52aeb5f06c26f68d131dd242f6ed68816c513.json similarity index 100% rename from prover/prover_dal/.sqlx/query-61b2b858d4636809c21838635aa52aeb5f06c26f68d131dd242f6ed68816c513.json rename to prover/crates/lib/prover_dal/.sqlx/query-61b2b858d4636809c21838635aa52aeb5f06c26f68d131dd242f6ed68816c513.json diff --git a/prover/prover_dal/.sqlx/query-67f5f3a015dc478f02f4f701c90d0fc9ac9a7f3dce2ba48c2d0e6f38b6ba455a.json b/prover/crates/lib/prover_dal/.sqlx/query-67f5f3a015dc478f02f4f701c90d0fc9ac9a7f3dce2ba48c2d0e6f38b6ba455a.json similarity index 100% rename from prover/prover_dal/.sqlx/query-67f5f3a015dc478f02f4f701c90d0fc9ac9a7f3dce2ba48c2d0e6f38b6ba455a.json rename to prover/crates/lib/prover_dal/.sqlx/query-67f5f3a015dc478f02f4f701c90d0fc9ac9a7f3dce2ba48c2d0e6f38b6ba455a.json diff --git a/prover/prover_dal/.sqlx/query-6cfc59d2fc039c706f30ae91b7d9d0c658093dede5eb61489205aa751ad5b8ec.json b/prover/crates/lib/prover_dal/.sqlx/query-6cfc59d2fc039c706f30ae91b7d9d0c658093dede5eb61489205aa751ad5b8ec.json similarity index 100% rename from prover/prover_dal/.sqlx/query-6cfc59d2fc039c706f30ae91b7d9d0c658093dede5eb61489205aa751ad5b8ec.json rename to prover/crates/lib/prover_dal/.sqlx/query-6cfc59d2fc039c706f30ae91b7d9d0c658093dede5eb61489205aa751ad5b8ec.json diff --git a/prover/prover_dal/.sqlx/query-6f20d468efe916f8e92cbf259b37ac83cd32a628d3e01e5cd1949c519683a352.json b/prover/crates/lib/prover_dal/.sqlx/query-6f20d468efe916f8e92cbf259b37ac83cd32a628d3e01e5cd1949c519683a352.json similarity index 100% rename from prover/prover_dal/.sqlx/query-6f20d468efe916f8e92cbf259b37ac83cd32a628d3e01e5cd1949c519683a352.json rename to prover/crates/lib/prover_dal/.sqlx/query-6f20d468efe916f8e92cbf259b37ac83cd32a628d3e01e5cd1949c519683a352.json diff --git a/prover/prover_dal/.sqlx/query-764693ceeb45f8478a20242b592d419667f11d80036cda021ecbf23b0b5f7f42.json b/prover/crates/lib/prover_dal/.sqlx/query-764693ceeb45f8478a20242b592d419667f11d80036cda021ecbf23b0b5f7f42.json similarity index 100% rename from prover/prover_dal/.sqlx/query-764693ceeb45f8478a20242b592d419667f11d80036cda021ecbf23b0b5f7f42.json rename to prover/crates/lib/prover_dal/.sqlx/query-764693ceeb45f8478a20242b592d419667f11d80036cda021ecbf23b0b5f7f42.json diff --git a/prover/prover_dal/.sqlx/query-7a2145e2234a7896031bbc1ce82715e903f3b399886c2c73e838bd924fed6776.json b/prover/crates/lib/prover_dal/.sqlx/query-7a2145e2234a7896031bbc1ce82715e903f3b399886c2c73e838bd924fed6776.json similarity index 100% rename from prover/prover_dal/.sqlx/query-7a2145e2234a7896031bbc1ce82715e903f3b399886c2c73e838bd924fed6776.json rename to prover/crates/lib/prover_dal/.sqlx/query-7a2145e2234a7896031bbc1ce82715e903f3b399886c2c73e838bd924fed6776.json diff --git a/prover/prover_dal/.sqlx/query-7effbacbdcc4bd762386351755f4f32042dfead8a37401558f5fd3b03480f2dd.json b/prover/crates/lib/prover_dal/.sqlx/query-7effbacbdcc4bd762386351755f4f32042dfead8a37401558f5fd3b03480f2dd.json similarity index 100% rename from prover/prover_dal/.sqlx/query-7effbacbdcc4bd762386351755f4f32042dfead8a37401558f5fd3b03480f2dd.json rename to prover/crates/lib/prover_dal/.sqlx/query-7effbacbdcc4bd762386351755f4f32042dfead8a37401558f5fd3b03480f2dd.json diff --git a/prover/prover_dal/.sqlx/query-806b82a9effd885ba537a2a1c7d7227120a8279db1875d26ccae5ee0785f46a9.json b/prover/crates/lib/prover_dal/.sqlx/query-806b82a9effd885ba537a2a1c7d7227120a8279db1875d26ccae5ee0785f46a9.json similarity index 100% rename from prover/prover_dal/.sqlx/query-806b82a9effd885ba537a2a1c7d7227120a8279db1875d26ccae5ee0785f46a9.json rename to prover/crates/lib/prover_dal/.sqlx/query-806b82a9effd885ba537a2a1c7d7227120a8279db1875d26ccae5ee0785f46a9.json diff --git a/prover/prover_dal/.sqlx/query-85a69b433c08847876bf6e7af9bc39ae8a6e053a0e03afd3fb5e02ee17157067.json b/prover/crates/lib/prover_dal/.sqlx/query-85a69b433c08847876bf6e7af9bc39ae8a6e053a0e03afd3fb5e02ee17157067.json similarity index 100% rename from prover/prover_dal/.sqlx/query-85a69b433c08847876bf6e7af9bc39ae8a6e053a0e03afd3fb5e02ee17157067.json rename to prover/crates/lib/prover_dal/.sqlx/query-85a69b433c08847876bf6e7af9bc39ae8a6e053a0e03afd3fb5e02ee17157067.json diff --git a/prover/prover_dal/.sqlx/query-860846c9bcad1edd1a2906542c178815e29440592b2bb00adacf02730b526458.json b/prover/crates/lib/prover_dal/.sqlx/query-860846c9bcad1edd1a2906542c178815e29440592b2bb00adacf02730b526458.json similarity index 100% rename from prover/prover_dal/.sqlx/query-860846c9bcad1edd1a2906542c178815e29440592b2bb00adacf02730b526458.json rename to prover/crates/lib/prover_dal/.sqlx/query-860846c9bcad1edd1a2906542c178815e29440592b2bb00adacf02730b526458.json diff --git a/prover/prover_dal/.sqlx/query-8719c090a9ad2488d556e495238cdce6412e2725cf5162ce7a733f6dceaecb11.json b/prover/crates/lib/prover_dal/.sqlx/query-8719c090a9ad2488d556e495238cdce6412e2725cf5162ce7a733f6dceaecb11.json similarity index 100% rename from prover/prover_dal/.sqlx/query-8719c090a9ad2488d556e495238cdce6412e2725cf5162ce7a733f6dceaecb11.json rename to prover/crates/lib/prover_dal/.sqlx/query-8719c090a9ad2488d556e495238cdce6412e2725cf5162ce7a733f6dceaecb11.json diff --git a/prover/prover_dal/.sqlx/query-8720d411e0c9640afd61e927a89c0b6c018e6a4d279acd24a4ea7d81b5cc5123.json b/prover/crates/lib/prover_dal/.sqlx/query-8720d411e0c9640afd61e927a89c0b6c018e6a4d279acd24a4ea7d81b5cc5123.json similarity index 100% rename from prover/prover_dal/.sqlx/query-8720d411e0c9640afd61e927a89c0b6c018e6a4d279acd24a4ea7d81b5cc5123.json rename to prover/crates/lib/prover_dal/.sqlx/query-8720d411e0c9640afd61e927a89c0b6c018e6a4d279acd24a4ea7d81b5cc5123.json diff --git a/prover/prover_dal/.sqlx/query-87a73aa95a85efeb065428f9e56e085ea80cf93c2fd66fd3949aab428bbdc560.json b/prover/crates/lib/prover_dal/.sqlx/query-87a73aa95a85efeb065428f9e56e085ea80cf93c2fd66fd3949aab428bbdc560.json similarity index 100% rename from prover/prover_dal/.sqlx/query-87a73aa95a85efeb065428f9e56e085ea80cf93c2fd66fd3949aab428bbdc560.json rename to prover/crates/lib/prover_dal/.sqlx/query-87a73aa95a85efeb065428f9e56e085ea80cf93c2fd66fd3949aab428bbdc560.json diff --git a/prover/prover_dal/.sqlx/query-8bcad2be3dd29e36ea731417b68023678f31a1b7f5ee33b643dd551c40e88329.json b/prover/crates/lib/prover_dal/.sqlx/query-8bcad2be3dd29e36ea731417b68023678f31a1b7f5ee33b643dd551c40e88329.json similarity index 100% rename from prover/prover_dal/.sqlx/query-8bcad2be3dd29e36ea731417b68023678f31a1b7f5ee33b643dd551c40e88329.json rename to prover/crates/lib/prover_dal/.sqlx/query-8bcad2be3dd29e36ea731417b68023678f31a1b7f5ee33b643dd551c40e88329.json diff --git a/prover/prover_dal/.sqlx/query-8ffb62f6a17c68af701e790044989daacb88fe5aaf368c5f81a885821522b99c.json b/prover/crates/lib/prover_dal/.sqlx/query-8ffb62f6a17c68af701e790044989daacb88fe5aaf368c5f81a885821522b99c.json similarity index 100% rename from prover/prover_dal/.sqlx/query-8ffb62f6a17c68af701e790044989daacb88fe5aaf368c5f81a885821522b99c.json rename to prover/crates/lib/prover_dal/.sqlx/query-8ffb62f6a17c68af701e790044989daacb88fe5aaf368c5f81a885821522b99c.json diff --git a/prover/crates/lib/prover_dal/.sqlx/query-929419ad8dcc70e8ce986f17075cd21d4645563f93afd4428734196c2b212276.json b/prover/crates/lib/prover_dal/.sqlx/query-929419ad8dcc70e8ce986f17075cd21d4645563f93afd4428734196c2b212276.json new file mode 100644 index 000000000000..cf5fe8117b14 --- /dev/null +++ b/prover/crates/lib/prover_dal/.sqlx/query-929419ad8dcc70e8ce986f17075cd21d4645563f93afd4428734196c2b212276.json @@ -0,0 +1,17 @@ +{ + "db_name": "PostgreSQL", + "query": "\n INSERT INTO\n witness_inputs_fri (\n l1_batch_number,\n witness_inputs_blob_url,\n protocol_version,\n status,\n created_at,\n updated_at,\n protocol_version_patch\n )\n VALUES\n ($1, $2, $3, 'queued', NOW(), NOW(), $4)\n ON CONFLICT (l1_batch_number) DO NOTHING\n ", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Int8", + "Text", + "Int4", + "Int4" + ] + }, + "nullable": [] + }, + "hash": "929419ad8dcc70e8ce986f17075cd21d4645563f93afd4428734196c2b212276" +} diff --git a/prover/prover_dal/.sqlx/query-93b9706aa8eb840d574d7c156cc866e8f67a380302762c272bfb27307682d62e.json b/prover/crates/lib/prover_dal/.sqlx/query-93b9706aa8eb840d574d7c156cc866e8f67a380302762c272bfb27307682d62e.json similarity index 100% rename from prover/prover_dal/.sqlx/query-93b9706aa8eb840d574d7c156cc866e8f67a380302762c272bfb27307682d62e.json rename to prover/crates/lib/prover_dal/.sqlx/query-93b9706aa8eb840d574d7c156cc866e8f67a380302762c272bfb27307682d62e.json diff --git a/prover/prover_dal/.sqlx/query-94a75b05ecbab75d6ebf39cca029bfb838c787fc58d7536f9e9976e5e515431a.json b/prover/crates/lib/prover_dal/.sqlx/query-94a75b05ecbab75d6ebf39cca029bfb838c787fc58d7536f9e9976e5e515431a.json similarity index 100% rename from prover/prover_dal/.sqlx/query-94a75b05ecbab75d6ebf39cca029bfb838c787fc58d7536f9e9976e5e515431a.json rename to prover/crates/lib/prover_dal/.sqlx/query-94a75b05ecbab75d6ebf39cca029bfb838c787fc58d7536f9e9976e5e515431a.json diff --git a/prover/prover_dal/.sqlx/query-9b713312b539b4eefa58346f0070767a2cd4488e670674cd9149f7a332c0198d.json b/prover/crates/lib/prover_dal/.sqlx/query-9b713312b539b4eefa58346f0070767a2cd4488e670674cd9149f7a332c0198d.json similarity index 100% rename from prover/prover_dal/.sqlx/query-9b713312b539b4eefa58346f0070767a2cd4488e670674cd9149f7a332c0198d.json rename to prover/crates/lib/prover_dal/.sqlx/query-9b713312b539b4eefa58346f0070767a2cd4488e670674cd9149f7a332c0198d.json diff --git a/prover/prover_dal/.sqlx/query-a0f60a97f09b2467ca73bb6fbebb210d65149cdd4a3411a79b717aadbffb43af.json b/prover/crates/lib/prover_dal/.sqlx/query-a0f60a97f09b2467ca73bb6fbebb210d65149cdd4a3411a79b717aadbffb43af.json similarity index 100% rename from prover/prover_dal/.sqlx/query-a0f60a97f09b2467ca73bb6fbebb210d65149cdd4a3411a79b717aadbffb43af.json rename to prover/crates/lib/prover_dal/.sqlx/query-a0f60a97f09b2467ca73bb6fbebb210d65149cdd4a3411a79b717aadbffb43af.json diff --git a/prover/prover_dal/.sqlx/query-a84ee70bec8c03bd51e1c6bad44c9a64904026506914abae2946e5d353d6a604.json b/prover/crates/lib/prover_dal/.sqlx/query-a84ee70bec8c03bd51e1c6bad44c9a64904026506914abae2946e5d353d6a604.json similarity index 100% rename from prover/prover_dal/.sqlx/query-a84ee70bec8c03bd51e1c6bad44c9a64904026506914abae2946e5d353d6a604.json rename to prover/crates/lib/prover_dal/.sqlx/query-a84ee70bec8c03bd51e1c6bad44c9a64904026506914abae2946e5d353d6a604.json diff --git a/prover/prover_dal/.sqlx/query-a94fffdbc1827dc5df908ea1e99ef3ad13840d2c497760e9bd0513f68dc4271c.json b/prover/crates/lib/prover_dal/.sqlx/query-a94fffdbc1827dc5df908ea1e99ef3ad13840d2c497760e9bd0513f68dc4271c.json similarity index 100% rename from prover/prover_dal/.sqlx/query-a94fffdbc1827dc5df908ea1e99ef3ad13840d2c497760e9bd0513f68dc4271c.json rename to prover/crates/lib/prover_dal/.sqlx/query-a94fffdbc1827dc5df908ea1e99ef3ad13840d2c497760e9bd0513f68dc4271c.json diff --git a/prover/prover_dal/.sqlx/query-abc93d27a8673b23e18d050e84c43c868c63c853edb5c4f41e48a3cc6378eca9.json b/prover/crates/lib/prover_dal/.sqlx/query-abc93d27a8673b23e18d050e84c43c868c63c853edb5c4f41e48a3cc6378eca9.json similarity index 100% rename from prover/prover_dal/.sqlx/query-abc93d27a8673b23e18d050e84c43c868c63c853edb5c4f41e48a3cc6378eca9.json rename to prover/crates/lib/prover_dal/.sqlx/query-abc93d27a8673b23e18d050e84c43c868c63c853edb5c4f41e48a3cc6378eca9.json diff --git a/prover/prover_dal/.sqlx/query-b25c66b9705b3f2fb8a3492f1bd20222e177262292241bd8cb89dbb9c1e74c2d.json b/prover/crates/lib/prover_dal/.sqlx/query-b25c66b9705b3f2fb8a3492f1bd20222e177262292241bd8cb89dbb9c1e74c2d.json similarity index 100% rename from prover/prover_dal/.sqlx/query-b25c66b9705b3f2fb8a3492f1bd20222e177262292241bd8cb89dbb9c1e74c2d.json rename to prover/crates/lib/prover_dal/.sqlx/query-b25c66b9705b3f2fb8a3492f1bd20222e177262292241bd8cb89dbb9c1e74c2d.json diff --git a/prover/prover_dal/.sqlx/query-b321c5ba22358cbb1fd9c627f1e7b56187686173327498ac75424593547c19c5.json b/prover/crates/lib/prover_dal/.sqlx/query-b321c5ba22358cbb1fd9c627f1e7b56187686173327498ac75424593547c19c5.json similarity index 100% rename from prover/prover_dal/.sqlx/query-b321c5ba22358cbb1fd9c627f1e7b56187686173327498ac75424593547c19c5.json rename to prover/crates/lib/prover_dal/.sqlx/query-b321c5ba22358cbb1fd9c627f1e7b56187686173327498ac75424593547c19c5.json diff --git a/prover/prover_dal/.sqlx/query-b367ecb1ebee86ec598c4079591f8c12deeca6b8843fe3869cc2b02b30da5de6.json b/prover/crates/lib/prover_dal/.sqlx/query-b367ecb1ebee86ec598c4079591f8c12deeca6b8843fe3869cc2b02b30da5de6.json similarity index 100% rename from prover/prover_dal/.sqlx/query-b367ecb1ebee86ec598c4079591f8c12deeca6b8843fe3869cc2b02b30da5de6.json rename to prover/crates/lib/prover_dal/.sqlx/query-b367ecb1ebee86ec598c4079591f8c12deeca6b8843fe3869cc2b02b30da5de6.json diff --git a/prover/prover_dal/.sqlx/query-b3d71dbe14bcd94131b29b64dcb49b6370c211a7fc24ad03a5f0e327f9d18040.json b/prover/crates/lib/prover_dal/.sqlx/query-b3d71dbe14bcd94131b29b64dcb49b6370c211a7fc24ad03a5f0e327f9d18040.json similarity index 100% rename from prover/prover_dal/.sqlx/query-b3d71dbe14bcd94131b29b64dcb49b6370c211a7fc24ad03a5f0e327f9d18040.json rename to prover/crates/lib/prover_dal/.sqlx/query-b3d71dbe14bcd94131b29b64dcb49b6370c211a7fc24ad03a5f0e327f9d18040.json diff --git a/prover/prover_dal/.sqlx/query-b4794e6a0c2366d5d95ab373c310103263af3ff5cb6c9dc5df59d3cd2a5e56b4.json b/prover/crates/lib/prover_dal/.sqlx/query-b4794e6a0c2366d5d95ab373c310103263af3ff5cb6c9dc5df59d3cd2a5e56b4.json similarity index 100% rename from prover/prover_dal/.sqlx/query-b4794e6a0c2366d5d95ab373c310103263af3ff5cb6c9dc5df59d3cd2a5e56b4.json rename to prover/crates/lib/prover_dal/.sqlx/query-b4794e6a0c2366d5d95ab373c310103263af3ff5cb6c9dc5df59d3cd2a5e56b4.json diff --git a/prover/prover_dal/.sqlx/query-b568f9cb9c2bd53b5dcde15f368a9dc31c7d51476f18cffa80cad653298ad252.json b/prover/crates/lib/prover_dal/.sqlx/query-b568f9cb9c2bd53b5dcde15f368a9dc31c7d51476f18cffa80cad653298ad252.json similarity index 100% rename from prover/prover_dal/.sqlx/query-b568f9cb9c2bd53b5dcde15f368a9dc31c7d51476f18cffa80cad653298ad252.json rename to prover/crates/lib/prover_dal/.sqlx/query-b568f9cb9c2bd53b5dcde15f368a9dc31c7d51476f18cffa80cad653298ad252.json diff --git a/prover/prover_dal/.sqlx/query-bf06bd08d8ccf67fc00bbc364715263556f258565f79cbb40f5ecc1a4f6402f5.json b/prover/crates/lib/prover_dal/.sqlx/query-bf06bd08d8ccf67fc00bbc364715263556f258565f79cbb40f5ecc1a4f6402f5.json similarity index 100% rename from prover/prover_dal/.sqlx/query-bf06bd08d8ccf67fc00bbc364715263556f258565f79cbb40f5ecc1a4f6402f5.json rename to prover/crates/lib/prover_dal/.sqlx/query-bf06bd08d8ccf67fc00bbc364715263556f258565f79cbb40f5ecc1a4f6402f5.json diff --git a/prover/prover_dal/.sqlx/query-bfb80956a18eabf266f5b5a9d62912d57f8eb2a38bdb7884fc812a2897a3a660.json b/prover/crates/lib/prover_dal/.sqlx/query-bfb80956a18eabf266f5b5a9d62912d57f8eb2a38bdb7884fc812a2897a3a660.json similarity index 100% rename from prover/prover_dal/.sqlx/query-bfb80956a18eabf266f5b5a9d62912d57f8eb2a38bdb7884fc812a2897a3a660.json rename to prover/crates/lib/prover_dal/.sqlx/query-bfb80956a18eabf266f5b5a9d62912d57f8eb2a38bdb7884fc812a2897a3a660.json diff --git a/prover/prover_dal/.sqlx/query-c156004a0e5ad5bcc33d3b894fd69718349ac4fc08b455c7f4265d7443f2ec13.json b/prover/crates/lib/prover_dal/.sqlx/query-c156004a0e5ad5bcc33d3b894fd69718349ac4fc08b455c7f4265d7443f2ec13.json similarity index 100% rename from prover/prover_dal/.sqlx/query-c156004a0e5ad5bcc33d3b894fd69718349ac4fc08b455c7f4265d7443f2ec13.json rename to prover/crates/lib/prover_dal/.sqlx/query-c156004a0e5ad5bcc33d3b894fd69718349ac4fc08b455c7f4265d7443f2ec13.json diff --git a/prover/prover_dal/.sqlx/query-c173743af526d8150b6091ea52e6997fcfbc7ad688f2eee3dfab1029344d2382.json b/prover/crates/lib/prover_dal/.sqlx/query-c173743af526d8150b6091ea52e6997fcfbc7ad688f2eee3dfab1029344d2382.json similarity index 100% rename from prover/prover_dal/.sqlx/query-c173743af526d8150b6091ea52e6997fcfbc7ad688f2eee3dfab1029344d2382.json rename to prover/crates/lib/prover_dal/.sqlx/query-c173743af526d8150b6091ea52e6997fcfbc7ad688f2eee3dfab1029344d2382.json diff --git a/prover/prover_dal/.sqlx/query-c2c140d136df5303d7b3a66ccd0d34a5baece02812f8c950fc84d37eeebd33a4.json b/prover/crates/lib/prover_dal/.sqlx/query-c2c140d136df5303d7b3a66ccd0d34a5baece02812f8c950fc84d37eeebd33a4.json similarity index 95% rename from prover/prover_dal/.sqlx/query-c2c140d136df5303d7b3a66ccd0d34a5baece02812f8c950fc84d37eeebd33a4.json rename to prover/crates/lib/prover_dal/.sqlx/query-c2c140d136df5303d7b3a66ccd0d34a5baece02812f8c950fc84d37eeebd33a4.json index 007525bceaef..25a49e191f6e 100644 --- a/prover/prover_dal/.sqlx/query-c2c140d136df5303d7b3a66ccd0d34a5baece02812f8c950fc84d37eeebd33a4.json +++ b/prover/crates/lib/prover_dal/.sqlx/query-c2c140d136df5303d7b3a66ccd0d34a5baece02812f8c950fc84d37eeebd33a4.json @@ -70,36 +70,31 @@ }, { "ordinal": 13, - "name": "is_blob_cleaned", - "type_info": "Bool" - }, - { - "ordinal": 14, "name": "depth", "type_info": "Int4" }, { - "ordinal": 15, + "ordinal": 14, "name": "is_node_final_proof", "type_info": "Bool" }, { - "ordinal": 16, + "ordinal": 15, "name": "proof_blob_url", "type_info": "Text" }, { - "ordinal": 17, + "ordinal": 16, "name": "protocol_version", "type_info": "Int4" }, { - "ordinal": 18, + "ordinal": 17, "name": "picked_by", "type_info": "Text" }, { - "ordinal": 19, + "ordinal": 18, "name": "protocol_version_patch", "type_info": "Int4" } @@ -124,7 +119,6 @@ false, false, true, - true, false, false, true, diff --git a/prover/prover_dal/.sqlx/query-c340c043c938bf5f4b63d57a1654775c6f7414c7bed75d33b61de00fdbabc349.json b/prover/crates/lib/prover_dal/.sqlx/query-c340c043c938bf5f4b63d57a1654775c6f7414c7bed75d33b61de00fdbabc349.json similarity index 100% rename from prover/prover_dal/.sqlx/query-c340c043c938bf5f4b63d57a1654775c6f7414c7bed75d33b61de00fdbabc349.json rename to prover/crates/lib/prover_dal/.sqlx/query-c340c043c938bf5f4b63d57a1654775c6f7414c7bed75d33b61de00fdbabc349.json diff --git a/prover/prover_dal/.sqlx/query-c706a49ff54f6b424e24d061fe7ac429aac3c030f7e226a1264243d8cdae038d.json b/prover/crates/lib/prover_dal/.sqlx/query-c706a49ff54f6b424e24d061fe7ac429aac3c030f7e226a1264243d8cdae038d.json similarity index 100% rename from prover/prover_dal/.sqlx/query-c706a49ff54f6b424e24d061fe7ac429aac3c030f7e226a1264243d8cdae038d.json rename to prover/crates/lib/prover_dal/.sqlx/query-c706a49ff54f6b424e24d061fe7ac429aac3c030f7e226a1264243d8cdae038d.json diff --git a/prover/prover_dal/.sqlx/query-ca9d06141265b8524ee28c55569cb21a635037d89ce24dd3ad58ffaadb59594a.json b/prover/crates/lib/prover_dal/.sqlx/query-ca9d06141265b8524ee28c55569cb21a635037d89ce24dd3ad58ffaadb59594a.json similarity index 100% rename from prover/prover_dal/.sqlx/query-ca9d06141265b8524ee28c55569cb21a635037d89ce24dd3ad58ffaadb59594a.json rename to prover/crates/lib/prover_dal/.sqlx/query-ca9d06141265b8524ee28c55569cb21a635037d89ce24dd3ad58ffaadb59594a.json diff --git a/prover/prover_dal/.sqlx/query-caff620ae66d7fbe3caff7505173b6da86d1e693be03936730c340121167341f.json b/prover/crates/lib/prover_dal/.sqlx/query-caff620ae66d7fbe3caff7505173b6da86d1e693be03936730c340121167341f.json similarity index 100% rename from prover/prover_dal/.sqlx/query-caff620ae66d7fbe3caff7505173b6da86d1e693be03936730c340121167341f.json rename to prover/crates/lib/prover_dal/.sqlx/query-caff620ae66d7fbe3caff7505173b6da86d1e693be03936730c340121167341f.json diff --git a/prover/prover_dal/.sqlx/query-ce5779092feb8a3d3e2c5e395783e67f08f2ead5f55bfb6594e50346bf9cf2ef.json b/prover/crates/lib/prover_dal/.sqlx/query-ce5779092feb8a3d3e2c5e395783e67f08f2ead5f55bfb6594e50346bf9cf2ef.json similarity index 100% rename from prover/prover_dal/.sqlx/query-ce5779092feb8a3d3e2c5e395783e67f08f2ead5f55bfb6594e50346bf9cf2ef.json rename to prover/crates/lib/prover_dal/.sqlx/query-ce5779092feb8a3d3e2c5e395783e67f08f2ead5f55bfb6594e50346bf9cf2ef.json diff --git a/prover/prover_dal/.sqlx/query-d16278c6025eb3a205266fb5273f029e262be45614404159908af1624349700b.json b/prover/crates/lib/prover_dal/.sqlx/query-d16278c6025eb3a205266fb5273f029e262be45614404159908af1624349700b.json similarity index 100% rename from prover/prover_dal/.sqlx/query-d16278c6025eb3a205266fb5273f029e262be45614404159908af1624349700b.json rename to prover/crates/lib/prover_dal/.sqlx/query-d16278c6025eb3a205266fb5273f029e262be45614404159908af1624349700b.json diff --git a/prover/prover_dal/.sqlx/query-d272c91f1209c277189a31c59ee191a43dc8eafc33ee067bd41e20f25f7625f0.json b/prover/crates/lib/prover_dal/.sqlx/query-d272c91f1209c277189a31c59ee191a43dc8eafc33ee067bd41e20f25f7625f0.json similarity index 96% rename from prover/prover_dal/.sqlx/query-d272c91f1209c277189a31c59ee191a43dc8eafc33ee067bd41e20f25f7625f0.json rename to prover/crates/lib/prover_dal/.sqlx/query-d272c91f1209c277189a31c59ee191a43dc8eafc33ee067bd41e20f25f7625f0.json index a90da33a3333..2c94853eacff 100644 --- a/prover/prover_dal/.sqlx/query-d272c91f1209c277189a31c59ee191a43dc8eafc33ee067bd41e20f25f7625f0.json +++ b/prover/crates/lib/prover_dal/.sqlx/query-d272c91f1209c277189a31c59ee191a43dc8eafc33ee067bd41e20f25f7625f0.json @@ -60,26 +60,21 @@ }, { "ordinal": 11, - "name": "is_blob_cleaned", - "type_info": "Bool" - }, - { - "ordinal": 12, "name": "number_of_basic_circuits", "type_info": "Int4" }, { - "ordinal": 13, + "ordinal": 12, "name": "protocol_version", "type_info": "Int4" }, { - "ordinal": 14, + "ordinal": 13, "name": "picked_by", "type_info": "Text" }, { - "ordinal": 15, + "ordinal": 14, "name": "protocol_version_patch", "type_info": "Int4" } @@ -106,7 +101,6 @@ true, true, true, - true, false ] }, diff --git a/prover/prover_dal/.sqlx/query-d4949debfe0dc5112204cd196c68b02c44b099e27e3c45c5c810cd5fcd8884ed.json b/prover/crates/lib/prover_dal/.sqlx/query-d4949debfe0dc5112204cd196c68b02c44b099e27e3c45c5c810cd5fcd8884ed.json similarity index 100% rename from prover/prover_dal/.sqlx/query-d4949debfe0dc5112204cd196c68b02c44b099e27e3c45c5c810cd5fcd8884ed.json rename to prover/crates/lib/prover_dal/.sqlx/query-d4949debfe0dc5112204cd196c68b02c44b099e27e3c45c5c810cd5fcd8884ed.json diff --git a/prover/prover_dal/.sqlx/query-d91c931e2a14cf1183a608d041fc6fadb8e12a9218399d189b4d95e2ca4fcc48.json b/prover/crates/lib/prover_dal/.sqlx/query-d91c931e2a14cf1183a608d041fc6fadb8e12a9218399d189b4d95e2ca4fcc48.json similarity index 100% rename from prover/prover_dal/.sqlx/query-d91c931e2a14cf1183a608d041fc6fadb8e12a9218399d189b4d95e2ca4fcc48.json rename to prover/crates/lib/prover_dal/.sqlx/query-d91c931e2a14cf1183a608d041fc6fadb8e12a9218399d189b4d95e2ca4fcc48.json diff --git a/prover/prover_dal/.sqlx/query-db3e74f0e83ffbf84a6d61e560f2060fbea775dc185f639139fbfd23e4d5f3c6.json b/prover/crates/lib/prover_dal/.sqlx/query-db3e74f0e83ffbf84a6d61e560f2060fbea775dc185f639139fbfd23e4d5f3c6.json similarity index 100% rename from prover/prover_dal/.sqlx/query-db3e74f0e83ffbf84a6d61e560f2060fbea775dc185f639139fbfd23e4d5f3c6.json rename to prover/crates/lib/prover_dal/.sqlx/query-db3e74f0e83ffbf84a6d61e560f2060fbea775dc185f639139fbfd23e4d5f3c6.json diff --git a/prover/prover_dal/.sqlx/query-df00e33809768120e395d8f740770a4e629b2a1cde641e74e4e55bb100df809f.json b/prover/crates/lib/prover_dal/.sqlx/query-df00e33809768120e395d8f740770a4e629b2a1cde641e74e4e55bb100df809f.json similarity index 100% rename from prover/prover_dal/.sqlx/query-df00e33809768120e395d8f740770a4e629b2a1cde641e74e4e55bb100df809f.json rename to prover/crates/lib/prover_dal/.sqlx/query-df00e33809768120e395d8f740770a4e629b2a1cde641e74e4e55bb100df809f.json diff --git a/prover/prover_dal/.sqlx/query-e0a6cc885e437aa7ded9def71f3e118cabc67b6e507efefb7b69e102f1b43c58.json b/prover/crates/lib/prover_dal/.sqlx/query-e0a6cc885e437aa7ded9def71f3e118cabc67b6e507efefb7b69e102f1b43c58.json similarity index 83% rename from prover/prover_dal/.sqlx/query-e0a6cc885e437aa7ded9def71f3e118cabc67b6e507efefb7b69e102f1b43c58.json rename to prover/crates/lib/prover_dal/.sqlx/query-e0a6cc885e437aa7ded9def71f3e118cabc67b6e507efefb7b69e102f1b43c58.json index 79f12689194f..7786dc04a2e7 100644 --- a/prover/prover_dal/.sqlx/query-e0a6cc885e437aa7ded9def71f3e118cabc67b6e507efefb7b69e102f1b43c58.json +++ b/prover/crates/lib/prover_dal/.sqlx/query-e0a6cc885e437aa7ded9def71f3e118cabc67b6e507efefb7b69e102f1b43c58.json @@ -10,71 +10,56 @@ }, { "ordinal": 1, - "name": "merkle_tree_paths_blob_url", - "type_info": "Text" - }, - { - "ordinal": 2, "name": "attempts", "type_info": "Int2" }, { - "ordinal": 3, + "ordinal": 2, "name": "status", "type_info": "Text" }, { - "ordinal": 4, + "ordinal": 3, "name": "error", "type_info": "Text" }, { - "ordinal": 5, + "ordinal": 4, "name": "created_at", "type_info": "Timestamp" }, { - "ordinal": 6, + "ordinal": 5, "name": "updated_at", "type_info": "Timestamp" }, { - "ordinal": 7, + "ordinal": 6, "name": "processing_started_at", "type_info": "Timestamp" }, { - "ordinal": 8, + "ordinal": 7, "name": "time_taken", "type_info": "Time" }, { - "ordinal": 9, - "name": "is_blob_cleaned", - "type_info": "Bool" - }, - { - "ordinal": 10, + "ordinal": 8, "name": "protocol_version", "type_info": "Int4" }, { - "ordinal": 11, + "ordinal": 9, "name": "picked_by", "type_info": "Text" }, { - "ordinal": 12, - "name": "eip_4844_blobs", - "type_info": "Bytea" - }, - { - "ordinal": 13, + "ordinal": 10, "name": "protocol_version_patch", "type_info": "Int4" }, { - "ordinal": 14, + "ordinal": 11, "name": "witness_inputs_blob_url", "type_info": "Text" } @@ -86,7 +71,6 @@ }, "nullable": [ false, - true, false, false, true, @@ -96,8 +80,6 @@ true, true, true, - true, - true, false, true ] diff --git a/prover/prover_dal/.sqlx/query-e3194873d24e67f8d0e98bf8bf2d4f9a3b98458746972c9860fb9473947d59ff.json b/prover/crates/lib/prover_dal/.sqlx/query-e3194873d24e67f8d0e98bf8bf2d4f9a3b98458746972c9860fb9473947d59ff.json similarity index 100% rename from prover/prover_dal/.sqlx/query-e3194873d24e67f8d0e98bf8bf2d4f9a3b98458746972c9860fb9473947d59ff.json rename to prover/crates/lib/prover_dal/.sqlx/query-e3194873d24e67f8d0e98bf8bf2d4f9a3b98458746972c9860fb9473947d59ff.json diff --git a/prover/prover_dal/.sqlx/query-e32c0d85cb2841efb0b7cea6b049bae42849574731d33539bfdcca21c9b64f4e.json b/prover/crates/lib/prover_dal/.sqlx/query-e32c0d85cb2841efb0b7cea6b049bae42849574731d33539bfdcca21c9b64f4e.json similarity index 100% rename from prover/prover_dal/.sqlx/query-e32c0d85cb2841efb0b7cea6b049bae42849574731d33539bfdcca21c9b64f4e.json rename to prover/crates/lib/prover_dal/.sqlx/query-e32c0d85cb2841efb0b7cea6b049bae42849574731d33539bfdcca21c9b64f4e.json diff --git a/prover/prover_dal/.sqlx/query-e495b78add1c942d89d806e228093a4eb2ee0284aa89bca1ba958f470a2d6254.json b/prover/crates/lib/prover_dal/.sqlx/query-e495b78add1c942d89d806e228093a4eb2ee0284aa89bca1ba958f470a2d6254.json similarity index 100% rename from prover/prover_dal/.sqlx/query-e495b78add1c942d89d806e228093a4eb2ee0284aa89bca1ba958f470a2d6254.json rename to prover/crates/lib/prover_dal/.sqlx/query-e495b78add1c942d89d806e228093a4eb2ee0284aa89bca1ba958f470a2d6254.json diff --git a/prover/prover_dal/.sqlx/query-e743af4c18ec91eb46db5a19556fba74ec2cfc3c89c7e4e2ea475c3ce4092849.json b/prover/crates/lib/prover_dal/.sqlx/query-e743af4c18ec91eb46db5a19556fba74ec2cfc3c89c7e4e2ea475c3ce4092849.json similarity index 100% rename from prover/prover_dal/.sqlx/query-e743af4c18ec91eb46db5a19556fba74ec2cfc3c89c7e4e2ea475c3ce4092849.json rename to prover/crates/lib/prover_dal/.sqlx/query-e743af4c18ec91eb46db5a19556fba74ec2cfc3c89c7e4e2ea475c3ce4092849.json diff --git a/prover/prover_dal/.sqlx/query-e8066db420e075306235f728d57567878f347bdaf36294e9b24ee9c0aa1e861b.json b/prover/crates/lib/prover_dal/.sqlx/query-e8066db420e075306235f728d57567878f347bdaf36294e9b24ee9c0aa1e861b.json similarity index 100% rename from prover/prover_dal/.sqlx/query-e8066db420e075306235f728d57567878f347bdaf36294e9b24ee9c0aa1e861b.json rename to prover/crates/lib/prover_dal/.sqlx/query-e8066db420e075306235f728d57567878f347bdaf36294e9b24ee9c0aa1e861b.json diff --git a/prover/prover_dal/.sqlx/query-e9c9b69852fa68f463f17b6d63ab99cf505662036f2dd7a9f1807c4c1bad7c7b.json b/prover/crates/lib/prover_dal/.sqlx/query-e9c9b69852fa68f463f17b6d63ab99cf505662036f2dd7a9f1807c4c1bad7c7b.json similarity index 100% rename from prover/prover_dal/.sqlx/query-e9c9b69852fa68f463f17b6d63ab99cf505662036f2dd7a9f1807c4c1bad7c7b.json rename to prover/crates/lib/prover_dal/.sqlx/query-e9c9b69852fa68f463f17b6d63ab99cf505662036f2dd7a9f1807c4c1bad7c7b.json diff --git a/prover/prover_dal/.sqlx/query-ec04b89218111a5dc8d5ade506ac3465e2211ef3013386feb12d4cc04e0eade9.json b/prover/crates/lib/prover_dal/.sqlx/query-ec04b89218111a5dc8d5ade506ac3465e2211ef3013386feb12d4cc04e0eade9.json similarity index 100% rename from prover/prover_dal/.sqlx/query-ec04b89218111a5dc8d5ade506ac3465e2211ef3013386feb12d4cc04e0eade9.json rename to prover/crates/lib/prover_dal/.sqlx/query-ec04b89218111a5dc8d5ade506ac3465e2211ef3013386feb12d4cc04e0eade9.json diff --git a/prover/prover_dal/.sqlx/query-edc61e1285bf6d3837acc67af4f15aaade450980719933089824eb8c494d64a4.json b/prover/crates/lib/prover_dal/.sqlx/query-edc61e1285bf6d3837acc67af4f15aaade450980719933089824eb8c494d64a4.json similarity index 100% rename from prover/prover_dal/.sqlx/query-edc61e1285bf6d3837acc67af4f15aaade450980719933089824eb8c494d64a4.json rename to prover/crates/lib/prover_dal/.sqlx/query-edc61e1285bf6d3837acc67af4f15aaade450980719933089824eb8c494d64a4.json diff --git a/prover/prover_dal/.sqlx/query-eef1b56e87eff63fcf6ffb98791583a7526ae38ceb4bf80543cfd3fb60492fb9.json b/prover/crates/lib/prover_dal/.sqlx/query-eef1b56e87eff63fcf6ffb98791583a7526ae38ceb4bf80543cfd3fb60492fb9.json similarity index 100% rename from prover/prover_dal/.sqlx/query-eef1b56e87eff63fcf6ffb98791583a7526ae38ceb4bf80543cfd3fb60492fb9.json rename to prover/crates/lib/prover_dal/.sqlx/query-eef1b56e87eff63fcf6ffb98791583a7526ae38ceb4bf80543cfd3fb60492fb9.json diff --git a/prover/prover_dal/.sqlx/query-f99c34313e2717ec74b4f274e33dae905acac53b46eeaeb059d23e48a71df3b4.json b/prover/crates/lib/prover_dal/.sqlx/query-f99c34313e2717ec74b4f274e33dae905acac53b46eeaeb059d23e48a71df3b4.json similarity index 100% rename from prover/prover_dal/.sqlx/query-f99c34313e2717ec74b4f274e33dae905acac53b46eeaeb059d23e48a71df3b4.json rename to prover/crates/lib/prover_dal/.sqlx/query-f99c34313e2717ec74b4f274e33dae905acac53b46eeaeb059d23e48a71df3b4.json diff --git a/prover/prover_dal/.sqlx/query-fcddeb96dcd1611dedb2091c1be304e8a35fd65bf37e976b7106f57c57e70b9b.json b/prover/crates/lib/prover_dal/.sqlx/query-fcddeb96dcd1611dedb2091c1be304e8a35fd65bf37e976b7106f57c57e70b9b.json similarity index 100% rename from prover/prover_dal/.sqlx/query-fcddeb96dcd1611dedb2091c1be304e8a35fd65bf37e976b7106f57c57e70b9b.json rename to prover/crates/lib/prover_dal/.sqlx/query-fcddeb96dcd1611dedb2091c1be304e8a35fd65bf37e976b7106f57c57e70b9b.json diff --git a/prover/prover_dal/Cargo.toml b/prover/crates/lib/prover_dal/Cargo.toml similarity index 100% rename from prover/prover_dal/Cargo.toml rename to prover/crates/lib/prover_dal/Cargo.toml diff --git a/prover/prover_dal/doc/FriProofCompressorDal.md b/prover/crates/lib/prover_dal/doc/FriProofCompressorDal.md similarity index 100% rename from prover/prover_dal/doc/FriProofCompressorDal.md rename to prover/crates/lib/prover_dal/doc/FriProofCompressorDal.md diff --git a/prover/prover_dal/doc/FriProverDal.md b/prover/crates/lib/prover_dal/doc/FriProverDal.md similarity index 100% rename from prover/prover_dal/doc/FriProverDal.md rename to prover/crates/lib/prover_dal/doc/FriProverDal.md diff --git a/prover/prover_dal/doc/FriWitnessGeneratorDal.md b/prover/crates/lib/prover_dal/doc/FriWitnessGeneratorDal.md similarity index 100% rename from prover/prover_dal/doc/FriWitnessGeneratorDal.md rename to prover/crates/lib/prover_dal/doc/FriWitnessGeneratorDal.md diff --git a/prover/prover_dal/migrations/20240131134938_initial-prover-migration.down.sql b/prover/crates/lib/prover_dal/migrations/20240131134938_initial-prover-migration.down.sql similarity index 100% rename from prover/prover_dal/migrations/20240131134938_initial-prover-migration.down.sql rename to prover/crates/lib/prover_dal/migrations/20240131134938_initial-prover-migration.down.sql diff --git a/prover/prover_dal/migrations/20240131134938_initial-prover-migration.up.sql b/prover/crates/lib/prover_dal/migrations/20240131134938_initial-prover-migration.up.sql similarity index 100% rename from prover/prover_dal/migrations/20240131134938_initial-prover-migration.up.sql rename to prover/crates/lib/prover_dal/migrations/20240131134938_initial-prover-migration.up.sql diff --git a/prover/prover_dal/migrations/20240226120310_add_support_for_eip4844.down.sql b/prover/crates/lib/prover_dal/migrations/20240226120310_add_support_for_eip4844.down.sql similarity index 100% rename from prover/prover_dal/migrations/20240226120310_add_support_for_eip4844.down.sql rename to prover/crates/lib/prover_dal/migrations/20240226120310_add_support_for_eip4844.down.sql diff --git a/prover/prover_dal/migrations/20240226120310_add_support_for_eip4844.up.sql b/prover/crates/lib/prover_dal/migrations/20240226120310_add_support_for_eip4844.up.sql similarity index 100% rename from prover/prover_dal/migrations/20240226120310_add_support_for_eip4844.up.sql rename to prover/crates/lib/prover_dal/migrations/20240226120310_add_support_for_eip4844.up.sql diff --git a/prover/prover_dal/migrations/20240403070124_add_archived_at_column_to_prover_queue_archive.down.sql b/prover/crates/lib/prover_dal/migrations/20240403070124_add_archived_at_column_to_prover_queue_archive.down.sql similarity index 100% rename from prover/prover_dal/migrations/20240403070124_add_archived_at_column_to_prover_queue_archive.down.sql rename to prover/crates/lib/prover_dal/migrations/20240403070124_add_archived_at_column_to_prover_queue_archive.down.sql diff --git a/prover/prover_dal/migrations/20240403070124_add_archived_at_column_to_prover_queue_archive.up.sql b/prover/crates/lib/prover_dal/migrations/20240403070124_add_archived_at_column_to_prover_queue_archive.up.sql similarity index 100% rename from prover/prover_dal/migrations/20240403070124_add_archived_at_column_to_prover_queue_archive.up.sql rename to prover/crates/lib/prover_dal/migrations/20240403070124_add_archived_at_column_to_prover_queue_archive.up.sql diff --git a/prover/prover_dal/migrations/20240410141719_add-protocol-versions-to-tables.down.sql b/prover/crates/lib/prover_dal/migrations/20240410141719_add-protocol-versions-to-tables.down.sql similarity index 100% rename from prover/prover_dal/migrations/20240410141719_add-protocol-versions-to-tables.down.sql rename to prover/crates/lib/prover_dal/migrations/20240410141719_add-protocol-versions-to-tables.down.sql diff --git a/prover/prover_dal/migrations/20240410141719_add-protocol-versions-to-tables.up.sql b/prover/crates/lib/prover_dal/migrations/20240410141719_add-protocol-versions-to-tables.up.sql similarity index 100% rename from prover/prover_dal/migrations/20240410141719_add-protocol-versions-to-tables.up.sql rename to prover/crates/lib/prover_dal/migrations/20240410141719_add-protocol-versions-to-tables.up.sql diff --git a/prover/prover_dal/migrations/20240419102606_add_changes_for_recursion_tip.down.sql b/prover/crates/lib/prover_dal/migrations/20240419102606_add_changes_for_recursion_tip.down.sql similarity index 100% rename from prover/prover_dal/migrations/20240419102606_add_changes_for_recursion_tip.down.sql rename to prover/crates/lib/prover_dal/migrations/20240419102606_add_changes_for_recursion_tip.down.sql diff --git a/prover/prover_dal/migrations/20240419102606_add_changes_for_recursion_tip.up.sql b/prover/crates/lib/prover_dal/migrations/20240419102606_add_changes_for_recursion_tip.up.sql similarity index 100% rename from prover/prover_dal/migrations/20240419102606_add_changes_for_recursion_tip.up.sql rename to prover/crates/lib/prover_dal/migrations/20240419102606_add_changes_for_recursion_tip.up.sql diff --git a/prover/prover_dal/migrations/20240524123522_add-patch-columns-for-semver.down.sql b/prover/crates/lib/prover_dal/migrations/20240524123522_add-patch-columns-for-semver.down.sql similarity index 100% rename from prover/prover_dal/migrations/20240524123522_add-patch-columns-for-semver.down.sql rename to prover/crates/lib/prover_dal/migrations/20240524123522_add-patch-columns-for-semver.down.sql diff --git a/prover/prover_dal/migrations/20240524123522_add-patch-columns-for-semver.up.sql b/prover/crates/lib/prover_dal/migrations/20240524123522_add-patch-columns-for-semver.up.sql similarity index 100% rename from prover/prover_dal/migrations/20240524123522_add-patch-columns-for-semver.up.sql rename to prover/crates/lib/prover_dal/migrations/20240524123522_add-patch-columns-for-semver.up.sql diff --git a/prover/prover_dal/migrations/20240613111518_make_number_of_final_node_jobs_mandatory.down.sql b/prover/crates/lib/prover_dal/migrations/20240613111518_make_number_of_final_node_jobs_mandatory.down.sql similarity index 100% rename from prover/prover_dal/migrations/20240613111518_make_number_of_final_node_jobs_mandatory.down.sql rename to prover/crates/lib/prover_dal/migrations/20240613111518_make_number_of_final_node_jobs_mandatory.down.sql diff --git a/prover/prover_dal/migrations/20240613111518_make_number_of_final_node_jobs_mandatory.up.sql b/prover/crates/lib/prover_dal/migrations/20240613111518_make_number_of_final_node_jobs_mandatory.up.sql similarity index 100% rename from prover/prover_dal/migrations/20240613111518_make_number_of_final_node_jobs_mandatory.up.sql rename to prover/crates/lib/prover_dal/migrations/20240613111518_make_number_of_final_node_jobs_mandatory.up.sql diff --git a/prover/prover_dal/migrations/20240703113903_add-vm_run_data-column.down.sql b/prover/crates/lib/prover_dal/migrations/20240703113903_add-vm_run_data-column.down.sql similarity index 100% rename from prover/prover_dal/migrations/20240703113903_add-vm_run_data-column.down.sql rename to prover/crates/lib/prover_dal/migrations/20240703113903_add-vm_run_data-column.down.sql diff --git a/prover/prover_dal/migrations/20240703113903_add-vm_run_data-column.up.sql b/prover/crates/lib/prover_dal/migrations/20240703113903_add-vm_run_data-column.up.sql similarity index 100% rename from prover/prover_dal/migrations/20240703113903_add-vm_run_data-column.up.sql rename to prover/crates/lib/prover_dal/migrations/20240703113903_add-vm_run_data-column.up.sql diff --git a/prover/crates/lib/prover_dal/migrations/20240722102219_remove_unused_columns_after_bwip.down.sql b/prover/crates/lib/prover_dal/migrations/20240722102219_remove_unused_columns_after_bwip.down.sql new file mode 100644 index 000000000000..aa57b5f643d8 --- /dev/null +++ b/prover/crates/lib/prover_dal/migrations/20240722102219_remove_unused_columns_after_bwip.down.sql @@ -0,0 +1,6 @@ +ALTER TABLE witness_inputs_fri ADD COLUMN IF NOT EXISTS merkle_tree_paths_blob_url TEXT; +ALTER TABLE witness_inputs_fri ADD COLUMN IF NOT EXISTS eip_4844_blobs TEXT; +ALTER TABLE witness_inputs_fri ADD COLUMN IF NOT EXISTS is_blob_cleaned BOOLEAN; +ALTER TABLE leaf_aggregation_witness_jobs_fri ADD COLUMN IF NOT EXISTS is_blob_cleaned BOOLEAN; +ALTER TABLE prover_jobs_fri ADD COLUMN IF NOT EXISTS is_blob_cleaned BOOLEAN; +ALTER TABLE prover_jobs_fri_archive ADD COLUMN IF NOT EXISTS is_blob_cleaned BOOLEAN; diff --git a/prover/crates/lib/prover_dal/migrations/20240722102219_remove_unused_columns_after_bwip.up.sql b/prover/crates/lib/prover_dal/migrations/20240722102219_remove_unused_columns_after_bwip.up.sql new file mode 100644 index 000000000000..62b32871167f --- /dev/null +++ b/prover/crates/lib/prover_dal/migrations/20240722102219_remove_unused_columns_after_bwip.up.sql @@ -0,0 +1,6 @@ +ALTER TABLE witness_inputs_fri DROP COLUMN IF EXISTS merkle_tree_paths_blob_url; +ALTER TABLE witness_inputs_fri DROP COLUMN IF EXISTS eip_4844_blobs; +ALTER TABLE witness_inputs_fri DROP COLUMN IF EXISTS is_blob_cleaned; +ALTER TABLE leaf_aggregation_witness_jobs_fri DROP COLUMN IF EXISTS is_blob_cleaned; +ALTER TABLE prover_jobs_fri DROP COLUMN IF EXISTS is_blob_cleaned; +ALTER TABLE prover_jobs_fri_archive DROP COLUMN IF EXISTS is_blob_cleaned; diff --git a/prover/prover_dal/src/fri_gpu_prover_queue_dal.rs b/prover/crates/lib/prover_dal/src/fri_gpu_prover_queue_dal.rs similarity index 100% rename from prover/prover_dal/src/fri_gpu_prover_queue_dal.rs rename to prover/crates/lib/prover_dal/src/fri_gpu_prover_queue_dal.rs diff --git a/prover/prover_dal/src/fri_proof_compressor_dal.rs b/prover/crates/lib/prover_dal/src/fri_proof_compressor_dal.rs similarity index 100% rename from prover/prover_dal/src/fri_proof_compressor_dal.rs rename to prover/crates/lib/prover_dal/src/fri_proof_compressor_dal.rs diff --git a/prover/prover_dal/src/fri_protocol_versions_dal.rs b/prover/crates/lib/prover_dal/src/fri_protocol_versions_dal.rs similarity index 100% rename from prover/prover_dal/src/fri_protocol_versions_dal.rs rename to prover/crates/lib/prover_dal/src/fri_protocol_versions_dal.rs diff --git a/prover/prover_dal/src/fri_prover_dal.rs b/prover/crates/lib/prover_dal/src/fri_prover_dal.rs similarity index 99% rename from prover/prover_dal/src/fri_prover_dal.rs rename to prover/crates/lib/prover_dal/src/fri_prover_dal.rs index 419cb635ac53..f6efc6afa6ad 100644 --- a/prover/prover_dal/src/fri_prover_dal.rs +++ b/prover/crates/lib/prover_dal/src/fri_prover_dal.rs @@ -669,7 +669,6 @@ impl FriProverDal<'_, '_> { created_at: row.created_at, updated_at: row.updated_at, time_taken: row.time_taken, - is_blob_cleaned: row.is_blob_cleaned, depth: row.depth as u32, is_node_final_proof: row.is_node_final_proof, proof_blob_url: row.proof_blob_url.clone(), diff --git a/prover/prover_dal/src/fri_witness_generator_dal.rs b/prover/crates/lib/prover_dal/src/fri_witness_generator_dal.rs similarity index 98% rename from prover/prover_dal/src/fri_witness_generator_dal.rs rename to prover/crates/lib/prover_dal/src/fri_witness_generator_dal.rs index d56d18550e50..bc9cde72fde2 100644 --- a/prover/prover_dal/src/fri_witness_generator_dal.rs +++ b/prover/crates/lib/prover_dal/src/fri_witness_generator_dal.rs @@ -4,7 +4,7 @@ use std::{collections::HashMap, str::FromStr, time::Duration}; use sqlx::{types::chrono::NaiveDateTime, Row}; use zksync_basic_types::{ - basic_fri_types::{AggregationRound, Eip4844Blobs}, + basic_fri_types::AggregationRound, protocol_version::{ProtocolSemanticVersion, ProtocolVersionId, VersionPatch}, prover_dal::{ BasicWitnessGeneratorJobInfo, JobCountStatistics, LeafAggregationJobMetadata, @@ -43,35 +43,28 @@ impl FriWitnessGeneratorDal<'_, '_> { pub async fn save_witness_inputs( &mut self, block_number: L1BatchNumber, - merkle_paths_blob_url: &str, witness_inputs_blob_url: &str, protocol_version: ProtocolSemanticVersion, - eip_4844_blobs: Eip4844Blobs, ) { - let blobs_raw = eip_4844_blobs.encode(); sqlx::query!( r#" INSERT INTO witness_inputs_fri ( l1_batch_number, - merkle_tree_paths_blob_url, witness_inputs_blob_url, protocol_version, - eip_4844_blobs, status, created_at, updated_at, protocol_version_patch ) VALUES - ($1, $2, $3, $4, $5, 'queued', NOW(), NOW(), $6) + ($1, $2, $3, 'queued', NOW(), NOW(), $4) ON CONFLICT (l1_batch_number) DO NOTHING "#, i64::from(block_number.0), - merkle_paths_blob_url, witness_inputs_blob_url, protocol_version.minor as i32, - blobs_raw, protocol_version.patch.0 as i32, ) .fetch_optional(self.storage.conn()) @@ -1464,7 +1457,6 @@ impl FriWitnessGeneratorDal<'_, '_> { .unwrap() .map(|row| BasicWitnessGeneratorJobInfo { l1_batch_number, - merkle_tree_paths_blob_url: row.merkle_tree_paths_blob_url, witness_inputs_blob_url: row.witness_inputs_blob_url, attempts: row.attempts as u32, status: row.status.parse::().unwrap(), @@ -1473,15 +1465,8 @@ impl FriWitnessGeneratorDal<'_, '_> { updated_at: row.updated_at, processing_started_at: row.processing_started_at, time_taken: row.time_taken, - is_blob_cleaned: row.is_blob_cleaned, protocol_version: row.protocol_version, picked_by: row.picked_by, - eip_4844_blobs: row - .eip_4844_blobs - .as_deref() - .map(Eip4844Blobs::decode) - .transpose() - .unwrap(), }) } @@ -1516,7 +1501,6 @@ impl FriWitnessGeneratorDal<'_, '_> { updated_at: row.updated_at, processing_started_at: row.processing_started_at, time_taken: row.time_taken, - is_blob_cleaned: row.is_blob_cleaned, protocol_version: row.protocol_version, picked_by: row.picked_by.clone(), number_of_basic_circuits: row.number_of_basic_circuits, diff --git a/prover/prover_dal/src/lib.rs b/prover/crates/lib/prover_dal/src/lib.rs similarity index 100% rename from prover/prover_dal/src/lib.rs rename to prover/crates/lib/prover_dal/src/lib.rs diff --git a/prover/prover_fri_types/Cargo.toml b/prover/crates/lib/prover_fri_types/Cargo.toml similarity index 100% rename from prover/prover_fri_types/Cargo.toml rename to prover/crates/lib/prover_fri_types/Cargo.toml diff --git a/prover/prover_fri_types/README.md b/prover/crates/lib/prover_fri_types/README.md similarity index 100% rename from prover/prover_fri_types/README.md rename to prover/crates/lib/prover_fri_types/README.md diff --git a/prover/prover_fri_types/src/keys.rs b/prover/crates/lib/prover_fri_types/src/keys.rs similarity index 100% rename from prover/prover_fri_types/src/keys.rs rename to prover/crates/lib/prover_fri_types/src/keys.rs diff --git a/prover/prover_fri_types/src/lib.rs b/prover/crates/lib/prover_fri_types/src/lib.rs similarity index 100% rename from prover/prover_fri_types/src/lib.rs rename to prover/crates/lib/prover_fri_types/src/lib.rs diff --git a/prover/prover_fri_types/src/queue.rs b/prover/crates/lib/prover_fri_types/src/queue.rs similarity index 100% rename from prover/prover_fri_types/src/queue.rs rename to prover/crates/lib/prover_fri_types/src/queue.rs diff --git a/prover/prover_fri_utils/Cargo.toml b/prover/crates/lib/prover_fri_utils/Cargo.toml similarity index 100% rename from prover/prover_fri_utils/Cargo.toml rename to prover/crates/lib/prover_fri_utils/Cargo.toml diff --git a/prover/prover_fri_utils/src/lib.rs b/prover/crates/lib/prover_fri_utils/src/lib.rs similarity index 100% rename from prover/prover_fri_utils/src/lib.rs rename to prover/crates/lib/prover_fri_utils/src/lib.rs diff --git a/prover/prover_fri_utils/src/metrics.rs b/prover/crates/lib/prover_fri_utils/src/metrics.rs similarity index 100% rename from prover/prover_fri_utils/src/metrics.rs rename to prover/crates/lib/prover_fri_utils/src/metrics.rs diff --git a/prover/crates/lib/prover_fri_utils/src/region_fetcher.rs b/prover/crates/lib/prover_fri_utils/src/region_fetcher.rs new file mode 100644 index 000000000000..c73e83d531b4 --- /dev/null +++ b/prover/crates/lib/prover_fri_utils/src/region_fetcher.rs @@ -0,0 +1,98 @@ +use core::fmt; + +use anyhow::Context; +use regex::Regex; +use reqwest::{ + header::{HeaderMap, HeaderValue}, + Method, +}; +use zksync_config::configs::fri_prover::CloudType; +use zksync_utils::http_with_retries::send_request_with_retries; + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct RegionFetcher { + cloud_type: CloudType, + zone_url: String, +} + +impl RegionFetcher { + pub fn new(cloud_type: CloudType, zone_url: String) -> Self { + Self { + cloud_type, + zone_url, + } + } + + pub async fn get_zone(&self) -> anyhow::Result { + match self.cloud_type { + CloudType::GCP => GcpZoneFetcher::get_zone(&self.zone_url).await, + CloudType::Local => Ok(Zone("local".to_string())), + } + } +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct Zone(String); + +impl fmt::Display for Zone { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.0) + } +} + +impl Zone { + pub fn new(zone: T) -> Self { + Self(zone.to_string()) + } +} + +#[derive(Debug, Clone, Copy)] +struct GcpZoneFetcher; + +impl GcpZoneFetcher { + pub async fn get_zone(zone_url: &str) -> anyhow::Result { + let data = Self::fetch_from_url(zone_url) + .await + .context("fetch_from_url()")?; + Self::parse_zone(&data).context("parse_zone") + } + + async fn fetch_from_url(url: &str) -> anyhow::Result { + let mut headers = HeaderMap::new(); + headers.insert("Metadata-Flavor", HeaderValue::from_static("Google")); + let response = send_request_with_retries(url, 5, Method::GET, Some(headers), None).await; + response + .map_err(|err| anyhow::anyhow!("Failed fetching response from url: {url}: {err:?}"))? + .text() + .await + .context("Failed to read response as text") + } + + fn parse_zone(data: &str) -> anyhow::Result { + // Statically provided Regex should always compile. + let re = Regex::new(r"^projects/\d+/zones/(\w+-\w+-\w+)$").unwrap(); + if let Some(caps) = re.captures(data) { + let zone = &caps[1]; + return Ok(Zone(zone.to_string())); + } + anyhow::bail!("failed to extract zone from: {data}"); + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_parse_zone() { + let data = "projects/295056426491/zones/us-central1-a"; + let zone = GcpZoneFetcher::parse_zone(data).unwrap(); + assert_eq!(zone, Zone::new("us-central1-a")); + } + + #[test] + fn test_parse_zone_panic() { + let data = "invalid data"; + assert!(GcpZoneFetcher::parse_zone(data).is_err()); + } +} diff --git a/prover/prover_fri_utils/src/socket_utils.rs b/prover/crates/lib/prover_fri_utils/src/socket_utils.rs similarity index 100% rename from prover/prover_fri_utils/src/socket_utils.rs rename to prover/crates/lib/prover_fri_utils/src/socket_utils.rs diff --git a/prover/prover_dal/.sqlx/query-adaa3126792aac4e3afb805068f01ab8ae3f32526d9b5eadcfe52d139f7d6e66.json b/prover/prover_dal/.sqlx/query-adaa3126792aac4e3afb805068f01ab8ae3f32526d9b5eadcfe52d139f7d6e66.json deleted file mode 100644 index 1af0943a3dd8..000000000000 --- a/prover/prover_dal/.sqlx/query-adaa3126792aac4e3afb805068f01ab8ae3f32526d9b5eadcfe52d139f7d6e66.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "db_name": "PostgreSQL", - "query": "\n INSERT INTO\n witness_inputs_fri (\n l1_batch_number,\n merkle_tree_paths_blob_url,\n witness_inputs_blob_url,\n protocol_version,\n eip_4844_blobs,\n status,\n created_at,\n updated_at,\n protocol_version_patch\n )\n VALUES\n ($1, $2, $3, $4, $5, 'queued', NOW(), NOW(), $6)\n ON CONFLICT (l1_batch_number) DO NOTHING\n ", - "describe": { - "columns": [], - "parameters": { - "Left": [ - "Int8", - "Text", - "Text", - "Int4", - "Bytea", - "Int4" - ] - }, - "nullable": [] - }, - "hash": "adaa3126792aac4e3afb805068f01ab8ae3f32526d9b5eadcfe52d139f7d6e66" -} diff --git a/prover/prover_fri_gateway/src/api_data_fetcher.rs b/prover/prover_fri_gateway/src/api_data_fetcher.rs deleted file mode 100644 index f2492588c739..000000000000 --- a/prover/prover_fri_gateway/src/api_data_fetcher.rs +++ /dev/null @@ -1,109 +0,0 @@ -use std::{sync::Arc, time::Duration}; - -use async_trait::async_trait; -use reqwest::Client; -use serde::{de::DeserializeOwned, Serialize}; -use tokio::{sync::watch, time::sleep}; -use zksync_object_store::ObjectStore; -use zksync_prover_dal::{ConnectionPool, Prover}; - -use crate::metrics::METRICS; - -/// The path to the API endpoint that returns the next proof generation data. -pub(crate) const PROOF_GENERATION_DATA_PATH: &str = "/proof_generation_data"; - -/// The path to the API endpoint that submits the proof. -pub(crate) const SUBMIT_PROOF_PATH: &str = "/submit_proof"; - -pub(crate) struct PeriodicApiStruct { - pub(crate) blob_store: Arc, - pub(crate) pool: ConnectionPool, - pub(crate) api_url: String, - pub(crate) poll_duration: Duration, - pub(crate) client: Client, -} - -impl PeriodicApiStruct { - pub(crate) async fn send_http_request( - &self, - request: Req, - endpoint: &str, - ) -> Result - where - Req: Serialize, - Resp: DeserializeOwned, - { - tracing::info!("Sending request to {}", endpoint); - - self.client - .post(endpoint) - .json(&request) - .send() - .await? - .error_for_status()? - .json::() - .await - } - - pub(crate) async fn run( - self, - mut stop_receiver: watch::Receiver, - ) -> anyhow::Result<()> - where - Req: Send, - Self: PeriodicApi, - { - tracing::info!( - "Starting periodic job: {} with frequency: {:?}", - Self::SERVICE_NAME, - self.poll_duration - ); - - loop { - if *stop_receiver.borrow() { - tracing::warn!("Stop signal received, shutting down {}", Self::SERVICE_NAME); - return Ok(()); - } - - if let Some((job_id, request)) = self.get_next_request().await { - match self.send_request(job_id, request).await { - Ok(response) => { - self.handle_response(job_id, response).await; - } - Err(err) => { - METRICS.http_error[&Self::SERVICE_NAME].inc(); - tracing::error!("HTTP request failed due to error: {}", err); - } - } - } - tokio::select! { - _ = stop_receiver.changed() => { - tracing::warn!("Stop signal received, shutting down {}", Self::SERVICE_NAME); - return Ok(()); - } - _ = sleep(self.poll_duration) => {} - } - } - } -} - -/// Trait for fetching data from an API periodically. -#[async_trait] -pub(crate) trait PeriodicApi: Sync + Send { - type JobId: Send + Copy; - type Response: Send; - - const SERVICE_NAME: &'static str; - - /// Returns the next request to be sent to the API and the endpoint to send it to. - async fn get_next_request(&self) -> Option<(Self::JobId, Req)>; - - /// Handles the response from the API. - async fn send_request( - &self, - job_id: Self::JobId, - request: Req, - ) -> reqwest::Result; - - async fn handle_response(&self, job_id: Self::JobId, response: Self::Response); -} diff --git a/prover/prover_fri_utils/src/region_fetcher.rs b/prover/prover_fri_utils/src/region_fetcher.rs deleted file mode 100644 index cae211c26cbe..000000000000 --- a/prover/prover_fri_utils/src/region_fetcher.rs +++ /dev/null @@ -1,51 +0,0 @@ -use anyhow::Context; -use regex::Regex; -use reqwest::{ - header::{HeaderMap, HeaderValue}, - Method, -}; -use zksync_utils::http_with_retries::send_request_with_retries; - -pub async fn get_zone(zone_url: &str) -> anyhow::Result { - let data = fetch_from_url(zone_url).await.context("fetch_from_url()")?; - parse_zone(&data).context("parse_zone") -} - -async fn fetch_from_url(url: &str) -> anyhow::Result { - let mut headers = HeaderMap::new(); - headers.insert("Metadata-Flavor", HeaderValue::from_static("Google")); - let response = send_request_with_retries(url, 5, Method::GET, Some(headers), None).await; - response - .map_err(|err| anyhow::anyhow!("Failed fetching response from url: {url}: {err:?}"))? - .text() - .await - .context("Failed to read response as text") -} - -fn parse_zone(data: &str) -> anyhow::Result { - // Statically provided Regex should always compile. - let re = Regex::new(r"^projects/\d+/zones/(\w+-\w+-\w+)$").unwrap(); - if let Some(caps) = re.captures(data) { - let zone = &caps[1]; - return Ok(zone.to_string()); - } - anyhow::bail!("failed to extract zone from: {data}"); -} - -#[cfg(test)] -mod tests { - use crate::region_fetcher::parse_zone; - - #[test] - fn test_parse_zone() { - let data = "projects/295056426491/zones/us-central1-a"; - let zone = parse_zone(data).unwrap(); - assert_eq!(zone, "us-central1-a"); - } - - #[test] - fn test_parse_zone_panic() { - let data = "invalid data"; - assert!(parse_zone(data).is_err()); - } -} diff --git a/zk_toolbox/crates/zk_inception/src/consts.rs b/zk_toolbox/crates/zk_inception/src/consts.rs index e0258fb46402..d9b61d49185a 100644 --- a/zk_toolbox/crates/zk_inception/src/consts.rs +++ b/zk_toolbox/crates/zk_inception/src/consts.rs @@ -2,7 +2,7 @@ pub const AMOUNT_FOR_DISTRIBUTION_TO_WALLETS: u128 = 1000000000000000000000; pub const MINIMUM_BALANCE_FOR_WALLET: u128 = 5000000000000000000; pub const SERVER_MIGRATIONS: &str = "core/lib/dal/migrations"; -pub const PROVER_MIGRATIONS: &str = "prover/prover_dal/migrations"; +pub const PROVER_MIGRATIONS: &str = "prover/crates/lib/prover_dal/migrations"; pub const PROVER_STORE_MAX_RETRIES: u16 = 10; pub const DEFAULT_CREDENTIALS_FILE: &str = "~/.config/gcloud/application_default_credentials.json"; pub const DEFAULT_PROOF_STORE_DIR: &str = "artifacts"; diff --git a/zk_toolbox/crates/zk_supervisor/src/dals.rs b/zk_toolbox/crates/zk_supervisor/src/dals.rs index ae8815c96899..854a6b979494 100644 --- a/zk_toolbox/crates/zk_supervisor/src/dals.rs +++ b/zk_toolbox/crates/zk_supervisor/src/dals.rs @@ -7,7 +7,7 @@ use xshell::Shell; use crate::messages::{MSG_CHAIN_NOT_FOUND_ERR, MSG_PROVER_URL_MUST_BE_PRESENTED}; const CORE_DAL_PATH: &str = "core/lib/dal"; -const PROVER_DAL_PATH: &str = "prover/prover_dal"; +const PROVER_DAL_PATH: &str = "prover/crates/lib/prover_dal"; #[derive(Debug, Clone)] pub struct SelectedDals {