Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Extract several crates from zksync_core #1859

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 114 additions & 2 deletions Cargo.lock

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

10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ members = [
"core/node/house_keeper",
"core/node/genesis",
"core/node/shared_metrics",
"core/node/db_pruner",
"core/node/fee_model",
"core/node/eth_sender",
"core/node/vm_runner",
"core/node/test_utils",
# Libraries
"core/lib/db_connection",
"core/lib/zksync_core",
Expand Down Expand Up @@ -231,3 +236,8 @@ zksync_block_reverter = { path = "core/node/block_reverter" }
zksync_commitment_generator = { path = "core/node/commitment_generator" }
zksync_house_keeper = { path = "core/node/house_keeper" }
zksync_node_genesis = { path = "core/node/genesis" }
zksync_eth_sender = { path = "core/node/eth_sender" }
zksync_node_db_pruner = { path = "core/node/db_pruner" }
zksync_node_fee_model = { path = "core/node/fee_model" }
zksync_vm_runner = { path = "core/node/vm_runner" }
zksync_node_test_utils = { path = "core/node/test_utils" }
3 changes: 3 additions & 0 deletions core/bin/external_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ zksync_types.workspace = true
zksync_block_reverter.workspace = true
zksync_shared_metrics.workspace = true
zksync_node_genesis.workspace = true
zksync_node_fee_model.workspace = true
zksync_node_db_pruner.workspace = true
zksync_eth_sender.workspace = true
vlog.workspace = true

zksync_concurrency.workspace = true
Expand Down
12 changes: 6 additions & 6 deletions core/bin/external_node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ use zksync_core::{
},
consensus,
consistency_checker::ConsistencyChecker,
db_pruner::{DbPruner, DbPrunerConfig},
eth_sender::l1_batch_commit_data_generator::{
L1BatchCommitDataGenerator, RollupModeL1BatchCommitDataGenerator,
ValidiumModeL1BatchCommitDataGenerator,
},
l1_gas_price::MainNodeFeeParamsFetcher,
metadata_calculator::{MetadataCalculator, MetadataCalculatorConfig},
reorg_detector::{self, ReorgDetector},
setup_sigint_handler,
Expand All @@ -50,7 +44,13 @@ use zksync_db_connection::{
connection_pool::ConnectionPoolBuilder, healthcheck::ConnectionPoolHealthCheck,
};
use zksync_eth_client::{clients::QueryClient, EthInterface};
use zksync_eth_sender::l1_batch_commit_data_generator::{
L1BatchCommitDataGenerator, RollupModeL1BatchCommitDataGenerator,
ValidiumModeL1BatchCommitDataGenerator,
};
use zksync_health_check::{AppHealthCheck, HealthStatus, ReactiveHealthCheck};
use zksync_node_db_pruner::{DbPruner, DbPrunerConfig};
use zksync_node_fee_model::l1_gas_price::MainNodeFeeParamsFetcher;
use zksync_state::{PostgresStorageCaches, RocksdbStorageOptions};
use zksync_storage::RocksDB;
use zksync_types::L2ChainId;
Expand Down
4 changes: 3 additions & 1 deletion core/lib/env_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ keywords.workspace = true
categories.workspace = true

[dependencies]
zksync_system_constants.workspace = true
zksync_basic_types.workspace = true
zksync_config.workspace = true

anyhow.workspace = true
serde.workspace = true
envy.workspace = true

[dev-dependencies]
zksync_system_constants.workspace = true
1 change: 0 additions & 1 deletion core/lib/protobuf_config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ zksync_protobuf.workspace = true
zksync_types.workspace = true

anyhow.workspace = true
pretty_assertions.workspace = true
prost.workspace = true
rand.workspace = true
hex = "0.4.3"
Expand Down
3 changes: 3 additions & 0 deletions core/lib/zksync_core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ zksync_proof_data_handler.workspace = true
zksync_commitment_generator.workspace = true
zksync_house_keeper.workspace = true
zksync_node_genesis.workspace = true
zksync_eth_sender.workspace = true
zksync_node_fee_model.workspace = true
multivm.workspace = true

# Consensus dependenices
Expand Down Expand Up @@ -96,6 +98,7 @@ tracing.workspace = true

[dev-dependencies]
zksync_test_account.workspace = true
zksync_node_test_utils.workspace = true

assert_matches.workspace = true
jsonrpsee.workspace = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,10 @@
use assert_matches::assert_matches;
use zksync_dal::ConnectionPool;
use zksync_node_genesis::{insert_genesis_batch, GenesisParams};
use zksync_node_test_utils::{create_l2_block, create_l2_transaction, prepare_recovery_snapshot};

use super::*;
use crate::{
api_server::{execution_sandbox::apply::apply_vm_in_sandbox, tx_sender::ApiContracts},
utils::testonly::{create_l2_block, create_l2_transaction, prepare_recovery_snapshot},
};
use crate::api_server::{execution_sandbox::apply::apply_vm_in_sandbox, tx_sender::ApiContracts};

#[tokio::test]
async fn creating_block_args() {
Expand Down
2 changes: 1 addition & 1 deletion core/lib/zksync_core/src/api_server/tx_sender/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use zksync_contracts::BaseSystemContracts;
use zksync_dal::{
transactions_dal::L2TxSubmissionResult, Connection, ConnectionPool, Core, CoreDal,
};
use zksync_node_fee_model::BatchFeeModelInputProvider;
use zksync_state::PostgresStorageCaches;
use zksync_types::{
fee::{Fee, TransactionExecutionMetrics},
Expand All @@ -40,7 +41,6 @@ use crate::{
},
tx_sender::result::ApiCallResult,
},
fee_model::BatchFeeModelInputProvider,
state_keeper::seal_criteria::{ConditionalSealer, NoopSealer, SealData},
utils::pending_protocol_version,
};
Expand Down
10 changes: 4 additions & 6 deletions core/lib/zksync_core/src/api_server/tx_sender/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
use assert_matches::assert_matches;
use multivm::interface::ExecutionResult;
use zksync_config::configs::wallets::Wallets;
use zksync_node_fee_model::MockBatchFeeParamsProvider;
use zksync_node_genesis::{insert_genesis_batch, GenesisParams};
use zksync_node_test_utils::{create_l2_block, create_l2_transaction, prepare_recovery_snapshot};
use zksync_types::{get_nonce_key, L1BatchNumber, L2BlockNumber, StorageLog};
use zksync_utils::u256_to_h256;

use super::*;
use crate::{
api_server::execution_sandbox::{testonly::MockTransactionExecutor, VmConcurrencyBarrier},
utils::testonly::{
create_l2_block, create_l2_transaction, prepare_recovery_snapshot,
MockBatchFeeParamsProvider,
},
use crate::api_server::execution_sandbox::{
testonly::MockTransactionExecutor, VmConcurrencyBarrier,
};

pub(crate) async fn create_test_tx_sender(
Expand Down
15 changes: 6 additions & 9 deletions core/lib/zksync_core/src/api_server/web3/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ use zksync_config::{
use zksync_dal::{transactions_dal::L2TxSubmissionResult, Connection, ConnectionPool, CoreDal};
use zksync_health_check::CheckHealth;
use zksync_node_genesis::{insert_genesis_batch, mock_genesis_config, GenesisParams};
use zksync_node_test_utils::{
create_l1_batch, create_l1_batch_metadata, create_l2_block, create_l2_transaction,
l1_batch_metadata_to_commitment_artifacts, prepare_recovery_snapshot,
};
use zksync_types::{
api,
block::L2BlockHeader,
Expand All @@ -49,15 +53,8 @@ use zksync_web3_decl::{
};

use super::{metrics::ApiTransportLabel, *};
use crate::{
api_server::{
execution_sandbox::testonly::MockTransactionExecutor,
tx_sender::tests::create_test_tx_sender,
},
utils::testonly::{
create_l1_batch, create_l1_batch_metadata, create_l2_block, create_l2_transaction,
l1_batch_metadata_to_commitment_artifacts, prepare_recovery_snapshot,
},
use crate::api_server::{
execution_sandbox::testonly::MockTransactionExecutor, tx_sender::tests::create_test_tx_sender,
};

mod debug;
Expand Down
2 changes: 1 addition & 1 deletion core/lib/zksync_core/src/consensus/storage/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use zksync_concurrency::{ctx, error::Wrap as _, time};
use zksync_consensus_roles::validator;
use zksync_dal::ConnectionPool;
use zksync_node_genesis::{insert_genesis_batch, GenesisParams};
use zksync_node_test_utils::{recover, snapshot, Snapshot};

use super::Store;
use crate::utils::testonly::{recover, snapshot, Snapshot};

impl Store {
/// Waits for the `number` L2 block to have a certificate.
Expand Down
2 changes: 1 addition & 1 deletion core/lib/zksync_core/src/consensus/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use zksync_consensus_roles::validator;
use zksync_contracts::BaseSystemContractsHashes;
use zksync_dal::{CoreDal, DalError};
use zksync_node_genesis::{mock_genesis_config, GenesisParams};
use zksync_node_test_utils::{create_l1_batch_metadata, create_l2_transaction};
use zksync_types::{
api, snapshots::SnapshotRecoveryStatus, Address, L1BatchNumber, L2BlockNumber, L2ChainId,
ProtocolVersionId, H256,
Expand All @@ -33,7 +34,6 @@ use crate::{
sync_action::{ActionQueue, ActionQueueSender, SyncAction},
ExternalIO, MainNodeClient, SyncState,
},
utils::testonly::{create_l1_batch_metadata, create_l2_transaction},
};

#[derive(Debug, Default)]
Expand Down
Loading
Loading