Skip to content

Commit

Permalink
chore(vm): apply new interface for old vms (#351)
Browse files Browse the repository at this point in the history
# What ❔

Apply new vm interface for all old vms
Apply new vm interface for multivm

Introduce a few macroses for simple dispatching between vms and tracers 

## Why ❔

Part of the refactoring and applying the new interface everywhere 

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.

---------

Signed-off-by: Danil <deniallugo@gmail.com>
  • Loading branch information
Deniallugo committed Nov 8, 2023
1 parent 937de52 commit fe3b2cf
Show file tree
Hide file tree
Showing 58 changed files with 1,282 additions and 1,220 deletions.
72 changes: 0 additions & 72 deletions core/lib/multivm/src/glue/block_properties.rs

This file was deleted.

193 changes: 0 additions & 193 deletions core/lib/multivm/src/glue/init_vm.rs

This file was deleted.

3 changes: 0 additions & 3 deletions core/lib/multivm/src/glue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
//!
//! The "private glue" lies in the `types` module.

pub(crate) mod block_properties;
pub(crate) mod history_mode;
pub(crate) mod init_vm;
pub(crate) mod oracle_tools;
pub mod tracers;
mod types;

Expand Down
58 changes: 0 additions & 58 deletions core/lib/multivm/src/glue/oracle_tools.rs

This file was deleted.

1 change: 1 addition & 0 deletions core/lib/multivm/src/glue/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
//! This "glue layer" is generally not visible outside of the crate.

mod vm;
mod zk_evm_1_3_1;
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
pub trait GlueFrom<T>: Sized {
fn glue_from(value: T) -> Self;
}

/// See the description of [`GlueFrom`] trait above.
pub trait GlueInto<T>: Sized {
fn glue_into(self) -> T;
}

// Blaknet `GlueInto` impl for any type that implements `GlueFrom`.
impl<T, U> GlueInto<U> for T
where
U: GlueFrom<T>,
{
fn glue_into(self) -> U {
U::glue_from(self)
}
}

// Identity impl.
impl<T> GlueFrom<T> for T {
fn glue_from(this: T) -> Self {
this
}
}
use crate::glue::{GlueFrom, GlueInto};

impl GlueFrom<zk_evm_1_3_1::aux_structures::Timestamp> for zksync_types::Timestamp {
fn glue_from(timestamp: zk_evm_1_3_1::aux_structures::Timestamp) -> Self {
Expand Down
Loading

0 comments on commit fe3b2cf

Please sign in to comment.