Skip to content
Closed
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
10 changes: 5 additions & 5 deletions crates/context/interface/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,6 @@ pub enum EVMError<DBError, TransactionError = InvalidTransaction> {
///
/// Useful for handler registers where custom logic would want to return their own custom error.
Custom(String),
/// Precompile error
Precompile(String),
}

impl<DBError: DBErrorMarker, TX> From<DBError> for EVMError<DBError, TX> {
Expand Down Expand Up @@ -236,7 +234,7 @@ impl<DBError, TransactionValidationErrorT> EVMError<DBError, TransactionValidati
Self::Transaction(e) => EVMError::Transaction(e),
Self::Header(e) => EVMError::Header(e),
Self::Database(e) => EVMError::Database(op(e)),
Self::Precompile(e) => EVMError::Precompile(e),
// Self::Precompile(e) => EVMError::Precompile(e),
Self::Custom(e) => EVMError::Custom(e),
}
}
Expand All @@ -253,7 +251,8 @@ where
Self::Transaction(e) => Some(e),
Self::Header(e) => Some(e),
Self::Database(e) => Some(e),
Self::Precompile(_) | Self::Custom(_) => None,
// Self::Precompile(_) | Self::Custom(_) => None,
Self::Custom(_) => None,
}
}
}
Expand All @@ -269,7 +268,8 @@ where
Self::Transaction(e) => write!(f, "transaction validation error: {e}"),
Self::Header(e) => write!(f, "header validation error: {e}"),
Self::Database(e) => write!(f, "database error: {e}"),
Self::Precompile(e) | Self::Custom(e) => f.write_str(e),
// Self::Precompile(e) | Self::Custom(e) => f.write_str(e),
Self::Custom(e) => f.write_str(e),
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions crates/handler/src/frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ where
InterpreterTypes = EthInterpreter,
>,
>,
ERROR: From<ContextTrDbError<EVM::Context>> + From<PrecompileError> + FromStringError,
ERROR: From<ContextTrDbError<EVM::Context>> + FromStringError,
{
type Evm = EVM;
type FrameInit = FrameInput;
Expand Down Expand Up @@ -151,7 +151,7 @@ where
Precompiles: PrecompileProvider<EVM::Context, Output = InterpreterResult>,
Instructions: InstructionProvider,
>,
ERROR: From<ContextTrDbError<EVM::Context>> + From<PrecompileError>,
ERROR: From<ContextTrDbError<EVM::Context>>,
{
/// Make call frame
#[inline]
Expand Down Expand Up @@ -522,7 +522,7 @@ where
InterpreterTypes = EthInterpreter,
>,
>,
ERROR: From<ContextTrDbError<EVM::Context>> + From<PrecompileError> + FromStringError,
ERROR: From<ContextTrDbError<EVM::Context>> + FromStringError,
{
pub fn init_first(
evm: &mut EVM,
Expand Down
2 changes: 0 additions & 2 deletions crates/handler/src/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub trait EvmTrError<EVM: EvmTr>:
From<InvalidTransaction>
+ From<InvalidHeader>
+ From<<<EVM::Context as ContextTr>::Db as Database>::Error>
+ From<PrecompileError>
+ FromStringError
{
}
Expand All @@ -29,7 +28,6 @@ impl<
T: From<InvalidTransaction>
+ From<InvalidHeader>
+ From<<<EVM::Context as ContextTr>::Db as Database>::Error>
+ From<PrecompileError>
+ FromStringError,
> EvmTrError<EVM> for T
{
Expand Down
8 changes: 4 additions & 4 deletions crates/handler/src/precompile_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub trait PrecompileProvider<CTX: ContextTr> {
address: &Address,
bytes: &Bytes,
gas_limit: u64,
) -> Result<Option<Self::Output>, PrecompileError>;
) -> Result<Option<Self::Output>, String>;

/// Get the warm addresses.
fn warm_addresses(&self) -> Box<impl Iterator<Item = Address>>;
Expand Down Expand Up @@ -76,7 +76,7 @@ impl<CTX: ContextTr> PrecompileProvider<CTX> for EthPrecompiles {
address: &Address,
bytes: &Bytes,
gas_limit: u64,
) -> Result<Option<InterpreterResult>, PrecompileError> {
) -> Result<Option<InterpreterResult>, String> {
let Some(precompile) = self.precompiles.get(address) else {
return Ok(None);
};
Expand All @@ -95,8 +95,8 @@ impl<CTX: ContextTr> PrecompileProvider<CTX> for EthPrecompiles {
result.output = output.bytes;
}
Err(e) => {
if let PrecompileError::Fatal(_) = e {
return Err(e);
if let PrecompileError::Fatal(msg) = e {
return Err(msg);
}
result.result = if e.is_oog() {
InstructionResult::PrecompileOOG
Expand Down
2 changes: 1 addition & 1 deletion crates/inspector/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ where
InterpreterTypes = EthInterpreter,
>,
> + InspectorEvmTr,
ERROR: From<ContextTrDbError<EVM::Context>> + From<PrecompileError> + FromStringError,
ERROR: From<ContextTrDbError<EVM::Context>> + FromStringError,
{
type IT = EthInterpreter;

Expand Down
1 change: 0 additions & 1 deletion examples/erc20_gas/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ where
ERROR: From<InvalidTransaction>
+ From<InvalidHeader>
+ From<<CTX::Db as Database>::Error>
+ From<PrecompileError>,
{
let sender_balance_slot = erc_address_storage(sender);
let sender_balance = context.journal().sload(TOKEN, sender_balance_slot)?.data;
Expand Down
Loading