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

Remove unused error variants #1760

Draft
wants to merge 6 commits into
base: main
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: 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
15 changes: 0 additions & 15 deletions vm/src/vm/errors/vm_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::types::builtin_name::BuiltinName;

use thiserror_no_std::Error;

use crate::Felt252;
use crate::{
types::{
errors::math_errors::MathError,
Expand Down Expand Up @@ -76,12 +75,8 @@ pub enum VirtualMachineError {
InvalidRes(u64),
#[error("Invalid opcode value: {0}")]
InvalidOpcode(u64),
#[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 @@ -90,14 +85,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 @@ -108,16 +99,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