From a1ad029f3847bb5be26a97041d2265c0100f1f0e Mon Sep 17 00:00:00 2001 From: Danil Date: Tue, 3 Oct 2023 14:03:42 +0200 Subject: [PATCH] Fix tests Signed-off-by: Danil --- CODEOWNERS | 1 + core/lib/vm/src/errors/halt.rs | 1 + core/lib/vm/src/implementation/execution.rs | 5 +++-- core/lib/vm/src/tracers/default_tracers.rs | 5 +++-- .../zksync_core/src/api_server/execution_sandbox/error.rs | 2 +- .../zksync_core/src/api_server/execution_sandbox/validate.rs | 2 +- 6 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 12cd26187090..981a2db39116 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -2,3 +2,4 @@ .github/release-please/** @RomanBrodetski @perekopskiy @Deniallugo @popzxc **/CHANGELOG.md @RomanBrodetski @perekopskiy @Deniallugo @popzxc CODEOWNERS @RomanBrodetski @perekopskiy @Deniallugo @popzxc +.github/workflows/** @matter-labs/devops diff --git a/core/lib/vm/src/errors/halt.rs b/core/lib/vm/src/errors/halt.rs index 3d0eedcc0318..0a5057a0616f 100644 --- a/core/lib/vm/src/errors/halt.rs +++ b/core/lib/vm/src/errors/halt.rs @@ -26,6 +26,7 @@ pub enum Halt { UnexpectedVMBehavior(String), // Bootloader is out of gas. BootloaderOutOfGas, + // Validation step is out of gas ValidationOutOfGas, // Transaction has a too big gas limit and will not be executed by the server. TooBigGasLimit, diff --git a/core/lib/vm/src/implementation/execution.rs b/core/lib/vm/src/implementation/execution.rs index 17001f95f155..52c4ff0cb0da 100644 --- a/core/lib/vm/src/implementation/execution.rs +++ b/core/lib/vm/src/implementation/execution.rs @@ -5,9 +5,10 @@ use crate::old_vm::{ history_recorder::HistoryMode, utils::{vm_may_have_ended_inner, VmExecutionResult}, }; -use crate::tracers::traits::TracerExecutionStatus; use crate::tracers::{ - traits::{BoxedTracer, ExecutionEndTracer, ExecutionProcessing, VmTracer}, + traits::{ + BoxedTracer, ExecutionEndTracer, ExecutionProcessing, TracerExecutionStatus, VmTracer, + }, DefaultExecutionTracer, RefundsTracer, }; use crate::types::{inputs::VmExecutionMode, outputs::VmExecutionResultAndLogs}; diff --git a/core/lib/vm/src/tracers/default_tracers.rs b/core/lib/vm/src/tracers/default_tracers.rs index 94f7be4aa311..4df00193265d 100644 --- a/core/lib/vm/src/tracers/default_tracers.rs +++ b/core/lib/vm/src/tracers/default_tracers.rs @@ -164,8 +164,9 @@ impl ExecutionEndTracer for DefaultExecution )); } for tracer in self.custom_tracers.iter() { - if let TracerExecutionStatus::Stop(reason) = tracer.should_stop_execution() { - return TracerExecutionStatus::Stop(reason); + let reason = tracer.should_stop_execution(); + if TracerExecutionStatus::Continue != reason { + return reason; } } TracerExecutionStatus::Continue diff --git a/core/lib/zksync_core/src/api_server/execution_sandbox/error.rs b/core/lib/zksync_core/src/api_server/execution_sandbox/error.rs index 4d792d186cae..b4f04e2e5d60 100644 --- a/core/lib/zksync_core/src/api_server/execution_sandbox/error.rs +++ b/core/lib/zksync_core/src/api_server/execution_sandbox/error.rs @@ -62,7 +62,7 @@ impl From for SandboxExecutionError { SandboxExecutionError::Revert(reason, vec![]) } Halt::TracerCustom(reason) => SandboxExecutionError::Revert(reason, vec![]), - Halt::ValidationOutOfGas => Self::UnexpectedVMBehavior( + Halt::ValidationOutOfGas => Self::AccountValidationFailed( "The validation of the transaction ran out of gas".to_string(), ), } diff --git a/core/lib/zksync_core/src/api_server/execution_sandbox/validate.rs b/core/lib/zksync_core/src/api_server/execution_sandbox/validate.rs index 05eb7f3ce2d9..2dd5ae7b9c25 100644 --- a/core/lib/zksync_core/src/api_server/execution_sandbox/validate.rs +++ b/core/lib/zksync_core/src/api_server/execution_sandbox/validate.rs @@ -86,8 +86,8 @@ impl TxSharedArgs { ]); let result = match (result.result, validation_result.get()) { - (ExecutionResult::Halt { reason }, _) => Err(ValidationError::FailedTx(reason)), (_, Some(err)) => Err(ValidationError::ViolatedRule(err.clone())), + (ExecutionResult::Halt { reason }, _) => Err(ValidationError::FailedTx(reason)), (_, None) => Ok(()), };