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

Remove vm local #1672

Merged
merged 2 commits into from
Apr 12, 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
5 changes: 1 addition & 4 deletions core/lib/basic_types/src/protocol_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ pub enum ProtocolVersionId {
Version21,
Version22,
Version23,
Local,
Version24,
}

impl ProtocolVersionId {
pub fn latest() -> Self {
Self::Local
Self::Version24
}

pub fn next() -> Self {
Expand Down Expand Up @@ -87,7 +86,6 @@ impl ProtocolVersionId {
ProtocolVersionId::Version22 => VmVersion::Vm1_4_2,
ProtocolVersionId::Version23 => VmVersion::Vm1_5_0,
ProtocolVersionId::Version24 => VmVersion::Vm1_5_0,
ProtocolVersionId::Local => VmVersion::Local,
}
}

Expand Down Expand Up @@ -227,7 +225,6 @@ impl From<ProtocolVersionId> for VmVersion {
ProtocolVersionId::Version22 => VmVersion::Vm1_4_2,
ProtocolVersionId::Version23 => VmVersion::Vm1_5_0,
ProtocolVersionId::Version24 => VmVersion::Vm1_5_0,
ProtocolVersionId::Local => VmVersion::Local,
}
}
}
4 changes: 1 addition & 3 deletions core/lib/basic_types/src/vm_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ pub enum VmVersion {
Vm1_4_1,
Vm1_4_2,
Vm1_5_0,
// kl to do delete local vm version
Local,
}

impl VmVersion {
/// Returns the latest supported VM version.
pub const fn latest() -> VmVersion {
// kl to do delete local vm version
Self::Local
Self::Vm1_5_0
}
}
44 changes: 14 additions & 30 deletions core/lib/multivm/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ pub fn derive_base_fee_and_gas_per_pubdata(
VmVersion::Vm1_4_2 => crate::vm_1_4_2::utils::fee::derive_base_fee_and_gas_per_pubdata(
batch_fee_input.into_pubdata_independent(),
),
VmVersion::Vm1_5_0 | VmVersion::Local => {
crate::vm_latest::utils::fee::derive_base_fee_and_gas_per_pubdata(
batch_fee_input.into_pubdata_independent(),
)
}
VmVersion::Vm1_5_0 => crate::vm_latest::utils::fee::derive_base_fee_and_gas_per_pubdata(
batch_fee_input.into_pubdata_independent(),
),
}
}

Expand All @@ -75,9 +73,7 @@ pub fn get_batch_base_fee(l1_batch_env: &L1BatchEnv, vm_version: VmVersion) -> u
}
VmVersion::Vm1_4_1 => crate::vm_1_4_1::utils::fee::get_batch_base_fee(l1_batch_env),
VmVersion::Vm1_4_2 => crate::vm_1_4_2::utils::fee::get_batch_base_fee(l1_batch_env),
VmVersion::Vm1_5_0 | VmVersion::Local => {
crate::vm_latest::utils::fee::get_batch_base_fee(l1_batch_env)
}
VmVersion::Vm1_5_0 => crate::vm_latest::utils::fee::get_batch_base_fee(l1_batch_env),
}
}

Expand Down Expand Up @@ -203,9 +199,7 @@ pub fn derive_overhead(
}
VmVersion::Vm1_4_1 => crate::vm_1_4_1::utils::overhead::derive_overhead(encoded_len),
VmVersion::Vm1_4_2 => crate::vm_1_4_2::utils::overhead::derive_overhead(encoded_len),
VmVersion::Vm1_5_0 | VmVersion::Local => {
crate::vm_latest::utils::overhead::derive_overhead(encoded_len)
}
VmVersion::Vm1_5_0 => crate::vm_latest::utils::overhead::derive_overhead(encoded_len),
}
}

Expand All @@ -229,9 +223,7 @@ pub fn get_bootloader_encoding_space(version: VmVersion) -> u32 {
}
VmVersion::Vm1_4_1 => crate::vm_1_4_1::constants::BOOTLOADER_TX_ENCODING_SPACE,
VmVersion::Vm1_4_2 => crate::vm_1_4_2::constants::BOOTLOADER_TX_ENCODING_SPACE,
VmVersion::Vm1_5_0 | VmVersion::Local => {
crate::vm_latest::constants::BOOTLOADER_TX_ENCODING_SPACE
}
VmVersion::Vm1_5_0 => crate::vm_latest::constants::BOOTLOADER_TX_ENCODING_SPACE,
}
}

