From 39fb338b79677a03398efbe1b8acb81bc724b69a Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Mon, 6 Nov 2023 16:36:26 +0100 Subject: [PATCH 1/2] fix mps comments --- core/lib/multivm/src/versions/vm_latest/constants.rs | 2 +- .../src/versions/vm_latest/old_vm/event_sink.rs | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/core/lib/multivm/src/versions/vm_latest/constants.rs b/core/lib/multivm/src/versions/vm_latest/constants.rs index 7338461cbfca..c67156681a0b 100644 --- a/core/lib/multivm/src/versions/vm_latest/constants.rs +++ b/core/lib/multivm/src/versions/vm_latest/constants.rs @@ -59,7 +59,7 @@ pub const OPERATOR_PROVIDED_L1_MESSENGER_PUBDATA_OFFSET: usize = /// One of "worst case" scenarios for the number of state diffs in a batch is when 120kb of pubdata is spent /// on repeated writes, that are all zeroed out. In this case, the number of diffs is 120k / 5 = 24k. This means that they will have -/// accoomdate 6528000 bytes of calldata for the uncompressed state diffs. Adding 120k on top leaves us with +/// accommodate 6528000 bytes of calldata for the uncompressed state diffs. Adding 120k on top leaves us with /// roughly 6650000 bytes needed for calldata. 207813 slots are needed to accomodate this amount of data. /// We round up to 208000 slots just in case. /// diff --git a/core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs index a03ad173aba7..cbfe44f2bc6e 100644 --- a/core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs @@ -76,16 +76,7 @@ impl InMemoryEventSink { // Sort the events by timestamp and rollback flag, basically ensuring that // if an event has been rolled back, the original event and its rollback will be put together - events.sort_by(|a, b| match a.timestamp.0.cmp(&b.timestamp.0) { - Ordering::Equal => { - if b.rollback { - Ordering::Less - } else { - Ordering::Greater - } - } - r => r, - }); + events.sort_by_key(|log| (log.timestamp, log.rollback)); let mut stack = Vec::::new(); let mut net_history = vec![]; From 76eb720af80e662b1e0e020a278dcd8be351ada9 Mon Sep 17 00:00:00 2001 From: Stanislav Breadless Date: Mon, 6 Nov 2023 16:47:34 +0100 Subject: [PATCH 2/2] resolve linting --- core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs b/core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs index cbfe44f2bc6e..4174d9f4f170 100644 --- a/core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs +++ b/core/lib/multivm/src/versions/vm_latest/old_vm/event_sink.rs @@ -3,7 +3,7 @@ use crate::vm_latest::old_vm::{ oracles::OracleWithHistory, }; use itertools::Itertools; -use std::{cmp::Ordering, collections::HashMap}; +use std::collections::HashMap; use zk_evm_1_4_0::{ abstractions::EventSink, aux_structures::{LogQuery, Timestamp},