use alloy_primitives::B256;
use thiserror::Error;
use crate::Stem;
#[derive(Debug, Error)]
pub enum UbtError {
#[error("key not found: {0}")]
KeyNotFound(B256),
#[error("invalid stem length: expected 31 bytes, got {0}")]
InvalidStemLength(usize),
#[error("invalid key length: expected 32 bytes, got {0}")]
InvalidKeyLength(usize),
#[error("tree depth exceeded maximum allowed depth (depth={depth})")]
TreeDepthExceeded { depth: usize },
#[error("stem collision at {0:?}")]
StemCollision(Stem),
#[error("invalid proof: {0}")]
InvalidProof(String),
#[error("code size {0} exceeds maximum allowed size")]
CodeTooLarge(usize),
#[error("invalid code chunk at index {0}")]
InvalidCodeChunk(usize),
#[error("account not found: {0}")]
AccountNotFound(alloy_primitives::Address),
#[error("storage slot {slot} not found for account {account}")]
StorageNotFound {
account: alloy_primitives::Address,
slot: alloy_primitives::U256,
},
}
pub type Result<T> = std::result::Result<T, UbtError>;