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

Evm tests #223

Draft
wants to merge 7 commits into
base: evm-equivalence-yul
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[submodule "contracts"]
path = contracts
url = https://github.com/matter-labs/era-contracts.git
[submodule "core/lib/multivm/src/versions/vm_latest/tests/tests"]
path = core/lib/multivm/src/versions/vm_latest/tests/tests
url = https://github.com/ethereum/tests
branch = develop
95 changes: 86 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion core/lib/multivm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,15 @@ once_cell = "1.7"
thiserror = "1.0"
tracing = "0.1"
vise = { git = "https://github.com/matter-labs/vise.git", version = "0.1.0", rev = "1c9cc500e92cf9ea052b230e114a6f9cce4fb2c1" }
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
include_dir = "0.7.3"

[dev-dependencies]
tokio = { version = "1", features = ["time"] }
zksync_test_account = { path = "../../tests/test_account" }
ethabi = "18.0.0"
zksync_eth_signer = { path = "../eth_signer" }
serde = { version = "1.0", features = ["derive"] }
csv = "1.3.0"
chrono = "0.4"
rstest = "0.21.0"
2 changes: 1 addition & 1 deletion core/lib/multivm/src/interface/types/errors/halt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use super::VmRevertReason;
/// Structure for non-contract errors from the Virtual Machine (EVM).

/// Differentiates VM-specific issues from contract-related errors.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
pub enum Halt {
// Can only be returned in `VerifyAndExecute`
ValidationFailed(VmRevertReason),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub enum VmRevertReasonParsingError {
}

/// Rich Revert Reasons `https://github.com/0xProject/ZEIPs/issues/32`
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
pub enum VmRevertReason {
General {
msg: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
event::{extract_long_l2_to_l1_messages, extract_published_bytecodes},
l2_to_l1_log::{SystemL2ToL1Log, UserL2ToL1Log},
tx::ExecutionMetrics,
StorageLogQuery, Transaction, VmEvent, H256,

Check warning on line 6 in core/lib/multivm/src/interface/types/outputs/execution_result.rs

View workflow job for this annotation

GitHub Actions / Run tests

unused import: `H256`
};
use zksync_utils::bytecode::bytecode_len_in_bytes;

use crate::interface::{Halt, VmExecutionStatistics, VmRevertReason};

/// Refunds produced for the user.
#[derive(Debug, Clone, Default)]
#[derive(Debug, Clone, Default, serde::Deserialize, serde::Serialize)]
pub struct Refunds {
pub gas_refunded: u32,
pub operator_suggested_refund: u32,
}

/// Events/storage logs/l2->l1 logs created within transaction execution.
#[derive(Debug, Clone, Default, PartialEq)]
#[derive(Debug, Clone, Default, PartialEq, serde::Deserialize, serde::Serialize)]
pub struct VmExecutionLogs {
pub storage_logs: Vec<StorageLogQuery>,
pub events: Vec<VmEvent>,
Expand All @@ -36,15 +36,15 @@
}

/// Result and logs of the VM execution.
#[derive(Debug, Clone)]
#[derive(Debug, Clone, serde::Deserialize, serde::Serialize)]
pub struct VmExecutionResultAndLogs {
pub result: ExecutionResult,
pub logs: VmExecutionLogs,
pub statistics: VmExecutionStatistics,
pub refunds: Refunds,
}

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, serde::Deserialize, serde::Serialize)]
pub enum ExecutionResult {
/// Returned successfully
Success { output: Vec<u8> },
Expand Down
2 changes: 1 addition & 1 deletion core/lib/multivm/src/interface/types/outputs/statistic.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use zksync_types::circuit::CircuitStatistic;

/// Statistics of the tx execution.
#[derive(Debug, Default, Clone)]
#[derive(Debug, Default, Clone, serde::Deserialize, serde::Serialize)]
pub struct VmExecutionStatistics {
/// Number of contracts used by the VM during the tx execution.
pub contracts_used: usize,
Expand Down
2 changes: 1 addition & 1 deletion core/lib/multivm/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![deny(unused_crate_dependencies)]
// #![deny(unused_crate_dependencies)]
#![warn(unused_extern_crates)]
#![warn(unused_imports)]

Expand Down
Loading
Loading