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: Separate Prover and Server DAL #1334

Merged
merged 52 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 51 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
cae97b4
initial commit
Artemka374 Mar 2, 2024
ab71bb9
move processor in one crate with connection
Artemka374 Mar 4, 2024
35122db
some refactoring
Artemka374 Mar 4, 2024
ff4e9c7
few more updates
Artemka374 Mar 8, 2024
76de3c5
Merge branch 'main' into afo/dal-refactoring
Artemka374 Mar 8, 2024
b8fa7e9
move some files around
Artemka374 Mar 8, 2024
2996367
structurize separated files
Artemka374 Mar 8, 2024
e291ebc
rename traits, types, fix some imports
Artemka374 Mar 8, 2024
1bb55c5
make db_connection build
Artemka374 Mar 11, 2024
2060921
make prover_dal compile
Artemka374 Mar 11, 2024
ccd0bc9
fmt/build sqlx
Artemka374 Mar 11, 2024
24ebf2b
make dal build
Artemka374 Mar 11, 2024
66b51e2
first wave of renaming/type assigning
Artemka374 Mar 11, 2024
b82ee58
Merge branch 'main' into afo/dal-refactoring
Artemka374 Mar 11, 2024
7c432a1
second wave of type assigning, fix test in db_connection
Artemka374 Mar 12, 2024
59edfcd
Merge remote-tracking branch 'origin/afo/dal-refactoring' into afo/da…
Artemka374 Mar 12, 2024
2cfac71
use appropriate processors
Artemka374 Mar 12, 2024
cda5ba2
some more type assigning
Artemka374 Mar 12, 2024
2579f47
make core build
Artemka374 Mar 12, 2024
ec6e38b
Merge branch 'main' into afo/dal-refactoring
Artemka374 Mar 13, 2024
9d8b17d
fix dal test
Artemka374 Mar 13, 2024
0742352
fix prover tests
Artemka374 Mar 13, 2024
481e35d
fix build in prover parts, uncomment global config
Artemka374 Mar 13, 2024
8fb140e
fix metrics
Artemka374 Mar 13, 2024
12cf5dd
fmt
Artemka374 Mar 13, 2024
5b43db2
Merge branch 'main' into afo/dal-refactoring
Artemka374 Mar 13, 2024
74c4687
fix build prover
Artemka374 Mar 13, 2024
4416abb
Merge remote-tracking branch 'origin/afo/dal-refactoring' into afo/da…
Artemka374 Mar 13, 2024
3372626
Merge branch 'main' into afo/dal-refactoring
Artemka374 Mar 14, 2024
c33d2ac
post-merge fixes
Artemka374 Mar 14, 2024
d37c6ca
use direct async trait dependency
Artemka374 Mar 14, 2024
dbc405e
fix some lints, generalize time utils
Artemka374 Mar 14, 2024
4b4bd57
Merge branch 'main' into afo/dal-refactoring
Artemka374 Mar 14, 2024
560f9bf
remove todos
Artemka374 Mar 14, 2024
a5662f8
Merge branch 'main' into afo/dal-refactoring
EmilLuta Mar 15, 2024
568c4cb
post merge fixes
Artemka374 Mar 15, 2024
a99b497
Merge branch 'main' into afo/dal-refactoring
Artemka374 Mar 18, 2024
f97e3b4
make StorageProcessor generic
Artemka374 Mar 18, 2024
c4b2f75
make server part build
Artemka374 Mar 18, 2024
44067f5
make prover part build
Artemka374 Mar 18, 2024
66416c1
fix build
Artemka374 Mar 18, 2024
458bd02
make Dals traits sealed, restrict StorageMarker by marker trait
Artemka374 Mar 19, 2024
c38fb02
Merge branch 'main' into afo/dal-refactoring
Artemka374 Mar 19, 2024
a7b13b0
merge fixes
Artemka374 Mar 19, 2024
ef67539
add types to dic
Artemka374 Mar 19, 2024
21c58e8
move some types to basic_types
Artemka374 Mar 19, 2024
2457639
Merge branch 'main' into afo/dal-refactoring
Artemka374 Mar 19, 2024
4467c0a
post merge fixes
Artemka374 Mar 19, 2024
a3d8adf
cleanup some dependencies, fix prover build
Artemka374 Mar 20, 2024
40dc991
fix linkcheck, downgrade chrono back
Artemka374 Mar 20, 2024
6d609b0
fmt
Artemka374 Mar 20, 2024
f8f8010
rename protocol to protocol_upgrade
Artemka374 Mar 20, 2024
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
75 changes: 65 additions & 10 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ members = [
# Node services
"core/node/node_framework",
# Libraries
"core/lib/db_connection",
"core/lib/zksync_core",
"core/lib/basic_types",
"core/lib/config",
Expand Down
2 changes: 2 additions & 0 deletions checks-config/era.dic
Original file line number Diff line number Diff line change
Expand Up @@ -918,3 +918,5 @@ stateful
WIP
oneshot
p2p
StorageProcessor
StorageMarker
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 @@ -8,7 +8,7 @@ use zksync_config::{
use zksync_core::block_reverter::{
BlockReverter, BlockReverterEthConfig, BlockReverterFlags, L1ExecutedBatchesRevert, NodeRole,
};
use zksync_dal::ConnectionPool;
use zksync_dal::{ConnectionPool, Server};
use zksync_env_config::FromEnv;
use zksync_types::{L1BatchNumber, U256};

Expand Down Expand Up @@ -96,7 +96,7 @@ async fn main() -> anyhow::Result<()> {
let postgres_config = PostgresConfig::from_env().context("PostgresConfig::from_env()")?;
let config = BlockReverterEthConfig::new(eth_sender, contracts, eth_client.web3_url.clone());

let connection_pool = ConnectionPool::builder(
let connection_pool = ConnectionPool::<Server>::builder(
postgres_config.master_url()?,
postgres_config.max_connections()?,
)
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 @@ -8,7 +8,7 @@ use zksync_config::{
configs::{ObservabilityConfig, PrometheusConfig},
ApiConfig, ContractVerifierConfig, PostgresConfig,
};
use zksync_dal::ConnectionPool;
use zksync_dal::{ConnectionPool, Server, ServerDals};
Artemka374 marked this conversation as resolved.
Show resolved Hide resolved
use zksync_env_config::FromEnv;
use zksync_queued_job_processor::JobProcessor;
use zksync_utils::wait_for_tasks::wait_for_tasks;
Expand All @@ -20,7 +20,7 @@ pub mod verifier;
pub mod zksolc_utils;
pub mod zkvyper_utils;

async fn update_compiler_versions(connection_pool: &ConnectionPool) {
async fn update_compiler_versions(connection_pool: &ConnectionPool<Server>) {
let mut storage = connection_pool.access_storage().await.unwrap();
let mut transaction = storage.start_transaction().await.unwrap();

Expand Down Expand Up @@ -134,7 +134,7 @@ async fn main() -> anyhow::Result<()> {
..ApiConfig::from_env().context("ApiConfig")?.prometheus
};
let postgres_config = PostgresConfig::from_env().context("PostgresConfig")?;
let pool = ConnectionPool::singleton(
let pool = ConnectionPool::<Server>::singleton(
postgres_config
.master_url()
.context("Master DB URL is absent")?,
Expand Down
10 changes: 5 additions & 5 deletions core/bin/contract-verifier/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use lazy_static::lazy_static;
use regex::Regex;
use tokio::time;
use zksync_config::ContractVerifierConfig;
use zksync_dal::{ConnectionPool, StorageProcessor};
use zksync_dal::{ConnectionPool, Server, ServerDals, StorageProcessor};
use zksync_env_config::FromEnv;
use zksync_queued_job_processor::{async_trait, JobProcessor};
use zksync_types::{
Expand Down Expand Up @@ -42,19 +42,19 @@ enum ConstructorArgs {
#[derive(Debug)]
pub struct ContractVerifier {
config: ContractVerifierConfig,
connection_pool: ConnectionPool,
connection_pool: ConnectionPool<Server>,
}

impl ContractVerifier {
pub fn new(config: ContractVerifierConfig, connection_pool: ConnectionPool) -> Self {
pub fn new(config: ContractVerifierConfig, connection_pool: ConnectionPool<Server>) -> Self {
Self {
config,
connection_pool,
}
}

async fn verify(
storage: &mut StorageProcessor<'_>,
storage: &mut StorageProcessor<'_, Server>,
mut request: VerificationRequest,
config: ContractVerifierConfig,
) -> Result<VerificationInfo, ContractVerifierError> {
Expand Down Expand Up @@ -429,7 +429,7 @@ impl ContractVerifier {
}

async fn process_result(
storage: &mut StorageProcessor<'_>,
storage: &mut StorageProcessor<'_, Server>,
request_id: usize,
verification_result: Result<VerificationInfo, ContractVerifierError>,
) {
Expand Down
3 changes: 2 additions & 1 deletion core/bin/external_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ publish = false # We don't want to publish our binaries.
[dependencies]
zksync_core = { path = "../../lib/zksync_core" }
zksync_dal = { path = "../../lib/dal" }
zksync_db_connection = { path = "../../lib/db_connection" }
zksync_config = { path = "../../lib/config" }
zksync_storage = { path = "../../lib/storage" }
zksync_utils = { path = "../../lib/utils" }
Expand All @@ -21,7 +22,7 @@ zksync_basic_types = { path = "../../lib/basic_types" }
zksync_contracts = { path = "../../lib/contracts" }
zksync_l1_contract_interface = { path = "../../lib/l1_contract_interface" }
zksync_snapshots_applier = { path = "../../lib/snapshots_applier" }
zksync_object_store = { path="../../lib/object_store" }
zksync_object_store = { path = "../../lib/object_store" }
prometheus_exporter = { path = "../../lib/prometheus_exporter" }
zksync_health_check = { path = "../../lib/health_check" }
zksync_web3_decl = { path = "../../lib/web3_decl" }
Expand Down
4 changes: 2 additions & 2 deletions core/bin/external_node/src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use anyhow::Context as _;
use zksync_basic_types::{L1BatchNumber, L2ChainId};
use zksync_core::sync_layer::genesis::perform_genesis_if_needed;
use zksync_dal::ConnectionPool;
use zksync_dal::{ConnectionPool, Server, ServerDals};
use zksync_health_check::AppHealthCheck;
use zksync_object_store::ObjectStoreFactory;
use zksync_snapshots_applier::SnapshotsApplierConfig;
Expand All @@ -20,7 +20,7 @@ enum InitDecision {
}

pub(crate) async fn ensure_storage_initialized(
pool: &ConnectionPool,
pool: &ConnectionPool<Server>,
main_node_client: &HttpClient,
app_health: &AppHealthCheck,
l2_chain_id: L2ChainId,
Expand Down
Loading
Loading