mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
chore(executor): add tx hash to evm error (#1714)
This commit is contained in:
@ -376,12 +376,13 @@ where
|
|||||||
// Fill revm structure.
|
// Fill revm structure.
|
||||||
fill_tx_env(&mut self.evm.env.tx, transaction, sender);
|
fill_tx_env(&mut self.evm.env.tx, transaction, sender);
|
||||||
|
|
||||||
let out = if self.stack.should_inspect(&self.evm.env, transaction.hash()) {
|
let hash = transaction.hash();
|
||||||
|
let out = if self.stack.should_inspect(&self.evm.env, hash) {
|
||||||
// execution with inspector.
|
// execution with inspector.
|
||||||
let output = self.evm.inspect(&mut self.stack);
|
let output = self.evm.inspect(&mut self.stack);
|
||||||
tracing::trace!(
|
tracing::trace!(
|
||||||
target: "evm",
|
target: "evm",
|
||||||
hash = ?transaction.hash(), ?output, ?transaction, env = ?self.evm.env,
|
?hash, ?output, ?transaction, env = ?self.evm.env,
|
||||||
"Executed transaction"
|
"Executed transaction"
|
||||||
);
|
);
|
||||||
output
|
output
|
||||||
@ -389,7 +390,7 @@ where
|
|||||||
// main execution.
|
// main execution.
|
||||||
self.evm.transact()
|
self.evm.transact()
|
||||||
};
|
};
|
||||||
out.map_err(|e| Error::EVM(format!("{e:?}")))
|
out.map_err(|e| Error::EVM { hash, message: format!("{e:?}") })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Runs the provided transactions and commits their state. Will proceed
|
/// Runs the provided transactions and commits their state. Will proceed
|
||||||
|
|||||||
@ -5,8 +5,8 @@ use thiserror::Error;
|
|||||||
#[allow(missing_docs)]
|
#[allow(missing_docs)]
|
||||||
#[derive(Error, Debug, Clone, PartialEq, Eq)]
|
#[derive(Error, Debug, Clone, PartialEq, Eq)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
#[error("EVM reported invalid transaction:{0}")]
|
#[error("EVM reported invalid transaction ({hash:?}): {message}")]
|
||||||
EVM(String),
|
EVM { hash: H256, message: String },
|
||||||
#[error("Example of error.")]
|
#[error("Example of error.")]
|
||||||
VerificationFailed,
|
VerificationFailed,
|
||||||
#[error("Fatal internal error")]
|
#[error("Fatal internal error")]
|
||||||
|
|||||||
Reference in New Issue
Block a user