Skip to content
Merged
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#### Upcoming Changes

* Refactor: Remove unused error variants [#1760](https://github.com/lambdaclass/cairo-vm/pull/1760/)

* opt(breaking): Avoid cloning constants when compiling hints [#2208](https://github.com/lambdaclass/cairo-vm/pull/2208)

* dev(BREAKING): Make blake2s API internal [#2265](https://github.com/lambdaclass/cairo-vm/pull/2265)
Expand Down
4 changes: 0 additions & 4 deletions vm/src/types/errors/math_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,10 @@ use crate::types::relocatable::{MaybeRelocatable, Relocatable};
#[derive(Debug, Error, PartialEq)]
pub enum MathError {
// Math functions
#[error("Can't calculate the square root of negative number: {0})")]
SqrtNegative(Box<Felt252>),
#[error("{} is not divisible by {}", (*.0).0, (*.0).1)]
SafeDivFail(Box<(Felt252, Felt252)>),
#[error("{} is not divisible by {}", (*.0).0, (*.0).1)]
SafeDivFailBigInt(Box<(BigInt, BigInt)>),
#[error("{} is not divisible by {}", (*.0).0, (*.0).1)]
SafeDivFailBigUint(Box<(BigUint, BigUint)>),
#[error("{0} is not divisible by {1}")]
SafeDivFailU32(u32, u32),
#[error("{} is not divisible by {}", (*.0).0, (*.0).1)]
Expand Down
4 changes: 0 additions & 4 deletions vm/src/vm/errors/memory_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,10 @@ pub enum MemoryError {
ErrorRetrievingMessage(Box<str>),
#[error("Error verifying given signature")]
ErrorVerifyingSignature,
#[error("Couldn't obtain a mutable accessed offset")]
CantGetMutAccessedOffset,
#[error("ECDSA builtin: Expected public key at address {0} to be an integer")]
PubKeyNonInt(Box<Relocatable>),
#[error("ECDSA builtin: Expected message hash at address {0} to be an integer")]
MsgNonInt(Box<Relocatable>),
#[error("Failed to convert String: {0} to FieldElement")]
FailedStringToFieldElementConversion(Box<str>),
#[error("Failed to fetch {} return values, ap is only {}", (*.0).0, (*.0).1)]
FailedToGetReturnValues(Box<(usize, Relocatable)>),
#[error("Segment {} has {} amount of accessed addresses but its size is only {}.", (*.0).0, (*.0).1, (*.0).2)]
Expand Down
16 changes: 0 additions & 16 deletions vm/src/vm/errors/runner_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ pub enum RunnerError {
MemoryValidationError(MemoryError),
#[error("Memory loading failed during state initialization: {0}")]
MemoryInitializationError(MemoryError),
#[error("Failed to convert string to FieldElement")]
FailedStringConversion,
#[error("EcOpBuiltin: m should be at most {0}")]
EcOpBuiltinScalarLimit(Box<Felt252>),
#[error("Given builtins are not in appropiate order")]
DisorderedBuiltins,
#[error("Expected integer at address {:?} to be smaller than 2^{}, Got {}", (*.0).0, (*.0).1, (*.0).2)]
Expand Down Expand Up @@ -62,28 +58,16 @@ pub enum RunnerError {
NoProgramStart,
#[error("Running in proof-mode but no __end__ label found, try compiling with proof-mode")]
NoProgramEnd,
#[error("Could not convert slice to array")]
SliceToArrayError,
#[error("Cannot add the return values to the public memory after segment finalization.")]
FailedAddingReturnValues,
#[error("Missing execution public memory")]
NoExecPublicMemory,
#[error("Coulnd't parse prime from felt lib")]
CouldntParsePrime,
#[error("Could not convert vec with Maybe Relocatables into u64 array")]
MaybeRelocVecToU64ArrayError,
#[error("Expected Integer value, got Relocatable instead")]
FoundNonInt,
#[error(transparent)]
Memory(#[from] MemoryError),
#[error(transparent)]
Math(#[from] MathError),
#[error("keccak_builtin: Failed to get first input address")]
KeccakNoFirstInput,
#[error("{}: Expected integer at address {}", (*.0).0, (*.0).1)]
BuiltinExpectedInteger(Box<(BuiltinName, Relocatable)>),
#[error("keccak_builtin: Failed to convert input cells to u64 values")]
KeccakInputCellsNotU64,
#[error("Unexpected ret_fp_segment size")]
UnexpectedRetFpSegmentSize,
#[error("Unexpected ret_pc_segment size")]
Expand Down
17 changes: 1 addition & 16 deletions vm/src/vm/errors/vm_errors.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// The `(*.0).0` syntax of thiserror falsely triggers this clippy warning
#![allow(clippy::explicit_auto_deref)]

use crate::stdlib::prelude::*;
use crate::types::builtin_name::BuiltinName;
use crate::{stdlib::prelude::*, Felt252};

use thiserror::Error;

use crate::Felt252;
use crate::{
types::{
errors::math_errors::MathError,
Expand Down Expand Up @@ -80,12 +79,8 @@ pub enum VirtualMachineError {
InvalidOpcode(u128),
#[error("Invalid opcode extension value: {0}")]
InvalidOpcodeExtension(u128),
#[error("This is not implemented")]
NotImplemented,
#[error("Inconsistent auto-deduction for {}, expected {}, got {:?}", (*.0).0, (*.0).1, (*.0).2)]
InconsistentAutoDeduction(Box<(BuiltinName, MaybeRelocatable, Option<MaybeRelocatable>)>),
#[error("Invalid hint encoding at pc: {0}")]
InvalidHintEncoding(Box<MaybeRelocatable>),
#[error("Expected output builtin to be present")]
NoOutputBuiltin,
#[error("Expected range_check builtin to be present")]
Expand All @@ -94,14 +89,10 @@ pub enum VirtualMachineError {
NoSignatureBuiltin,
#[error("Expected {0} to be present")]
NoModBuiltin(BuiltinName),
#[error("Div out of range: 0 < {} <= {}", (*.0).0, (*.0).1)]
OutOfValidRange(Box<(Felt252, Felt252)>),
#[error("Failed to compare {} and {}, cant compare a relocatable to an integer value", (*.0).0, (*.0).1)]
DiffTypeComparison(Box<(MaybeRelocatable, MaybeRelocatable)>),
#[error("Failed to compare {} and {}, cant compare two relocatable values of different segment indexes", (*.0).0, (*.0).1)]
DiffIndexComp(Box<(Relocatable, Relocatable)>),
#[error("Couldn't convert usize to u32")]
NoneInMemoryRange,
#[error("Expected integer, found: {0:?}")]
ExpectedIntAtRange(Box<Option<MaybeRelocatable>>),
#[error("Could not convert slice to array")]
Expand All @@ -112,16 +103,10 @@ pub enum VirtualMachineError {
NoImm,
#[error("Execution reached the end of the program. Requested remaining steps: {0}.")]
EndOfProgram(usize),
#[error("Could not reach the end of the program. Executed steps: {0}.")]
StepsLimit(u64),
#[error("Could not reach the end of the program. RunResources has no remaining steps.")]
UnfinishedExecution,
#[error("Current run is not finished")]
RunNotFinished,
#[error("Invalid argument count, expected {} but got {}", (*.0).0, (*.0).1)]
InvalidArgCount(Box<(usize, usize)>),
#[error("Couldn't parse prime: {0}")]
CouldntParsePrime(Box<str>),
#[error("{HINT_ERROR_STR}{}", (*.0).1)]
Hint(Box<(usize, HintError)>),
#[error("Unexpected Failure")]
Expand Down
Loading