Skip to content

Commit

Permalink
feat: tee_verifier_input_producer
Browse files Browse the repository at this point in the history
Extract all data needed to re-execute and verify an L1Batch without accessing
the DB and/or the object store.

For testing purposes, the L1 batch is re-executed immediately for now.
Eventually, this component will only extract the inputs and send them to another
machine over a "to be defined" channel, e.g., save them to an object store.

Co-authored-by: Thomas Knauth <[email protected]>
Co-authored-by: Patrick Bęza <[email protected]>
Signed-off-by: Harald Hoyer <[email protected]>
  • Loading branch information
3 people committed May 13, 2024
1 parent e166512 commit 0cf5623
Show file tree
Hide file tree
Showing 26 changed files with 1,601 additions and 3 deletions.
26 changes: 26 additions & 0 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 @@ -46,6 +46,7 @@ members = [
"core/lib/queued_job_processor",
"core/lib/state",
"core/lib/storage",
"core/lib/tee_verifier",
"core/lib/types",
"core/lib/protobuf_config",
"core/lib/utils",
Expand Down Expand Up @@ -220,6 +221,7 @@ zksync_snapshots_applier = { path = "core/lib/snapshots_applier" }
zksync_state = { path = "core/lib/state" }
zksync_storage = { path = "core/lib/storage" }
zksync_system_constants = { path = "core/lib/constants" }
zksync_tee_verifier = { path = "core/lib/tee_verifier" }
zksync_test_account = { path = "core/tests/test_account" }
zksync_types = { path = "core/lib/types" }
zksync_utils = { path = "core/lib/utils" }
Expand Down
3 changes: 3 additions & 0 deletions checks-config/era.dic
Original file line number Diff line number Diff line change
Expand Up @@ -957,3 +957,6 @@ RECURSION_TIP_ARITY
empty_proof
hyperchain
storages
vec
zksync_merkle_tree
TreeMetadata
2 changes: 1 addition & 1 deletion core/bin/zksync_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ struct Cli {
/// Comma-separated list of components to launch.
#[arg(
long,
default_value = "api,tree,eth,state_keeper,housekeeper,commitment_generator"
default_value = "api,tree,eth,state_keeper,housekeeper,tee_verifier_input_producer,commitment_generator"
)]
components: ComponentsToRun,
/// Path to the yaml config. If set, it will be used instead of env vars.
Expand Down

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,5 @@
DROP INDEX IF EXISTS idx_tee_verifier_input_producer_jobs_status_processing_attempts;

DROP TABLE IF EXISTS tee_verifier_input_producer_jobs;

DROP TYPE IF EXISTS tee_verifier_input_producer_job_status;
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
CREATE TYPE tee_verifier_input_producer_job_status AS ENUM ('Queued', 'ManuallySkipped', 'InProgress', 'Successful', 'Failed');

CREATE TABLE IF NOT EXISTS tee_verifier_input_producer_jobs
(
l1_batch_number BIGINT NOT NULL PRIMARY KEY,
attempts SMALLINT NOT NULL DEFAULT 0,
status tee_verifier_input_producer_job_status,
picked_by TEXT,
input_blob_url TEXT,
error TEXT,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL,
processing_started_at TIMESTAMP,
time_taken TIME
);

CREATE INDEX IF NOT EXISTS idx_tee_verifier_input_producer_jobs_status_processing_attempts
ON tee_verifier_input_producer_jobs (status, processing_started_at, attempts);
10 changes: 9 additions & 1 deletion core/lib/dal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ use crate::{
snapshot_recovery_dal::SnapshotRecoveryDal, snapshots_creator_dal::SnapshotsCreatorDal,
snapshots_dal::SnapshotsDal, storage_logs_dal::StorageLogsDal,
storage_logs_dedup_dal::StorageLogsDedupDal, storage_web3_dal::StorageWeb3Dal,
sync_dal::SyncDal, system_dal::SystemDal, tokens_dal::TokensDal,
sync_dal::SyncDal, system_dal::SystemDal,
tee_verifier_input_producer_dal::TeeVerifierInputProducerDal, tokens_dal::TokensDal,
tokens_web3_dal::TokensWeb3Dal, transactions_dal::TransactionsDal,
transactions_web3_dal::TransactionsWeb3Dal,
};
Expand Down Expand Up @@ -48,6 +49,7 @@ pub mod storage_logs_dedup_dal;
pub mod storage_web3_dal;
pub mod sync_dal;
pub mod system_dal;
pub mod tee_verifier_input_producer_dal;
pub mod tokens_dal;
pub mod tokens_web3_dal;
pub mod transactions_dal;
Expand All @@ -71,6 +73,8 @@ where

fn transactions_web3_dal(&mut self) -> TransactionsWeb3Dal<'_, 'a>;

fn tee_verifier_input_producer_dal(&mut self) -> TeeVerifierInputProducerDal<'_, 'a>;

fn blocks_dal(&mut self) -> BlocksDal<'_, 'a>;

fn blocks_web3_dal(&mut self) -> BlocksWeb3Dal<'_, 'a>;
Expand Down Expand Up @@ -133,6 +137,10 @@ impl<'a> CoreDal<'a> for Connection<'a, Core> {
TransactionsWeb3Dal { storage: self }
}

fn tee_verifier_input_producer_dal(&mut self) -> TeeVerifierInputProducerDal<'_, 'a> {
TeeVerifierInputProducerDal { storage: self }
}

fn blocks_dal(&mut self) -> BlocksDal<'_, 'a> {
BlocksDal { storage: self }
}
Expand Down
Loading

0 comments on commit 0cf5623

Please sign in to comment.