sp1_core_executor/
errors.rs1use deepsize2::DeepSizeOf;
4use serde::{Deserialize, Serialize};
5use thiserror::Error;
6
7use crate::Opcode;
8
9#[derive(Error, Debug, Serialize, Deserialize, PartialEq, Eq, Clone, Copy, DeepSizeOf)]
11pub enum TrapError {
12 #[error("Page permission violation error, code: {0}")]
14 PagePermissionViolation(u64),
15}
16
17#[derive(Clone, Error, Debug, Serialize, Deserialize, PartialEq, Eq)]
19pub enum ExecutionError {
20 #[error("invalid memory access for opcode {0} and address {1}")]
22 InvalidMemoryAccess(Opcode, u64),
23
24 #[error("invalid memory access for untrusted program at address {0}, not aligned to 4 bytes")]
26 InvalidMemoryAccessUntrustedProgram(u64),
27
28 #[error("unimplemented syscall {0}")]
30 UnsupportedSyscall(u32),
31
32 #[error("breakpoint encountered")]
34 Breakpoint(),
35
36 #[error("exceeded cycle limit of {0}")]
38 ExceededCycleLimit(u64),
39
40 #[error("syscall called in unconstrained mode")]
42 InvalidSyscallUsage(u64),
43
44 #[error("got unimplemented as opcode")]
46 Unimplemented(),
47
48 #[error("program ended in unconstrained mode")]
50 EndInUnconstrained(),
51
52 #[error("unconstrained cycle limit exceeded")]
54 UnconstrainedCycleLimitExceeded(u64),
55
56 #[error("Unexpected exit code: {0}")]
58 UnexpectedExitCode(u32),
59
60 #[error("Instruction not found, page protect/ untrusted program set to off")]
62 InstructionNotFound(),
63
64 #[error("Running executor in non-sharding state, but got a shard boundary or trace end")]
66 InvalidShardingState(),
67
68 #[error("Trap occurred without proper handling")]
70 UnhandledTrap(TrapError),
71
72 #[error("SP1 program consumes too much memory")]
74 TooMuchMemory(),
75
76 #[error("{0}")]
78 Other(String),
79}