From 2d3f5397720a9f754e6bd90b8ecf2487fc67e08f Mon Sep 17 00:00:00 2001 From: frisitano Date: Tue, 14 Nov 2023 22:50:44 +0800 Subject: [PATCH] refactor: change err_code to be u64 --- miden/tests/integration/operations/sys_ops.rs | 4 ++-- processor/src/errors.rs | 2 +- processor/src/operations/sys_ops.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/miden/tests/integration/operations/sys_ops.rs b/miden/tests/integration/operations/sys_ops.rs index 987b8185d2..721d82a089 100644 --- a/miden/tests/integration/operations/sys_ops.rs +++ b/miden/tests/integration/operations/sys_ops.rs @@ -1,4 +1,4 @@ -use test_utils::{build_op_test, Felt, TestError}; +use test_utils::{build_op_test, TestError}; // SYSTEM OPS ASSERTIONS - MANUAL TESTS // ================================================================================================ @@ -19,7 +19,7 @@ fn assert_with_code() { test.expect_stack(&[]); // triggered assertion captures both the VM cycle and error code - let expected_err = format!("FailedAssertion(1, BaseElement({}))", Felt::new(123).inner()); + let expected_err = format!("FailedAssertion(1, 123)"); let test = build_op_test!(asm_op, &[0]); test.expect_error(TestError::ExecutionError(&expected_err)); } diff --git a/processor/src/errors.rs b/processor/src/errors.rs index 5c817ba0bd..bca79e2ce7 100644 --- a/processor/src/errors.rs +++ b/processor/src/errors.rs @@ -28,7 +28,7 @@ pub enum ExecutionError { DivideByZero(u32), EventError(String), Ext2InttError(Ext2InttError), - FailedAssertion(u32, Felt), + FailedAssertion(u32, u64), InvalidFmpValue(Felt, Felt), InvalidFriDomainSegment(u64), InvalidFriLayerFolding(QuadFelt, QuadFelt), diff --git a/processor/src/operations/sys_ops.rs b/processor/src/operations/sys_ops.rs index ba62fdb4c8..0d7171a4bc 100644 --- a/processor/src/operations/sys_ops.rs +++ b/processor/src/operations/sys_ops.rs @@ -19,7 +19,7 @@ where /// Returns an error if the popped value is not ONE. pub(super) fn op_assert(&mut self, err_code: Felt) -> Result<(), ExecutionError> { if self.stack.get(0) != ONE { - return Err(ExecutionError::FailedAssertion(self.system.clk(), err_code)); + return Err(ExecutionError::FailedAssertion(self.system.clk(), err_code.as_int())); } self.stack.shift_left(1); Ok(())