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: BWIP #2258

Merged
merged 69 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
4ce3d7b
initial commit
Artemka374 Jun 7, 2024
4f7f974
Merge branch 'refs/heads/main' into afo/bwip
Artemka374 Jun 17, 2024
69a2828
few more tries to compose data
Artemka374 Jun 18, 2024
205df46
more or less finalize needed data
Artemka374 Jun 18, 2024
2569671
add storage cache and migrations
Artemka374 Jun 20, 2024
a691ca4
Merge branch 'refs/heads/main' into afo/bwip
Artemka374 Jun 20, 2024
5da26bf
update some db stuff
Artemka374 Jun 20, 2024
da3fb98
fix some errors
Artemka374 Jun 21, 2024
0e68fa5
fix core build
Artemka374 Jun 24, 2024
2b1a7ae
fmt
Artemka374 Jun 24, 2024
714f8e3
update data handler and gateway
Artemka374 Jun 24, 2024
d54e5ae
add bwip to node
Artemka374 Jun 24, 2024
46cd1ff
fix some builds
Artemka374 Jun 24, 2024
f9fe7aa
get some data from updates manager
Artemka374 Jun 25, 2024
85dcf5b
use updates manager data everywhere possible
Artemka374 Jun 25, 2024
ecac597
fix build
Artemka374 Jun 26, 2024
639a9af
merge main
Artemka374 Jun 26, 2024
6ea08dc
fix build
Artemka374 Jun 26, 2024
ba40d4a
fix prover build
Artemka374 Jun 26, 2024
11fdfb1
Merge branch 'refs/heads/main' into afo/bwip
Artemka374 Jun 26, 2024
f270ccf
checkout contracts
Artemka374 Jun 26, 2024
f5b593a
fix some bugs
Artemka374 Jun 26, 2024
b0fa3b4
some cleanups
Artemka374 Jun 27, 2024
fcc4a34
allow dead code
Artemka374 Jun 27, 2024
5e1816f
Merge branch 'main' into afo/bwip
Artemka374 Jun 27, 2024
314557a
add docs
Artemka374 Jun 27, 2024
3d1e2ba
Merge remote-tracking branch 'origin/afo/bwip' into afo/bwip
Artemka374 Jun 27, 2024
dc82471
remove redundant query
Artemka374 Jun 27, 2024
da2729a
add tracing
Artemka374 Jun 27, 2024
22fb747
Merge branch 'main' into afo/bwip
Artemka374 Jun 27, 2024
5ba82ae
fix serializing problem(should be fixed better in the future)
Artemka374 Jun 27, 2024
c67c1c1
Merge remote-tracking branch 'origin/afo/bwip' into afo/bwip
Artemka374 Jun 28, 2024
84607e5
fmt
Artemka374 Jun 28, 2024
4c0e270
rework serialization
Artemka374 Jun 28, 2024
f3465e6
fix bootloader code problem
Artemka374 Jun 28, 2024
c6e3e68
fix cached state
Artemka374 Jul 1, 2024
838b589
fix previous batch metadataa
Artemka374 Jul 2, 2024
7e6f236
fix type annotation
Artemka374 Jul 2, 2024
e4e91ae
fmt
Artemka374 Jul 2, 2024
db57909
fix type for BWG
Artemka374 Jul 2, 2024
aad26ba
address some comments
Artemka374 Jul 2, 2024
b8ec09c
merge main
Artemka374 Jul 3, 2024
2c47a86
update contracts
Artemka374 Jul 3, 2024
8cc7ca6
update ident
Artemka374 Jul 3, 2024
0a7cddd
update ident
Artemka374 Jul 3, 2024
8c1f1e7
update ident
Artemka374 Jul 3, 2024
d61acf8
address some comments
Artemka374 Jul 3, 2024
e94ba4b
fix build
Artemka374 Jul 3, 2024
4079e62
add migration for witness inputs
Artemka374 Jul 3, 2024
80fa675
merge main
Artemka374 Jul 3, 2024
bd62133
address comments
Artemka374 Jul 3, 2024
3f04efe
address comments
Artemka374 Jul 3, 2024
bb9865b
undo formatting
Artemka374 Jul 3, 2024
8071326
address comments
Artemka374 Jul 3, 2024
ecd2d10
address comments
Artemka374 Jul 3, 2024
9bb645b
merge main
Artemka374 Jul 3, 2024
aec5bd9
updated query
Artemka374 Jul 3, 2024
8b98295
fix build
Artemka374 Jul 3, 2024
9c415ba
fix lint
Artemka374 Jul 4, 2024
c0cc2d2
fix lint, add vm_runner to CI
Artemka374 Jul 4, 2024
d813bdc
remove bwip from loadtest
Artemka374 Jul 4, 2024
dc860cf
address comments
Artemka374 Jul 4, 2024
cdba732
fix build
Artemka374 Jul 4, 2024
74bb85c
Merge branch 'main' into afo/bwip
Artemka374 Jul 4, 2024
3e8c4c8
fix build
Artemka374 Jul 4, 2024
2e5d56c
Merge remote-tracking branch 'origin/afo/bwip' into afo/bwip
Artemka374 Jul 4, 2024
ec68265
fix build
Artemka374 Jul 4, 2024
419a723
Update core/node/vm_runner/src/impls/bwip.rs
Artemka374 Jul 4, 2024
c39e7a1
Update core/node/vm_runner/src/impls/bwip.rs
Artemka374 Jul 4, 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
4 changes: 2 additions & 2 deletions .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
base_token: ["Eth", "Custom"]
deployment_mode: ["Rollup", "Validium"]
env:
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,commitment_generator,vm_runner_protective_reads,da_dispatcher,base_token_ratio_persister${{ matrix.consensus && ',consensus' || '' }}"
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,commitment_generator,vm_runner_protective_reads,vm_runner_bwip,da_dispatcher,base_token_ratio_persister${{ matrix.consensus && ',consensus' || '' }}"

