Skip to content

Commit

Permalink
Merge branch 'main' into change-zkSync-to-ZKsync
Browse files Browse the repository at this point in the history
  • Loading branch information
montekki authored Jun 19, 2024
2 parents 9659f66 + 3ee34be commit c6d5e2d
Show file tree
Hide file tree
Showing 110 changed files with 2,594 additions and 678 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci-common-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
- name: Init
run: |
ci_run zk
ci_run run_retried rustup show
ci_run zk db setup
# This does both linting and "building". We're using `zk lint prover` as it's common practice within our repo
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-core-lint-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
- name: Setup db
run: |
ci_run zk
ci_run run_retried rustup show
ci_run zk db migrate
- name: Lints
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
- name: Init
run: |
ci_run zk
ci_run run_retried rustup show
ci_run zk run yarn
ci_run zk db setup
ci_run zk compiler all
Expand Down Expand Up @@ -192,6 +193,7 @@ jobs:
ci_run git config --global --add safe.directory /usr/src/zksync/contracts/system-contracts
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk
ci_run run_retried rustup show
if [[ "${{ matrix.deployment_mode }}" == "Validium" ]]; then
ci_run zk env dev_validium_docker
ci_run zk config compile dev_validium_docker
Expand Down Expand Up @@ -333,6 +335,7 @@ jobs:
ci_run git config --global --add safe.directory /usr/src/zksync/contracts/system-contracts
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk
ci_run run_retried rustup show
if [[ "${{ matrix.deployment_mode }}" == "Rollup" ]]; then
ci_run zk config compile
elif [[ "${{ matrix.deployment_mode }}" == "Validium" ]]; then
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci-prover-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
- name: Init
run: |
ci_run zk
ci_run run_retried rustup show
ci_run zk db setup
- name: Prover unit tests
Expand Down
32 changes: 27 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ members = [
"core/lib/basic_types",
"core/lib/config",
"core/lib/constants",
"core/lib/contract_verifier",
"core/lib/contracts",
"core/lib/crypto",
"core/lib/circuit_breaker",
Expand Down Expand Up @@ -212,6 +213,7 @@ zksync = { path = "sdk/zksync-rs" }
zksync_basic_types = { path = "core/lib/basic_types" }
zksync_circuit_breaker = { path = "core/lib/circuit_breaker" }
zksync_config = { path = "core/lib/config" }
zksync_contract_verifier_lib = { path = "core/lib/contract_verifier" }
zksync_contracts = { path = "core/lib/contracts" }
zksync_core_leftovers = { path = "core/lib/zksync_core_leftovers" }
zksync_crypto = { path = "core/lib/crypto" }
Expand Down
1 change: 1 addition & 0 deletions checks-config/era.dic
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ zksync_merkle_tree
TreeMetadata
delegator
decrement
whitelisted
Bbellman
Sbellman
DCMAKE
Expand Down
13 changes: 1 addition & 12 deletions core/bin/contract-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ categories.workspace = true
publish = false

[dependencies]
zksync_types.workspace = true
zksync_dal.workspace = true
zksync_env_config.workspace = true
zksync_config.workspace = true
zksync_contracts.workspace = true
zksync_contract_verifier_lib.workspace = true
zksync_queued_job_processor.workspace = true
zksync_utils.workspace = true
prometheus_exporter.workspace = true
Expand All @@ -25,15 +24,5 @@ anyhow.workspace = true
tokio = { workspace = true, features = ["full"] }
futures.workspace = true
ctrlc.workspace = true
thiserror.workspace = true
chrono.workspace = true
serde_json.workspace = true
ethabi.workspace = true
vise.workspace = true
hex.workspace = true
serde = { workspace = true, features = ["derive"] }
structopt.workspace = true
lazy_static.workspace = true
tempfile.workspace = true
regex.workspace = true
tracing.workspace = true
9 changes: 1 addition & 8 deletions core/bin/contract-verifier/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,12 @@ use zksync_config::{
configs::{ObservabilityConfig, PrometheusConfig},
ApiConfig, ContractVerifierConfig,
};
use zksync_contract_verifier_lib::ContractVerifier;
use zksync_dal::{ConnectionPool, Core, CoreDal};
use zksync_env_config::FromEnv;
use zksync_queued_job_processor::JobProcessor;
use zksync_utils::{wait_for_tasks::ManagedTasks, workspace_dir_or_current_dir};

use crate::verifier::ContractVerifier;

pub mod error;
mod metrics;
pub mod verifier;
pub mod zksolc_utils;
pub mod zkvyper_utils;

async fn update_compiler_versions(connection_pool: &ConnectionPool<Core>) {
let mut storage = connection_pool.connection().await.unwrap();
let mut transaction = storage.start_transaction().await.unwrap();
Expand Down
1 change: 1 addition & 0 deletions core/bin/external_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ zksync_metadata_calculator.workspace = true
zksync_node_sync.workspace = true
zksync_node_api_server.workspace = true
zksync_node_consensus.workspace = true
zksync_node_framework.workspace = true
vlog.workspace = true

zksync_concurrency.workspace = true
Expand Down
31 changes: 27 additions & 4 deletions core/bin/external_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::{collections::HashSet, net::Ipv4Addr, str::FromStr, sync::Arc, time::Du
use anyhow::Context as _;
use clap::Parser;
use metrics::EN_METRICS;
use node_builder::ExternalNodeBuilder;
use tokio::{
sync::{oneshot, watch, RwLock},
task::{self, JoinHandle},
Expand Down Expand Up @@ -63,6 +64,7 @@ mod config;
mod init;
mod metadata;
mod metrics;
mod node_builder;
#[cfg(test)]
mod tests;

Expand Down Expand Up @@ -426,10 +428,11 @@ async fn run_api(
.build()
.await
.context("failed to build a proxy_cache_updater_pool")?;
task_handles.push(tokio::spawn(tx_proxy.run_account_nonce_sweeper(
proxy_cache_updater_pool.clone(),
stop_receiver.clone(),
)));
task_handles.push(tokio::spawn(
tx_proxy
.account_nonce_sweeper_task(proxy_cache_updater_pool.clone())
.run(stop_receiver.clone()),
));

let fee_params_fetcher_handle =
tokio::spawn(fee_params_fetcher.clone().run(stop_receiver.clone()));
Expand Down Expand Up @@ -701,6 +704,10 @@ struct Cli {
/// Comma-separated list of components to launch.
#[arg(long, default_value = "all")]
components: ComponentsToRun,

/// Run the node using the node framework.
#[arg(long)]
use_node_framework: bool,
}

#[derive(Debug, Clone, Copy, PartialEq, Hash, Eq)]
Expand Down Expand Up @@ -784,6 +791,22 @@ async fn main() -> anyhow::Result<()> {
.fetch_remote(main_node_client.as_ref())
.await
.context("failed fetching remote part of node config from main node")?;

// If the node framework is used, run the node.
if opt.use_node_framework {
// We run the node from a different thread, since the current thread is in tokio context.
std::thread::spawn(move || {
let node =
ExternalNodeBuilder::new(config).build(opt.components.0.into_iter().collect())?;
node.run()?;
anyhow::Ok(())
})
.join()
.expect("Failed to run the node")?;

return Ok(());
}

if let Some(threshold) = config.optional.slow_query_threshold() {
ConnectionPool::<Core>::global_config().set_slow_query_threshold(threshold)?;
}
Expand Down
Loading

0 comments on commit c6d5e2d

Please sign in to comment.