-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply interface for latest and vm refunds enhancement
Signed-off-by: Danil <deniallugo@gmail.com>
- Loading branch information
1 parent
fe6aaef
commit 1a98417
Showing
49 changed files
with
619 additions
and
854 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
core/lib/multivm/src/interface/traits/tracers/dyn_tracers/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
pub mod vm_1_3_3; | ||
pub mod vm_1_4_0; |
33 changes: 33 additions & 0 deletions
33
core/lib/multivm/src/interface/traits/tracers/dyn_tracers/vm_1_4_0.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use zk_evm_1_4_0::abstractions::Memory; | ||
use zk_evm_1_4_0::tracing::{ | ||
AfterDecodingData, AfterExecutionData, BeforeExecutionData, VmLocalStateData, | ||
}; | ||
use zksync_state::StoragePtr; | ||
|
||
/// Version of zk_evm_1_3_3::Tracer suitable for dynamic dispatch. | ||
pub trait DynTracer<S, M: Memory> { | ||
fn before_decoding(&mut self, _state: VmLocalStateData<'_>, _memory: &M) {} | ||
fn after_decoding( | ||
&mut self, | ||
_state: VmLocalStateData<'_>, | ||
_data: AfterDecodingData, | ||
_memory: &M, | ||
) { | ||
} | ||
fn before_execution( | ||
&mut self, | ||
_state: VmLocalStateData<'_>, | ||
_data: BeforeExecutionData, | ||
_memory: &M, | ||
_storage: StoragePtr<S>, | ||
) { | ||
} | ||
fn after_execution( | ||
&mut self, | ||
_state: VmLocalStateData<'_>, | ||
_data: AfterExecutionData, | ||
_memory: &M, | ||
_storage: StoragePtr<S>, | ||
) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
core/lib/multivm/src/tracers/storage_invocation/vm_latest/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
core/lib/multivm/src/tracers/storage_invocation/vm_refunds_enhancement/mod.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use crate::interface::tracer::{TracerExecutionStatus, TracerExecutionStopReason}; | ||
use crate::interface::{traits::tracers::dyn_tracers::vm_1_3_3::DynTracer, Halt}; | ||
use crate::tracers::storage_invocation::StorageInvocations; | ||
use crate::vm_refunds_enhancement::VmTracer; | ||
use crate::vm_refunds_enhancement::{BootloaderState, HistoryMode, SimpleMemory, ZkSyncVmState}; | ||
use zksync_state::WriteStorage; | ||
|
||
impl<S, H: HistoryMode> DynTracer<S, SimpleMemory<H>> for StorageInvocations {} | ||
|
||
impl<S: WriteStorage, H: HistoryMode> VmTracer<S, H> for StorageInvocations { | ||
fn finish_cycle( | ||
&mut self, | ||
state: &mut ZkSyncVmState<S, H>, | ||
_bootloader_state: &mut BootloaderState, | ||
) -> TracerExecutionStatus { | ||
let current = state | ||
.storage | ||
.storage | ||
.get_ptr() | ||
.borrow() | ||
.missed_storage_invocations(); | ||
|
||
if current >= self.limit { | ||
return TracerExecutionStatus::Stop(TracerExecutionStopReason::Abort( | ||
Halt::TracerCustom("Storage invocations limit reached".to_string()), | ||
)); | ||
} | ||
TracerExecutionStatus::Continue | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
mod types; | ||
mod vm_latest; | ||
mod vm_refunds_enhancement; | ||
mod vm_virtual_blocks; | ||
|
||
use std::sync::Arc; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.