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

chore: remove storage_logs field from ExecutionState #1799

Merged
merged 1 commit into from
Apr 30, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 0 additions & 12 deletions core/lib/multivm/src/glue/types/vm/vm_block_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ impl GlueFrom<crate::vm_m5::vm_instance::VmBlockResult> for crate::interface::Fi
},
final_execution_state: CurrentExecutionState {
events: value.full_result.events,
storage_log_queries: storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduplicated_storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
Expand Down Expand Up @@ -114,10 +110,6 @@ impl GlueFrom<crate::vm_m6::vm_instance::VmBlockResult> for crate::interface::Fi
},
final_execution_state: CurrentExecutionState {
events: value.full_result.events,
storage_log_queries: storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduplicated_storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
Expand Down Expand Up @@ -175,10 +167,6 @@ impl GlueFrom<crate::vm_1_3_2::vm_instance::VmBlockResult> for crate::interface:
},
final_execution_state: CurrentExecutionState {
events: value.full_result.events,
storage_log_queries: storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduplicated_storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
use zksync_types::{
l2_to_l1_log::{SystemL2ToL1Log, UserL2ToL1Log},
zk_evm_types::LogQuery,
StorageLogQuery, VmEvent, U256,
VmEvent, U256,
};

/// State of the VM since the start of the batch execution.
#[derive(Debug, Clone, PartialEq)]
pub struct CurrentExecutionState {
/// Events produced by the VM.
pub events: Vec<VmEvent>,
/// Storage logs produced by the VM.
pub storage_log_queries: Vec<StorageLogQuery>,
/// The deduplicated storage logs produced by the VM.
/// It is the deduplicated version of the `storage_log_queries` field.
pub deduplicated_storage_log_queries: Vec<LogQuery>,
/// Hashes of the contracts used by the VM.
pub used_contract_hashes: Vec<U256>,
Expand Down
4 changes: 0 additions & 4 deletions core/lib/multivm/src/versions/vm_1_3_2/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,6 @@ impl<S: WriteStorage, H: HistoryMode> VmInterface<S, H> for Vm<S, H> {

CurrentExecutionState {
events,
storage_log_queries: storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduped_storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
Expand Down
4 changes: 0 additions & 4 deletions core/lib/multivm/src/versions/vm_1_4_1/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ impl<S: WriteStorage, H: HistoryMode> VmInterface<S, H> for Vm<S, H> {

CurrentExecutionState {
events,
storage_log_queries: storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduped_storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
Expand Down
4 changes: 0 additions & 4 deletions core/lib/multivm/src/versions/vm_1_4_2/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ impl<S: WriteStorage, H: HistoryMode> VmInterface<S, H> for Vm<S, H> {

CurrentExecutionState {
events,
storage_log_queries: storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduped_storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
Expand Down
4 changes: 0 additions & 4 deletions core/lib/multivm/src/versions/vm_boojum_integration/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,6 @@ impl<S: WriteStorage, H: HistoryMode> VmInterface<S, H> for Vm<S, H> {

CurrentExecutionState {
events,
storage_log_queries: storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduped_storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
Expand Down
12 changes: 6 additions & 6 deletions core/lib/multivm/src/versions/vm_latest/tests/refunds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ fn test_predetermined_refunded_gas() {
);

assert_eq!(
current_state_with_predefined_refunds.storage_log_queries,
current_state_without_predefined_refunds.storage_log_queries
current_state_with_predefined_refunds.deduplicated_storage_log_queries,
current_state_without_predefined_refunds.deduplicated_storage_log_queries
);
assert_eq!(
current_state_with_predefined_refunds.used_contract_hashes,
Expand Down Expand Up @@ -148,16 +148,16 @@ fn test_predetermined_refunded_gas() {

assert_eq!(
current_state_with_changed_predefined_refunds
.storage_log_queries
.deduplicated_storage_log_queries
.len(),
current_state_without_predefined_refunds
.storage_log_queries
.deduplicated_storage_log_queries
.len()
);

assert_ne!(
current_state_with_changed_predefined_refunds.storage_log_queries,
current_state_without_predefined_refunds.storage_log_queries
current_state_with_changed_predefined_refunds.deduplicated_storage_log_queries,
current_state_without_predefined_refunds.deduplicated_storage_log_queries
);
assert_eq!(
current_state_with_changed_predefined_refunds.used_contract_hashes,
Expand Down
4 changes: 0 additions & 4 deletions core/lib/multivm/src/versions/vm_latest/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,6 @@ impl<S: WriteStorage, H: HistoryMode> VmInterface<S, H> for Vm<S, H> {

CurrentExecutionState {
events,
storage_log_queries: storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduped_storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
Expand Down
4 changes: 0 additions & 4 deletions core/lib/multivm/src/versions/vm_m5/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,6 @@ impl<S: Storage, H: HistoryMode> VmInterface<S, H> for Vm<S, H> {

CurrentExecutionState {
events,
storage_log_queries: storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduplicated_logs
.into_iter()
.map(GlueInto::glue_into)
Expand Down
6 changes: 0 additions & 6 deletions core/lib/multivm/src/versions/vm_m6/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,6 @@ impl<S: Storage, H: HistoryMode> VmInterface<S, H> for Vm<S, H> {

CurrentExecutionState {
events,
storage_log_queries: self
.vm
.get_final_log_queries()
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduplicated_logs
.into_iter()
.map(GlueInto::glue_into)
Expand Down
4 changes: 0 additions & 4 deletions core/lib/multivm/src/versions/vm_refunds_enhancement/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ impl<S: WriteStorage, H: HistoryMode> VmInterface<S, H> for Vm<S, H> {

CurrentExecutionState {
events,
storage_log_queries: storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduped_storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
Expand Down
4 changes: 0 additions & 4 deletions core/lib/multivm/src/versions/vm_virtual_blocks/vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ impl<S: WriteStorage, H: HistoryMode> VmInterface<S, H> for Vm<S, H> {

CurrentExecutionState {
events,
storage_log_queries: storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
.collect(),
deduplicated_storage_log_queries: deduped_storage_log_queries
.into_iter()
.map(GlueInto::glue_into)
Expand Down
1 change: 0 additions & 1 deletion core/lib/zksync_core/src/state_keeper/io/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ mod tests {
});

let mut batch_result = default_vm_batch_result();
batch_result.final_execution_state.storage_log_queries = storage_logs.clone();
batch_result
.final_execution_state
.deduplicated_storage_log_queries = storage_logs
Expand Down
18 changes: 4 additions & 14 deletions core/lib/zksync_core/src/state_keeper/io/seal_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use zksync_types::{
utils::display_timestamp,
zk_evm_types::LogQuery,
AccountTreeId, Address, ExecuteTransactionCommon, L1BlockNumber, ProtocolVersionId, StorageKey,
StorageLog, StorageLogQuery, Transaction, VmEvent, H256,
StorageLog, Transaction, VmEvent, H256,
};
use zksync_utils::u256_to_h256;

Expand Down Expand Up @@ -76,9 +76,6 @@ impl UpdatesManager {
);

let (l1_tx_count, l2_tx_count) = l1_l2_tx_count(&self.l1_batch.executed_transactions);
let (writes_count, reads_count) = storage_log_query_write_read_counts(
&finished_batch.final_execution_state.storage_log_queries,
);
let (dedup_writes_count, dedup_reads_count) = log_query_write_read_counts(
finished_batch
.final_execution_state
Expand All @@ -89,8 +86,8 @@ impl UpdatesManager {
tracing::info!(
"Sealing L1 batch {current_l1_batch_number} with timestamp {ts}, {total_tx_count} \
({l2_tx_count} L2 + {l1_tx_count} L1) txs, {l2_to_l1_log_count} l2_l1_logs, \
{event_count} events, {reads_count} reads ({dedup_reads_count} deduped), \
{writes_count} writes ({dedup_writes_count} deduped)",
{event_count} events, {dedup_reads_count} deduped reads, \
{dedup_writes_count} deduped writes",
ts = display_timestamp(self.batch_timestamp()),
total_tx_count = l1_tx_count + l2_tx_count,
l2_to_l1_log_count = finished_batch
Expand Down Expand Up @@ -332,12 +329,9 @@ impl L2BlockSealCommand {
let progress = L2_BLOCK_METRICS.start(L2BlockSealStage::InsertL2BlockHeader, is_fictive);

let (l1_tx_count, l2_tx_count) = l1_l2_tx_count(&self.l2_block.executed_transactions);
let (writes_count, reads_count) =
storage_log_query_write_read_counts(&self.l2_block.storage_logs);
tracing::info!(
"Sealing L2 block {l2_block_number} with timestamp {ts} (L1 batch {l1_batch_number}) \
with {total_tx_count} ({l2_tx_count} L2 + {l1_tx_count} L1) txs, {event_count} events, \
{reads_count} reads, {writes_count} writes",
with {total_tx_count} ({l2_tx_count} L2 + {l1_tx_count} L1) txs, {event_count} events",
ts = display_timestamp(self.l2_block.timestamp),
total_tx_count = l1_tx_count + l2_tx_count,
event_count = self.l2_block.events.len()
Expand Down Expand Up @@ -673,7 +667,3 @@ fn log_query_write_read_counts<'a>(logs: impl Iterator<Item = &'a LogQuery>) ->
}
(writes_count, reads_count)
}

fn storage_log_query_write_read_counts(logs: &[StorageLogQuery]) -> (usize, usize) {
log_query_write_read_counts(logs.iter().map(|log| &log.log_query))
}
1 change: 0 additions & 1 deletion core/lib/zksync_core/src/state_keeper/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ pub(super) fn default_vm_batch_result() -> FinishedL1Batch {
},
final_execution_state: CurrentExecutionState {
events: vec![],
storage_log_queries: vec![],
deduplicated_storage_log_queries: vec![],
used_contract_hashes: vec![],
user_l2_to_l1_logs: vec![],
Expand Down