Expand All @@ -251,7 +243,7 @@ pub fn get_bootloader_max_txs_in_batch(version: VmVersion) -> usize {
VmVersion::VmBoojumIntegration => crate::vm_boojum_integration::constants::MAX_TXS_IN_BLOCK,
VmVersion::Vm1_4_1 => crate::vm_1_4_1::constants::MAX_TXS_IN_BATCH,
VmVersion::Vm1_4_2 => crate::vm_1_4_2::constants::MAX_TXS_IN_BATCH,
VmVersion::Vm1_5_0 | VmVersion::Local => crate::vm_latest::constants::MAX_TXS_IN_BATCH,
VmVersion::Vm1_5_0 => crate::vm_latest::constants::MAX_TXS_IN_BATCH,
}
}

Expand All @@ -272,9 +264,7 @@ pub fn gas_bootloader_batch_tip_overhead(version: VmVersion) -> u32 {
}
VmVersion::Vm1_4_1 => crate::vm_1_4_1::constants::BOOTLOADER_BATCH_TIP_OVERHEAD,
VmVersion::Vm1_4_2 => crate::vm_1_4_2::constants::BOOTLOADER_BATCH_TIP_OVERHEAD,
VmVersion::Vm1_5_0 | VmVersion::Local => {
crate::vm_latest::constants::BOOTLOADER_BATCH_TIP_OVERHEAD
}
VmVersion::Vm1_5_0 => crate::vm_latest::constants::BOOTLOADER_BATCH_TIP_OVERHEAD,
}
}

Expand All @@ -295,7 +285,7 @@ pub fn circuit_statistics_bootloader_batch_tip_overhead(version: VmVersion) -> u
VmVersion::Vm1_4_2 => {
crate::vm_1_4_2::constants::BOOTLOADER_BATCH_TIP_CIRCUIT_STATISTICS_OVERHEAD as usize
}
VmVersion::Vm1_5_0 | VmVersion::Local => {
VmVersion::Vm1_5_0 => {
crate::vm_latest::constants::BOOTLOADER_BATCH_TIP_CIRCUIT_STATISTICS_OVERHEAD as usize
}
}
Expand All @@ -318,7 +308,7 @@ pub fn execution_metrics_bootloader_batch_tip_overhead(version: VmVersion) -> us
VmVersion::Vm1_4_2 => {
crate::vm_1_4_2::constants::BOOTLOADER_BATCH_TIP_METRICS_SIZE_OVERHEAD as usize
}
VmVersion::Vm1_5_0 | VmVersion::Local => {
VmVersion::Vm1_5_0 => {
crate::vm_latest::constants::BOOTLOADER_BATCH_TIP_METRICS_SIZE_OVERHEAD as usize
}
}
Expand All @@ -342,9 +332,7 @@ pub fn get_max_gas_per_pubdata_byte(version: VmVersion) -> u64 {
}
VmVersion::Vm1_4_1 => crate::vm_1_4_1::constants::MAX_GAS_PER_PUBDATA_BYTE,
VmVersion::Vm1_4_2 => crate::vm_1_4_2::constants::MAX_GAS_PER_PUBDATA_BYTE,
VmVersion::Vm1_5_0 | VmVersion::Local => {
crate::vm_latest::constants::MAX_GAS_PER_PUBDATA_BYTE
}
VmVersion::Vm1_5_0 => crate::vm_latest::constants::MAX_GAS_PER_PUBDATA_BYTE,
}
}

Expand All @@ -368,9 +356,7 @@ pub fn get_used_bootloader_memory_bytes(version: VmVersion) -> usize {
}
VmVersion::Vm1_4_1 => crate::vm_1_4_1::constants::USED_BOOTLOADER_MEMORY_BYTES,
VmVersion::Vm1_4_2 => crate::vm_1_4_2::constants::USED_BOOTLOADER_MEMORY_BYTES,
VmVersion::Vm1_5_0 | VmVersion::Local => {
crate::vm_latest::constants::USED_BOOTLOADER_MEMORY_BYTES
}
VmVersion::Vm1_5_0 => crate::vm_latest::constants::USED_BOOTLOADER_MEMORY_BYTES,
}
}

