Skip to content

Commit

Permalink
Remove ExtractContractsDeployed seal stage
Browse files Browse the repository at this point in the history
  • Loading branch information
slowli committed Feb 2, 2024
1 parent 9bdc7b8 commit d652fea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 32 deletions.
34 changes: 3 additions & 31 deletions core/lib/zksync_core/src/state_keeper/io/seal_logic.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
//! This module is a source-of-truth on what is expected to be done when sealing a block.
//! It contains the logic of the block sealing, which is used by both the mempool-based and external node IO.
use std::{
collections::HashMap,
time::{Duration, Instant},
};
use std::time::{Duration, Instant};

use chrono::Utc;
use itertools::Itertools;
Expand All @@ -14,7 +11,6 @@ use multivm::{
};
use vm_utils::storage::wait_for_prev_l1_batch_params;
use zksync_dal::StorageProcessor;
use zksync_system_constants::ACCOUNT_CODE_STORAGE_ADDRESS;
use zksync_types::{
block::{unpack_block_info, L1BatchHeader, MiniblockHeader},
event::{extract_added_tokens, extract_long_l2_to_l1_messages},
Expand All @@ -29,8 +25,8 @@ use zksync_types::{
},
zk_evm_types::LogQuery,
AccountTreeId, Address, ExecuteTransactionCommon, L1BatchNumber, L1BlockNumber,
MiniblockNumber, ProtocolVersionId, StorageKey, StorageLog, StorageLogQuery, StorageValue,
Transaction, VmEvent, CURRENT_VIRTUAL_BLOCK_INFO_POSITION, H256, SYSTEM_CONTEXT_ADDRESS,
MiniblockNumber, ProtocolVersionId, StorageKey, StorageLog, StorageLogQuery, Transaction,
VmEvent, CURRENT_VIRTUAL_BLOCK_INFO_POSITION, H256, SYSTEM_CONTEXT_ADDRESS,
};
// TODO (SMA-1206): use seconds instead of milliseconds.
use zksync_utils::{h256_to_u256, time::millis_since_epoch, u256_to_h256};
Expand Down Expand Up @@ -400,12 +396,6 @@ impl MiniblockSealCommand {
}
progress.observe(new_factory_deps_count);

let progress =
MINIBLOCK_METRICS.start(MiniblockSealStage::ExtractContractsDeployed, is_fictive);
let unique_updates = HashMap::new(); // FIXME
let deployed_contract_count = Self::count_deployed_contracts(&unique_updates);
progress.observe(deployed_contract_count);

let progress = MINIBLOCK_METRICS.start(MiniblockSealStage::ExtractAddedTokens, is_fictive);
let added_tokens = extract_added_tokens(self.l2_erc20_bridge_addr, &self.miniblock.events);
progress.observe(added_tokens.len());
Expand Down Expand Up @@ -550,24 +540,6 @@ impl MiniblockSealCommand {
&tx_result.transaction
}

fn count_deployed_contracts(
unique_updates: &HashMap<StorageKey, (H256, StorageValue)>,
) -> usize {
let mut count = 0;
for (key, (_, value)) in unique_updates {
if *key.account().address() == ACCOUNT_CODE_STORAGE_ADDRESS {
let bytecode_hash = *value;
// TODO(SMA-1554): Support contracts deletion.
// For now, we expected that if the `bytecode_hash` is zero, the contract was not deployed
// in the first place, so we don't do anything
if bytecode_hash != H256::zero() {
count += 1;
}
}
}
count
}

fn extract_events(&self, is_fictive: bool) -> Vec<(IncludedTxLocation, Vec<&VmEvent>)> {
self.group_by_tx_location(&self.miniblock.events, is_fictive, |event| event.location.1)
}
Expand Down
1 change: 0 additions & 1 deletion core/lib/zksync_core/src/state_keeper/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ pub(super) enum MiniblockSealStage {
MarkTransactionsInMiniblock,
InsertStorageLogs,
InsertFactoryDeps,
ExtractContractsDeployed,
ExtractAddedTokens,
InsertTokens,
ExtractEvents,
Expand Down

0 comments on commit d652fea

Please sign in to comment.