runs-on: [matterlabs-ci-runner]
steps:
Expand Down Expand Up @@ -309,7 +309,7 @@ jobs:
runs-on: [matterlabs-ci-runner]

env:
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,commitment_generator,vm_runner_protective_reads,da_dispatcher,base_token_ratio_persister${{ matrix.consensus && ',consensus' || '' }}"
SERVER_COMPONENTS: "api,tree,eth,state_keeper,housekeeper,commitment_generator,vm_runner_protective_reads,vm_runner_bwip,da_dispatcher,base_token_ratio_persister${{ matrix.consensus && ',consensus' || '' }}"
EXT_NODE_FLAGS: "${{ matrix.consensus && '-- --enable-consensus' || '' }}"

steps:
Expand Down
3 changes: 3 additions & 0 deletions Cargo.lock

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

9 changes: 5 additions & 4 deletions core/bin/zksync_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ use zksync_config::{
},
fri_prover_group::FriProverGroupConfig,
house_keeper::HouseKeeperConfig,
ContractsConfig, DatabaseSecrets, FriProofCompressorConfig, FriProverConfig,
FriProverGatewayConfig, FriWitnessGeneratorConfig, FriWitnessVectorGeneratorConfig,
L1Secrets, ObservabilityConfig, PrometheusConfig, ProofDataHandlerConfig,
ProtectiveReadsWriterConfig, Secrets,
BasicWitnessInputProducerConfig, ContractsConfig, DatabaseSecrets,
FriProofCompressorConfig, FriProverConfig, FriProverGatewayConfig,
FriWitnessGeneratorConfig, FriWitnessVectorGeneratorConfig, L1Secrets, ObservabilityConfig,
PrometheusConfig, ProofDataHandlerConfig, ProtectiveReadsWriterConfig, Secrets,
},
ApiConfig, BaseTokenAdjusterConfig, ContractVerifierConfig, DADispatcherConfig, DBConfig,
EthConfig, EthWatchConfig, GasAdjusterConfig, GenesisConfig, ObjectStoreConfig, PostgresConfig,
Expand Down Expand Up @@ -271,6 +271,7 @@ fn load_env_config() -> anyhow::Result<TempConfigStore> {
snapshot_creator: SnapshotsCreatorConfig::from_env().ok(),
da_dispatcher_config: DADispatcherConfig::from_env().ok(),
protective_reads_writer_config: ProtectiveReadsWriterConfig::from_env().ok(),
basic_witness_input_producer_config: BasicWitnessInputProducerConfig::from_env().ok(),
core_object_store: ObjectStoreConfig::from_env().ok(),
base_token_adjuster_config: BaseTokenAdjusterConfig::from_env().ok(),
commitment_generator: None,
Expand Down
18 changes: 17 additions & 1 deletion core/bin/zksync_server/src/node_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ use zksync_node_framework::{
output_handler::OutputHandlerLayer, RocksdbStorageOptions, StateKeeperLayer,
},
tee_verifier_input_producer::TeeVerifierInputProducerLayer,
vm_runner::protective_reads::ProtectiveReadsWriterLayer,
vm_runner::{
bwip::BasicWitnessInputProducerLayer, protective_reads::ProtectiveReadsWriterLayer,
},
web3_api::{
caches::MempoolCacheLayer,
server::{Web3ServerLayer, Web3ServerOptionalConfig},
Expand Down Expand Up @@ -503,6 +505,17 @@ impl MainNodeBuilder {
Ok(self)
}

fn add_vm_runner_bwip_layer(mut self) -> anyhow::Result<Self> {
let basic_witness_input_producer_config =
try_load_config!(self.configs.basic_witness_input_producer_config);
self.node.add_layer(BasicWitnessInputProducerLayer::new(
basic_witness_input_producer_config,
self.genesis_config.l2_chain_id,
));

Ok(self)
}

fn add_base_token_ratio_persister_layer(mut self) -> anyhow::Result<Self> {
let config = try_load_config!(self.configs.base_token_adjuster);
self.node
Expand Down Expand Up @@ -604,6 +617,9 @@ impl MainNodeBuilder {
Component::BaseTokenRatioPersister => {
self = self.add_base_token_ratio_persister_layer()?;
}
Component::VmRunnerBwip => {
self = self.add_vm_runner_bwip_layer()?;
}
}
}
Ok(self.node.build()?)
Expand Down
1 change: 1 addition & 0 deletions core/lib/basic_types/src/prover_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ pub struct ProverJobFriInfo {
pub struct BasicWitnessGeneratorJobInfo {
pub l1_batch_number: L1BatchNumber,
pub merkle_tree_paths_blob_url: Option<String>,
pub witness_inputs_blob_url: Option<String>,
pub attempts: u32,
pub status: WitnessJobStatus,
pub error: Option<String>,
Expand Down
3 changes: 2 additions & 1 deletion core/lib/config/src/configs/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
house_keeper::HouseKeeperConfig,
pruning::PruningConfig,
snapshot_recovery::SnapshotRecoveryConfig,
vm_runner::ProtectiveReadsWriterConfig,
vm_runner::{BasicWitnessInputProducerConfig, ProtectiveReadsWriterConfig},
CommitmentGeneratorConfig, FriProofCompressorConfig, FriProverConfig,
FriProverGatewayConfig, FriWitnessGeneratorConfig, FriWitnessVectorGeneratorConfig,
ObservabilityConfig, PrometheusConfig, ProofDataHandlerConfig,
Expand Down Expand Up @@ -40,6 +40,7 @@ pub struct GeneralConfig {
pub observability: Option<ObservabilityConfig>,
pub da_dispatcher_config: Option<DADispatcherConfig>,
pub protective_reads_writer_config: Option<ProtectiveReadsWriterConfig>,
pub basic_witness_input_producer_config: Option<BasicWitnessInputProducerConfig>,
pub commitment_generator: Option<CommitmentGeneratorConfig>,
pub snapshot_recovery: Option<SnapshotRecoveryConfig>,
pub pruning: Option<PruningConfig>,
Expand Down
2 changes: 1 addition & 1 deletion core/lib/config/src/configs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub use self::{
snapshot_recovery::SnapshotRecoveryConfig,
snapshots_creator::SnapshotsCreatorConfig,
utils::PrometheusConfig,
vm_runner::ProtectiveReadsWriterConfig,
vm_runner::{BasicWitnessInputProducerConfig, ProtectiveReadsWriterConfig},
};

pub mod api;
Expand Down
17 changes: 17 additions & 0 deletions core/lib/config/src/configs/vm_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,20 @@ impl ProtectiveReadsWriterConfig {
"./db/protective_reads_writer".to_owned()
Artemka374 marked this conversation as resolved.
Show resolved Hide resolved
}
}

#[derive(Debug, Deserialize, Clone, PartialEq, Default)]
pub struct BasicWitnessInputProducerConfig {
/// Path to the RocksDB data directory that serves state cache.
#[serde(default = "BasicWitnessInputProducerConfig::default_db_path")]
pub db_path: String,
/// How many max batches should be processed at the same time.
pub window_size: u32,
/// All batches before this one (inclusive) are always considered to be processed.
pub first_processed_batch: L1BatchNumber,
}

impl BasicWitnessInputProducerConfig {
fn default_db_path() -> String {
"./db/basic_witness_input_producer".to_owned()
}
}

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

This file was deleted.

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

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

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

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

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

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE proof_generation_details DROP COLUMN IF EXISTS vm_run_data_blob_url;
DROP TABLE IF EXISTS vm_runner_bwip;
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ALTER TABLE proof_generation_details
ADD COLUMN IF NOT EXISTS vm_run_data_blob_url TEXT DEFAULT NULL;

CREATE TABLE IF NOT EXISTS vm_runner_bwip
(
l1_batch_number BIGINT NOT NULL PRIMARY KEY,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL,
time_taken TIME
);
Loading
Loading