diff --git a/crates/primitives/src/precompile.rs b/crates/primitives/src/precompile.rs index ee75d84c88..9ab05372f0 100644 --- a/crates/primitives/src/precompile.rs +++ b/crates/primitives/src/precompile.rs @@ -1,7 +1,7 @@ use crate::{Bytes, Env}; use core::fmt; use dyn_clone::DynClone; -use std::{boxed::Box, sync::Arc}; +use std::{boxed::Box, string::String, sync::Arc}; /// A precompile operation result. /// @@ -125,6 +125,14 @@ pub enum PrecompileError { BlobMismatchedVersion, /// The proof verification failed. BlobVerifyKzgProofFailed, + /// Catch-all variant for other errors. + Other(String), +} + +impl PrecompileError { + pub fn other(err: impl Into) -> Self { + Self::Other(err.into()) + } } #[cfg(feature = "std")] @@ -153,6 +161,9 @@ impl fmt::Display for PrecompileError { PrecompileError::BlobVerifyKzgProofFailed => { write!(f, "verifying blob kzg proof failed") } + PrecompileError::Other(why) => { + write!(f, "other precompile error: {why}") + } } } }