Expand All @@ -394,9 +380,7 @@ pub fn get_used_bootloader_memory_words(version: VmVersion) -> usize {
}
VmVersion::Vm1_4_1 => crate::vm_1_4_1::constants::USED_BOOTLOADER_MEMORY_WORDS,
VmVersion::Vm1_4_2 => crate::vm_1_4_2::constants::USED_BOOTLOADER_MEMORY_WORDS,
VmVersion::Vm1_5_0 | VmVersion::Local => {
crate::vm_latest::constants::USED_BOOTLOADER_MEMORY_WORDS
}
VmVersion::Vm1_5_0 => crate::vm_latest::constants::USED_BOOTLOADER_MEMORY_WORDS,
}
}

Expand All @@ -418,7 +402,7 @@ pub fn get_max_batch_gas_limit(version: VmVersion) -> u64 {
}
VmVersion::Vm1_4_1 => crate::vm_1_4_1::constants::BLOCK_GAS_LIMIT as u64,
VmVersion::Vm1_4_2 => crate::vm_1_4_2::constants::BLOCK_GAS_LIMIT as u64,
VmVersion::Vm1_5_0 | VmVersion::Local => crate::vm_latest::constants::BATCH_GAS_LIMIT,
VmVersion::Vm1_5_0 => crate::vm_latest::constants::BATCH_GAS_LIMIT,
}
}

Expand Down
4 changes: 0 additions & 4 deletions core/lib/multivm/src/vm_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,10 +222,6 @@ impl<S: WriteStorage, H: HistoryMode> VmInstance<S, H> {
let vm = crate::vm_latest::Vm::new(l1_batch_env, system_env, storage_view);
VmInstance::Vm1_5_0(vm)
}
VmVersion::Local => {
let vm = crate::vm_latest::Vm::new(l1_batch_env, system_env, storage_view);
VmInstance::VmLocal(vm)
}
}
}
}
9 changes: 0 additions & 9 deletions core/lib/zksync_core/src/api_server/tx_sender/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ pub struct MultiVMBaseSystemContracts {
pub(crate) post_1_4_2: BaseSystemContracts,
/// Contracts to be used after the 1.5.0 upgrade
pub(crate) post_1_5_0: BaseSystemContracts,
// kl to do delete local vm version
/// Contracts to be used for local requests.
pub(crate) local: BaseSystemContracts,
}

impl MultiVMBaseSystemContracts {
Expand Down Expand Up @@ -101,8 +98,6 @@ impl MultiVMBaseSystemContracts {
ProtocolVersionId::Version20 => self.post_1_4_1,
ProtocolVersionId::Version21 | ProtocolVersionId::Version22 => self.post_1_4_2,
ProtocolVersionId::Version23 | ProtocolVersionId::Version24 => self.post_1_5_0,
// kl to do delete local vm version
ProtocolVersionId::Local => self.local,
}
}
}
Expand Down Expand Up @@ -137,8 +132,6 @@ impl ApiContracts {
post_1_4_1: BaseSystemContracts::estimate_gas_post_1_4_1(),
post_1_4_2: BaseSystemContracts::estimate_gas_post_1_4_2(),
post_1_5_0: BaseSystemContracts::estimate_gas_post_1_5_0(),
// kl to do delete local vm version
local: BaseSystemContracts::estimate_gas_post_1_5_0(),
},
eth_call: MultiVMBaseSystemContracts {
pre_virtual_blocks: BaseSystemContracts::playground_pre_virtual_blocks(),
Expand All @@ -150,8 +143,6 @@ impl ApiContracts {
post_1_4_1: BaseSystemContracts::playground_post_1_4_1(),
post_1_4_2: BaseSystemContracts::playground_post_1_4_2(),
post_1_5_0: BaseSystemContracts::playground_post_1_5_0(),
// kl to do delete local vm version
local: BaseSystemContracts::playground_post_1_5_0(),
},
}
}
Expand Down
Loading