Skip to content

Commit

Permalink
feat: Remove zkevm_test_harness public reexport from zksync_types (#929)
Browse files Browse the repository at this point in the history
## What ❔

- Removes a public reexport of whole `zkevm_test_harness` from
`zksync_types`.
- Removes some code that turned out to be dead from `object_store`
crate.

## Why ❔

- Reduces the surface of public APIs exposed by `zksync_types` crate.
- Prerequisite for further separation of crypto stuff from
`zksync_types`.
- Dead code bad.


## 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`.
- [ ] Spellcheck has been run via `zk spellcheck`.
  • Loading branch information
popzxc authored Jan 24, 2024
1 parent 16fdcff commit dd1a35e
Show file tree
Hide file tree
Showing 29 changed files with 62 additions and 166 deletions.
4 changes: 3 additions & 1 deletion 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 core/bin/system-constants-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ zksync_types = { path = "../../lib/types" }
zksync_utils = { path = "../../lib/utils" }
zksync_contracts = { path = "../../lib/contracts" }
multivm = { path = "../../lib/multivm" }
zkevm_test_harness_1_3_3 = { git = "https://github.com/matter-labs/era-zkevm_test_harness.git", branch = "v1.3.3", package = "zkevm_test_harness" }

codegen = "0.2.0"

Expand Down
13 changes: 6 additions & 7 deletions core/bin/system-constants-generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ use multivm::{
vm_latest::constants::MAX_PUBDATA_PER_BLOCK,
};
use serde::{Deserialize, Serialize};
use zksync_types::{
zkevm_test_harness::zk_evm::zkevm_opcode_defs::{
circuit_prices::{
ECRECOVER_CIRCUIT_COST_IN_ERGS, KECCAK256_CIRCUIT_COST_IN_ERGS,
SHA256_CIRCUIT_COST_IN_ERGS,
},
system_params::MAX_TX_ERGS_LIMIT,
use zkevm_test_harness_1_3_3::zk_evm::zkevm_opcode_defs::{
circuit_prices::{
ECRECOVER_CIRCUIT_COST_IN_ERGS, KECCAK256_CIRCUIT_COST_IN_ERGS, SHA256_CIRCUIT_COST_IN_ERGS,
},
system_params::MAX_TX_ERGS_LIMIT,
};
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
3 changes: 1 addition & 2 deletions core/lib/dal/src/blocks_web3_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use zksync_types::{
l2_to_l1_log::L2ToL1Log,
vm_trace::Call,
web3::types::{BlockHeader, U64},
zkevm_test_harness::zk_evm::zkevm_opcode_defs::system_params,
Bytes, L1BatchNumber, L2ChainId, MiniblockNumber, H160, H2048, H256, U256,
};
use zksync_utils::bigdecimal_to_u256;
Expand All @@ -24,7 +23,7 @@ use crate::{
StorageProcessor,
};

const BLOCK_GAS_LIMIT: u32 = system_params::VM_INITIAL_FRAME_ERGS;
const BLOCK_GAS_LIMIT: u32 = u32::MAX;

#[derive(Debug)]
pub struct BlocksWeb3Dal<'a, 'c> {
Expand Down
1 change: 1 addition & 0 deletions core/lib/multivm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ zk_evm_1_4_0 = { package = "zk_evm", git = "https://github.com/matter-labs/era-z
zk_evm_1_3_3 = { package = "zk_evm", git = "https://github.com/matter-labs/era-zk_evm.git", tag= "v1.3.3-rc2" }
zk_evm_1_3_1 = { package = "zk_evm", git = "https://github.com/matter-labs/era-zk_evm.git", tag= "v1.3.1-rc2" }

zkevm_test_harness_1_3_3 = { git = "https://github.com/matter-labs/era-zkevm_test_harness.git", branch = "v1.3.3", package = "zkevm_test_harness" }
zkevm_test_harness_1_4_0 = { git = "https://github.com/matter-labs/era-zkevm_test_harness.git", branch = "v1.4.0", package = "zkevm_test_harness" }
zkevm_test_harness_1_4_1 = { git = "https://github.com/matter-labs/era-zkevm_test_harness.git", branch = "v1.4.1", package = "zkevm_test_harness" }

Expand Down
2 changes: 1 addition & 1 deletion core/lib/multivm/src/versions/vm_1_3_2/pubdata_utils.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::collections::HashMap;

use zk_evm_1_3_3::aux_structures::Timestamp;
use zkevm_test_harness_1_3_3::witness::sort_storage_access::sort_storage_access_queries;
use zksync_state::WriteStorage;
use zksync_types::{
event::{extract_long_l2_to_l1_messages, extract_published_bytecodes},
zkevm_test_harness::witness::sort_storage_access::sort_storage_access_queries,
StorageKey, PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS,
};
use zksync_utils::bytecode::bytecode_len_in_bytes;
Expand Down
6 changes: 3 additions & 3 deletions core/lib/multivm/src/versions/vm_1_3_2/vm_with_bootloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ use zk_evm_1_3_3::{
STARTING_TIMESTAMP,
},
};
use zkevm_test_harness_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER;
use zksync_contracts::BaseSystemContracts;
use zksync_state::WriteStorage;
use zksync_system_constants::MAX_L2_TX_GAS_LIMIT;
use zksync_types::{
fee_model::L1PeggedBatchFeeModelInput, l1::is_l1_tx_type,
zkevm_test_harness::INITIAL_MONOTONIC_CYCLE_COUNTER, Address, Transaction, BOOTLOADER_ADDRESS,
L1_GAS_PER_PUBDATA_BYTE, MAX_NEW_FACTORY_DEPS, U256,
fee_model::L1PeggedBatchFeeModelInput, l1::is_l1_tx_type, Address, Transaction,
BOOTLOADER_ADDRESS, L1_GAS_PER_PUBDATA_BYTE, MAX_NEW_FACTORY_DEPS, U256,
};
use zksync_utils::{
address_to_u256,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use zk_evm_1_4_0::{
aux_structures::Timestamp,
tracing::{BeforeExecutionData, VmLocalStateData},
};
use zkevm_test_harness_1_3_3::witness::sort_storage_access::sort_storage_access_queries;
use zksync_state::{StoragePtr, WriteStorage};
use zksync_types::{
event::{
extract_bytecode_publication_requests_from_l1_messenger,
extract_l2tol1logs_from_l1_messenger, extract_long_l2_to_l1_messages, L1MessengerL2ToL1Log,
},
writes::StateDiffRecord,
zkevm_test_harness::witness::sort_storage_access::sort_storage_access_queries,
AccountTreeId, StorageKey, L1_MESSENGER_ADDRESS,
};
use zksync_utils::{h256_to_u256, u256_to_bytes_be, u256_to_h256};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ use zk_evm_1_4_0::{
STARTING_BASE_PAGE, STARTING_TIMESTAMP,
},
};
use zkevm_test_harness_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER;
use zksync_state::{StoragePtr, WriteStorage};
use zksync_system_constants::BOOTLOADER_ADDRESS;
use zksync_types::{
block::MiniblockHasher, zkevm_test_harness::INITIAL_MONOTONIC_CYCLE_COUNTER, Address,
MiniblockNumber,
};
use zksync_types::{block::MiniblockHasher, Address, MiniblockNumber};
use zksync_utils::h256_to_u256;

use crate::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use zk_evm_1_4_1::{
aux_structures::Timestamp,
tracing::{BeforeExecutionData, VmLocalStateData},
};
use zkevm_test_harness_1_3_3::witness::sort_storage_access::sort_storage_access_queries;
use zksync_state::{StoragePtr, WriteStorage};
use zksync_types::{
event::{
extract_bytecode_publication_requests_from_l1_messenger,
extract_l2tol1logs_from_l1_messenger, extract_long_l2_to_l1_messages, L1MessengerL2ToL1Log,
},
writes::StateDiffRecord,
zkevm_test_harness::witness::sort_storage_access::sort_storage_access_queries,
AccountTreeId, StorageKey, L1_MESSENGER_ADDRESS,
};
use zksync_utils::{h256_to_u256, u256_to_bytes_be, u256_to_h256};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ use zk_evm_1_4_1::{
STARTING_BASE_PAGE, STARTING_TIMESTAMP,
},
};
use zkevm_test_harness_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER;
use zksync_state::{StoragePtr, WriteStorage};
use zksync_system_constants::BOOTLOADER_ADDRESS;
use zksync_types::{
block::MiniblockHasher, zkevm_test_harness::INITIAL_MONOTONIC_CYCLE_COUNTER, Address,
MiniblockNumber,
};
use zksync_types::{block::MiniblockHasher, Address, MiniblockNumber};
use zksync_utils::h256_to_u256;

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion core/lib/multivm/src/versions/vm_m5/pubdata_utils.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::collections::HashMap;

use zk_evm_1_3_1::aux_structures::Timestamp;
use zkevm_test_harness_1_3_3::witness::sort_storage_access::sort_storage_access_queries;
use zksync_types::{
event::{extract_long_l2_to_l1_messages, extract_published_bytecodes},
zkevm_test_harness::witness::sort_storage_access::sort_storage_access_queries,
StorageKey, PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS,
};
use zksync_utils::bytecode::bytecode_len_in_bytes;
Expand Down
5 changes: 3 additions & 2 deletions core/lib/multivm/src/versions/vm_m5/vm_with_bootloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ use zk_evm_1_3_1::{
BOOTLOADER_CALLDATA_PAGE, STARTING_BASE_PAGE, STARTING_TIMESTAMP,
},
};
use zkevm_test_harness_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER;
use zksync_contracts::BaseSystemContracts;
use zksync_system_constants::MAX_L2_TX_GAS_LIMIT;
use zksync_types::{
fee_model::L1PeggedBatchFeeModelInput, zkevm_test_harness::INITIAL_MONOTONIC_CYCLE_COUNTER,
Address, Transaction, BOOTLOADER_ADDRESS, L1_GAS_PER_PUBDATA_BYTE, MAX_NEW_FACTORY_DEPS, U256,
fee_model::L1PeggedBatchFeeModelInput, Address, Transaction, BOOTLOADER_ADDRESS,
L1_GAS_PER_PUBDATA_BYTE, MAX_NEW_FACTORY_DEPS, U256,
};
use zksync_utils::{
address_to_u256, bytecode::hash_bytecode, bytes_to_be_words, h256_to_u256, misc::ceil_div,
Expand Down
2 changes: 1 addition & 1 deletion core/lib/multivm/src/versions/vm_m6/pubdata_utils.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::collections::HashMap;

use zk_evm_1_3_1::aux_structures::Timestamp;
use zkevm_test_harness_1_3_3::witness::sort_storage_access::sort_storage_access_queries;
use zksync_types::{
event::{extract_long_l2_to_l1_messages, extract_published_bytecodes},
zkevm_test_harness::witness::sort_storage_access::sort_storage_access_queries,
StorageKey, PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS,
};
use zksync_utils::bytecode::bytecode_len_in_bytes;
Expand Down
5 changes: 3 additions & 2 deletions core/lib/multivm/src/versions/vm_m6/vm_with_bootloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ use zk_evm_1_3_1::{
BOOTLOADER_CALLDATA_PAGE, STARTING_BASE_PAGE, STARTING_TIMESTAMP,
},
};
use zkevm_test_harness_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER;
use zksync_contracts::BaseSystemContracts;
use zksync_system_constants::MAX_L2_TX_GAS_LIMIT;
use zksync_types::{
fee_model::L1PeggedBatchFeeModelInput, zkevm_test_harness::INITIAL_MONOTONIC_CYCLE_COUNTER,
Address, Transaction, BOOTLOADER_ADDRESS, L1_GAS_PER_PUBDATA_BYTE, MAX_NEW_FACTORY_DEPS, U256,
fee_model::L1PeggedBatchFeeModelInput, Address, Transaction, BOOTLOADER_ADDRESS,
L1_GAS_PER_PUBDATA_BYTE, MAX_NEW_FACTORY_DEPS, U256,
};
use zksync_utils::{
address_to_u256,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ use zk_evm_1_3_3::{
STARTING_BASE_PAGE, STARTING_TIMESTAMP,
},
};
use zkevm_test_harness_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER;
use zksync_state::{StoragePtr, WriteStorage};
use zksync_system_constants::BOOTLOADER_ADDRESS;
use zksync_types::{
block::MiniblockHasher, zkevm_test_harness::INITIAL_MONOTONIC_CYCLE_COUNTER, Address,
MiniblockNumber,
};
use zksync_types::{block::MiniblockHasher, Address, MiniblockNumber};
use zksync_utils::h256_to_u256;

use crate::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use zk_evm_1_3_3::{
tracing::{BeforeExecutionData, VmLocalStateData},
vm_state::VmLocalState,
};
use zkevm_test_harness_1_3_3::witness::sort_storage_access::sort_storage_access_queries;
use zksync_state::{StoragePtr, WriteStorage};
use zksync_system_constants::{PUBLISH_BYTECODE_OVERHEAD, SYSTEM_CONTEXT_ADDRESS};
use zksync_types::{
event::{extract_long_l2_to_l1_messages, extract_published_bytecodes},
l2_to_l1_log::L2ToL1Log,
zkevm_test_harness::witness::sort_storage_access::sort_storage_access_queries,
L1BatchNumber, StorageKey, U256,
};
use zksync_utils::{bytecode::bytecode_len_in_bytes, ceil_div_u256, u256_to_h256};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ use zk_evm_1_3_3::{
STARTING_BASE_PAGE, STARTING_TIMESTAMP,
},
};
use zkevm_test_harness_1_3_3::INITIAL_MONOTONIC_CYCLE_COUNTER;
use zksync_state::{StoragePtr, WriteStorage};
use zksync_system_constants::BOOTLOADER_ADDRESS;
use zksync_types::{
block::MiniblockHasher, zkevm_test_harness::INITIAL_MONOTONIC_CYCLE_COUNTER, Address,
MiniblockNumber,
};
use zksync_types::{block::MiniblockHasher, Address, MiniblockNumber};
use zksync_utils::h256_to_u256;

use crate::{
Expand Down
94 changes: 0 additions & 94 deletions core/lib/object_store/src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ use zksync_types::{
SnapshotFactoryDependencies, SnapshotStorageLogsChunk, SnapshotStorageLogsStorageKey,
},
storage::witness_block_state::WitnessBlockState,
zkevm_test_harness::{
abstract_zksync_circuit::concrete_circuits::ZkSyncCircuit,
bellman::bn256::Bn256,
encodings::{recursion_request::RecursionRequest, QueueSimulator},
witness::{
full_block_artifact::{BlockBasicCircuits, BlockBasicCircuitsPublicInputs},
oracle::VmWitnessOracle,
},
LeafAggregationOutputDataWitness, NodeAggregationOutputDataWitness,
SchedulerCircuitInstanceWitness,
},
L1BatchNumber,
};

Expand Down Expand Up @@ -153,72 +142,6 @@ impl StoredObject for PrepareBasicCircuitsJob {
serialize_using_bincode!();
}

impl StoredObject for BlockBasicCircuits<Bn256> {
const BUCKET: Bucket = Bucket::LeafAggregationWitnessJobs;
type Key<'a> = L1BatchNumber;

fn encode_key(key: Self::Key<'_>) -> String {
format!("basic_circuits_{key}.bin")
}

serialize_using_bincode!();
}

impl StoredObject for BlockBasicCircuitsPublicInputs<Bn256> {
const BUCKET: Bucket = Bucket::LeafAggregationWitnessJobs;
type Key<'a> = L1BatchNumber;

fn encode_key(key: Self::Key<'_>) -> String {
format!("basic_circuits_inputs_{key}.bin")
}

serialize_using_bincode!();
}

impl StoredObject for SchedulerCircuitInstanceWitness<Bn256> {
const BUCKET: Bucket = Bucket::SchedulerWitnessJobs;
type Key<'a> = L1BatchNumber;

fn encode_key(key: Self::Key<'_>) -> String {
format!("scheduler_witness_{key}.bin")
}

serialize_using_bincode!();
}

impl StoredObject for NodeAggregationOutputDataWitness<Bn256> {
const BUCKET: Bucket = Bucket::SchedulerWitnessJobs;
type Key<'a> = L1BatchNumber;

fn encode_key(key: Self::Key<'_>) -> String {
format!("final_node_aggregations_{key}.bin")
}

serialize_using_bincode!();
}

impl StoredObject for Vec<LeafAggregationOutputDataWitness<Bn256>> {
const BUCKET: Bucket = Bucket::NodeAggregationWitnessJobs;
type Key<'a> = L1BatchNumber;

fn encode_key(key: Self::Key<'_>) -> String {
format!("aggregation_outputs_{key}.bin")
}

serialize_using_bincode!();
}

impl StoredObject for Vec<QueueSimulator<Bn256, RecursionRequest<Bn256>, 2, 2>> {
const BUCKET: Bucket = Bucket::NodeAggregationWitnessJobs;
type Key<'a> = L1BatchNumber;

fn encode_key(key: Self::Key<'_>) -> String {
format!("leaf_layer_subqueues_{key}.bin")
}

serialize_using_bincode!();
}

/// Storage key for a [AggregationWrapper`].
#[derive(Debug, Clone, Copy)]
pub struct AggregationsKey {
Expand Down Expand Up @@ -253,23 +176,6 @@ pub struct CircuitKey<'a> {
pub aggregation_round: AggregationRound,
}

impl StoredObject for ZkSyncCircuit<Bn256, VmWitnessOracle<Bn256>> {
const BUCKET: Bucket = Bucket::ProverJobs;
type Key<'a> = CircuitKey<'a>;

fn encode_key(key: Self::Key<'_>) -> String {
let CircuitKey {
block_number,
sequence_number,
circuit_type,
aggregation_round,
} = key;
format!("{block_number}_{sequence_number}_{circuit_type}_{aggregation_round:?}.bin")
}

serialize_using_bincode!();
}

impl StoredObject for L1BatchProofForL1 {
const BUCKET: Bucket = Bucket::ProofsFri;
type Key<'a> = L1BatchNumber;
Expand Down
2 changes: 1 addition & 1 deletion core/lib/types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub use zk_evm::{
reference_impls::event_sink::EventMessage,
zkevm_opcode_defs::FarCallOpcode,
};
pub use zkevm_test_harness;
pub use zksync_basic_types::*;

use crate::{l2::TransactionType, protocol_version::ProtocolUpgradeTxCommonData};
Expand Down Expand Up @@ -58,6 +57,7 @@ pub mod helpers;
pub mod proofs;
pub mod proto;
pub mod prover_server_api;
pub mod sort_storage_access;
pub mod transaction_request;
pub mod utils;
pub mod vk_transform;
Expand Down
Loading

0 comments on commit dd1a35e

Please sign in to comment.