Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
feat: Make all core workspace crate names start with zksync_ (matter-…
Browse files Browse the repository at this point in the history
…labs#2294)

## What ❔

Renames a bunch of crates (most notably, `multivm` and `vlog`) so that
they start with `zksync_` prefix.

## Why ❔

Unification within the workspace, less ambiguity if treated as global
crates.

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
  • Loading branch information
popzxc authored Jun 24, 2024
1 parent 67411fd commit 8861f29
Show file tree
Hide file tree
Showing 159 changed files with 520 additions and 515 deletions.
264 changes: 132 additions & 132 deletions Cargo.lock

Large diffs are not rendered by default.

13 changes: 6 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,12 @@ zksync_protobuf = { version = "0.1.0", git = "https://github.com/matter-labs/era
zksync_protobuf_build = { version = "0.1.0", git = "https://github.com/matter-labs/era-consensus.git", rev = "3e6f101ee4124308c4c974caaa259d524549b0c6" }

# "Local" dependencies
multivm = { path = "core/lib/multivm" }
prometheus_exporter = { path = "core/lib/prometheus_exporter" }
prover_dal = { path = "prover/prover_dal" }
vlog = { path = "core/lib/vlog" }
vm_utils = { path = "core/lib/vm_utils" }
vm-benchmark-harness = { path = "core/tests/vm-benchmark/harness" }
zksync = { path = "sdk/zksync-rs" }
zksync_multivm = { path = "core/lib/multivm" }
zksync_prometheus_exporter = { path = "core/lib/prometheus_exporter" }
zksync_prover_dal = { path = "prover/prover_dal" }
zksync_vlog = { path = "core/lib/vlog" }
zksync_vm_utils = { path = "core/lib/vm_utils" }
zksync_vm_benchmark_harness = { path = "core/tests/vm-benchmark/harness" }
zksync_basic_types = { path = "core/lib/basic_types" }
zksync_circuit_breaker = { path = "core/lib/circuit_breaker" }
zksync_config = { path = "core/lib/config" }
Expand Down
2 changes: 1 addition & 1 deletion core/bin/block_reverter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ zksync_dal.workspace = true
zksync_object_store.workspace = true
zksync_types.workspace = true
zksync_block_reverter.workspace = true
vlog.workspace = true
zksync_vlog.workspace = true

anyhow.workspace = true
clap = { workspace = true, features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions core/bin/block_reverter/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ async fn main() -> anyhow::Result<()> {
let command = Cli::parse().command;
let observability_config =
ObservabilityConfig::from_env().context("ObservabilityConfig::from_env()")?;
let log_format: vlog::LogFormat = observability_config
let log_format: zksync_vlog::LogFormat = observability_config
.log_format
.parse()
.context("Invalid log format")?;

let mut builder = vlog::ObservabilityBuilder::new()
let mut builder = zksync_vlog::ObservabilityBuilder::new()
.with_log_format(log_format)
.disable_default_logs(); // It's a CLI application, so we only need to show logs that were actually requested.
if let Some(sentry_url) = observability_config.sentry_url {
Expand Down
4 changes: 2 additions & 2 deletions core/bin/contract-verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ zksync_config.workspace = true
zksync_contract_verifier_lib.workspace = true
zksync_queued_job_processor.workspace = true
zksync_utils.workspace = true
prometheus_exporter.workspace = true
vlog.workspace = true
zksync_prometheus_exporter.workspace = true
zksync_vlog.workspace = true

anyhow.workspace = true
tokio = { workspace = true, features = ["full"] }
Expand Down
6 changes: 3 additions & 3 deletions core/bin/contract-verifier/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ use std::{cell::RefCell, time::Duration};

use anyhow::Context as _;
use futures::{channel::mpsc, executor::block_on, SinkExt, StreamExt};
use prometheus_exporter::PrometheusExporterConfig;
use structopt::StructOpt;
use tokio::sync::watch;
use zksync_config::{
Expand All @@ -12,6 +11,7 @@ use zksync_config::{
use zksync_contract_verifier_lib::ContractVerifier;
use zksync_dal::{ConnectionPool, Core, CoreDal};
use zksync_env_config::FromEnv;
use zksync_prometheus_exporter::PrometheusExporterConfig;
use zksync_queued_job_processor::JobProcessor;
use zksync_utils::{wait_for_tasks::ManagedTasks, workspace_dir_or_current_dir};

Expand Down Expand Up @@ -140,11 +140,11 @@ async fn main() -> anyhow::Result<()> {

let observability_config =
ObservabilityConfig::from_env().context("ObservabilityConfig::from_env()")?;
let log_format: vlog::LogFormat = observability_config
let log_format: zksync_vlog::LogFormat = observability_config
.log_format
.parse()
.context("Invalid log format")?;
let mut builder = vlog::ObservabilityBuilder::new().with_log_format(log_format);
let mut builder = zksync_vlog::ObservabilityBuilder::new().with_log_format(log_format);
if let Some(sentry_url) = &observability_config.sentry_url {
builder = builder
.with_sentry_url(sentry_url)
Expand Down
4 changes: 2 additions & 2 deletions core/bin/external_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ zksync_contracts.workspace = true
zksync_l1_contract_interface.workspace = true
zksync_snapshots_applier.workspace = true
zksync_object_store.workspace = true
prometheus_exporter.workspace = true
zksync_prometheus_exporter.workspace = true
zksync_health_check.workspace = true
zksync_web3_decl.workspace = true
zksync_types.workspace = true
Expand All @@ -43,7 +43,7 @@ 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_vlog.workspace = true

zksync_concurrency.workspace = true
zksync_consensus_roles.workspace = true
Expand Down
8 changes: 4 additions & 4 deletions core/bin/external_node/src/config/observability.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{collections::HashMap, time::Duration};

use anyhow::Context as _;
use prometheus_exporter::PrometheusExporterConfig;
use serde::Deserialize;
use vlog::LogFormat;
use zksync_prometheus_exporter::PrometheusExporterConfig;
use zksync_vlog::LogFormat;

use super::{ConfigurationSource, Environment};

Expand Down Expand Up @@ -78,8 +78,8 @@ impl ObservabilityENConfig {
}
}

pub fn build_observability(&self) -> anyhow::Result<vlog::ObservabilityGuard> {
let mut builder = vlog::ObservabilityBuilder::new().with_log_format(self.log_format);
pub fn build_observability(&self) -> anyhow::Result<zksync_vlog::ObservabilityGuard> {
let mut builder = zksync_vlog::ObservabilityBuilder::new().with_log_format(self.log_format);
// Some legacy deployments use `unset` as an equivalent of `None`.
let sentry_url = self.sentry_url.as_deref().filter(|&url| url != "unset");
if let Some(sentry_url) = sentry_url {
Expand Down
6 changes: 3 additions & 3 deletions core/bin/external_node/src/config/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ fn parsing_observability_config() {
assert_eq!(config.prometheus_port, Some(3322));
assert_eq!(config.sentry_url.unwrap(), "https://example.com/");
assert_eq!(config.sentry_environment.unwrap(), "mainnet - mainnet2");
assert_matches!(config.log_format, vlog::LogFormat::Plain);
assert_matches!(config.log_format, zksync_vlog::LogFormat::Plain);
assert_eq!(config.prometheus_push_interval_ms, 10_000);

env_vars.0.insert("MISC_LOG_FORMAT", "json");
let config = ObservabilityENConfig::new(&env_vars).unwrap();
assert_matches!(config.log_format, vlog::LogFormat::Json);
assert_matches!(config.log_format, zksync_vlog::LogFormat::Json);

// If both the canonical and obsolete vars are specified, the canonical one should prevail.
env_vars.0.insert("EN_LOG_FORMAT", "plain");
env_vars
.0
.insert("EN_SENTRY_URL", "https://example.com/new");
let config = ObservabilityENConfig::new(&env_vars).unwrap();
assert_matches!(config.log_format, vlog::LogFormat::Plain);
assert_matches!(config.log_format, zksync_vlog::LogFormat::Plain);
assert_eq!(config.sentry_url.unwrap(), "https://example.com/new");
}

Expand Down
4 changes: 2 additions & 2 deletions core/bin/external_node/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ fn mock_eth_client(diamond_proxy_addr: Address) -> MockClient<L1> {
#[tokio::test]
#[tracing::instrument] // Add args to the test logs
async fn external_node_basics(components_str: &'static str) {
let _guard = vlog::ObservabilityBuilder::new().build(); // Enable logging to simplify debugging
let _guard = zksync_vlog::ObservabilityBuilder::new().build(); // Enable logging to simplify debugging
let temp_dir = tempfile::TempDir::new().unwrap();

// Simplest case to mock: the EN already has a genesis L1 batch / L2 block, and it's the only L1 batch / L2 block
Expand Down Expand Up @@ -252,7 +252,7 @@ async fn external_node_basics(components_str: &'static str) {

#[tokio::test]
async fn node_reacts_to_stop_signal_during_initial_reorg_detection() {
let _guard = vlog::ObservabilityBuilder::new().build(); // Enable logging to simplify debugging
let _guard = zksync_vlog::ObservabilityBuilder::new().build(); // Enable logging to simplify debugging
let temp_dir = tempfile::TempDir::new().unwrap();

let connection_pool = ConnectionPool::test_pool().await;
Expand Down
2 changes: 1 addition & 1 deletion core/bin/merkle_tree_consistency_checker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ zksync_env_config.workspace = true
zksync_merkle_tree.workspace = true
zksync_types.workspace = true
zksync_storage.workspace = true
vlog.workspace = true
zksync_vlog.workspace = true

anyhow.workspace = true
clap = { workspace = true, features = ["derive"] }
Expand Down
4 changes: 2 additions & 2 deletions core/bin/merkle_tree_consistency_checker/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ impl Cli {
fn main() -> anyhow::Result<()> {
let observability_config =
ObservabilityConfig::from_env().context("ObservabilityConfig::from_env()")?;
let log_format: vlog::LogFormat = observability_config
let log_format: zksync_vlog::LogFormat = observability_config
.log_format
.parse()
.context("Invalid log format")?;
let mut builder = vlog::ObservabilityBuilder::new().with_log_format(log_format);
let mut builder = zksync_vlog::ObservabilityBuilder::new().with_log_format(log_format);
if let Some(sentry_url) = observability_config.sentry_url {
builder = builder
.with_sentry_url(&sentry_url)
Expand Down
4 changes: 2 additions & 2 deletions core/bin/snapshots_creator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ publish = false

[dependencies]
vise.workspace = true
prometheus_exporter.workspace = true
zksync_prometheus_exporter.workspace = true
zksync_config.workspace = true
zksync_dal.workspace = true
zksync_env_config.workspace = true
zksync_types.workspace = true
zksync_object_store.workspace = true
vlog.workspace = true
zksync_vlog.workspace = true

anyhow.workspace = true
tokio = { workspace = true, features = ["full"] }
Expand Down
6 changes: 3 additions & 3 deletions core/bin/snapshots_creator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
//! at a time).
use anyhow::Context as _;
use prometheus_exporter::PrometheusExporterConfig;
use tokio::{sync::watch, task::JoinHandle};
use zksync_config::{
configs::{DatabaseSecrets, ObservabilityConfig, PrometheusConfig},
Expand All @@ -19,6 +18,7 @@ use zksync_config::{
use zksync_dal::{ConnectionPool, Core};
use zksync_env_config::{object_store::SnapshotsObjectStoreConfig, FromEnv};
use zksync_object_store::ObjectStoreFactory;
use zksync_prometheus_exporter::PrometheusExporterConfig;

use crate::creator::SnapshotCreator;

Expand Down Expand Up @@ -55,13 +55,13 @@ async fn main() -> anyhow::Result<()> {

let observability_config =
ObservabilityConfig::from_env().context("ObservabilityConfig::from_env()")?;
let log_format: vlog::LogFormat = observability_config
let log_format: zksync_vlog::LogFormat = observability_config
.log_format
.parse()
.context("Invalid log format")?;

let prometheus_exporter_task = maybe_enable_prometheus_metrics(stop_receiver).await?;
let mut builder = vlog::ObservabilityBuilder::new().with_log_format(log_format);
let mut builder = zksync_vlog::ObservabilityBuilder::new().with_log_format(log_format);
if let Some(sentry_url) = observability_config.sentry_url {
builder = builder
.with_sentry_url(&sentry_url)
Expand Down
2 changes: 1 addition & 1 deletion core/bin/system-constants-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ zksync_state.workspace = true
zksync_types.workspace = true
zksync_utils.workspace = true
zksync_contracts.workspace = true
multivm.workspace = true
zksync_multivm.workspace = true

codegen.workspace = true
serde.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion core/bin/system-constants-generator/src/intrinsic_costs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! as well as contracts/SystemConfig.json
//!
use multivm::utils::get_bootloader_encoding_space;
use zksync_multivm::utils::get_bootloader_encoding_space;
use zksync_types::{ethabi::Address, IntrinsicSystemGasConstants, ProtocolVersionId, U256};

use crate::utils::{
Expand Down
4 changes: 2 additions & 2 deletions core/bin/system-constants-generator/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use std::fs;

use codegen::{Block, Scope};
use multivm::{
use serde::{Deserialize, Serialize};
use zksync_multivm::{
utils::{get_bootloader_encoding_space, get_bootloader_max_txs_in_batch},
vm_latest::constants::MAX_VM_PUBDATA_PER_BATCH,
zk_evm_latest::zkevm_opcode_defs::{
Expand All @@ -12,7 +13,6 @@ use multivm::{
system_params::MAX_TX_ERGS_LIMIT,
},
};
use serde::{Deserialize, Serialize};
use zksync_types::{
IntrinsicSystemGasConstants, ProtocolVersionId, GUARANTEED_PUBDATA_IN_TX,
L1_GAS_PER_PUBDATA_BYTE, MAX_NEW_FACTORY_DEPS, REQUIRED_L1_TO_L2_GAS_PER_PUBDATA_BYTE,
Expand Down
12 changes: 6 additions & 6 deletions core/bin/system-constants-generator/src/utils.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
use std::{cell::RefCell, rc::Rc};

use multivm::{
use once_cell::sync::Lazy;
use zksync_contracts::{
load_sys_contract, read_bootloader_code, read_sys_contract_bytecode, read_zbin_bytecode,
BaseSystemContracts, ContractLanguage, SystemContractCode,
};
use zksync_multivm::{
interface::{
dyn_tracers::vm_1_5_0::DynTracer, tracer::VmExecutionStopReason, L1BatchEnv, L2BlockEnv,
SystemEnv, TxExecutionMode, VmExecutionMode, VmInterface,
Expand All @@ -12,11 +17,6 @@ use multivm::{
},
zk_evm_latest::aux_structures::Timestamp,
};
use once_cell::sync::Lazy;
use zksync_contracts::{
load_sys_contract, read_bootloader_code, read_sys_contract_bytecode, read_zbin_bytecode,
BaseSystemContracts, ContractLanguage, SystemContractCode,
};
use zksync_state::{InMemoryStorage, StorageView, WriteStorage};
use zksync_types::{
block::L2BlockHasher, ethabi::Token, fee::Fee, fee_model::BatchFeeInput, l1::L1Tx, l2::L2Tx,
Expand Down
4 changes: 2 additions & 2 deletions core/bin/zksync_server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ zksync_consensus_crypto.workspace = true
zksync_consensus_roles.workspace = true
zksync_consensus_executor.workspace = true
zksync_concurrency.workspace = true
vlog.workspace = true
zksync_vlog.workspace = true

anyhow.workspace = true
clap = { workspace = true, features = ["derive"] }
Expand All @@ -38,7 +38,7 @@ futures.workspace = true
zksync_node_framework.workspace = true
zksync_metadata_calculator.workspace = true
zksync_node_api_server.workspace = true
prometheus_exporter.workspace = true
zksync_prometheus_exporter.workspace = true

[target.'cfg(not(target_env = "msvc"))'.dependencies]
tikv-jemallocator.workspace = true
4 changes: 2 additions & 2 deletions core/bin/zksync_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ fn main() -> anyhow::Result<()> {
.clone()
.context("observability config")?;

let log_format: vlog::LogFormat = observability_config
let log_format: zksync_vlog::LogFormat = observability_config
.log_format
.parse()
.context("Invalid log format")?;

let mut builder = vlog::ObservabilityBuilder::new().with_log_format(log_format);
let mut builder = zksync_vlog::ObservabilityBuilder::new().with_log_format(log_format);
if let Some(log_directives) = observability_config.log_directives {
builder = builder.with_log_directives(log_directives);
}
Expand Down
2 changes: 1 addition & 1 deletion core/bin/zksync_server/src/node_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
//! as well as an interface to run the node with the specified components.
use anyhow::Context;
use prometheus_exporter::PrometheusExporterConfig;
use zksync_config::{
configs::{consensus::ConsensusConfig, wallets::Wallets, GeneralConfig, Secrets},
ContractsConfig, GenesisConfig,
Expand Down Expand Up @@ -50,6 +49,7 @@ use zksync_node_framework::{
},
service::{ZkStackService, ZkStackServiceBuilder},
};
use zksync_prometheus_exporter::PrometheusExporterConfig;

/// Macro that looks into a path to fetch an optional config,
/// and clones it into a variable.
Expand Down
4 changes: 2 additions & 2 deletions core/lib/db_connection/src/instrument.rs
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ mod tests {
#[tokio::test]
async fn instrumenting_erroneous_query() {
let pool = ConnectionPool::<InternalMarker>::test_pool().await;
// Add `vlog::init()` here to debug this test
// Add `zksync_vlog::init()` here to debug this test

let mut conn = pool.connection().await.unwrap();
sqlx::query("WHAT")
Expand All @@ -514,7 +514,7 @@ mod tests {
#[tokio::test]
async fn instrumenting_slow_query() {
let pool = ConnectionPool::<InternalMarker>::test_pool().await;
// Add `vlog::init()` here to debug this test
// Add `zksync_vlog::init()` here to debug this test

let mut conn = pool.connection().await.unwrap();
sqlx::query("SELECT pg_sleep(1.5)")
Expand Down
2 changes: 1 addition & 1 deletion core/lib/multivm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "multivm"
name = "zksync_multivm"
version = "0.1.0"
edition.workspace = true
authors.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion core/lib/multivm/src/interface/traits/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
//! sync::Arc
//! };
//! use once_cell::sync::OnceCell;
//! use multivm::{
//! use zksync_multivm::{
//! interface::{L1BatchEnv, SystemEnv, VmInterface},
//! tracers::CallTracer ,
//! vm_latest::ToTracerPointer
Expand Down
2 changes: 1 addition & 1 deletion core/lib/prometheus_exporter/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "prometheus_exporter"
name = "zksync_prometheus_exporter"
version = "0.1.0"
edition.workspace = true
authors.workspace = true
Expand Down
Loading

0 comments on commit 8861f29

Please sign in to comment.