-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test cleanup #422
Test cleanup #422
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,17 +145,23 @@ pub enum RevmMiddlewareError { | |
|
||
/// The execution of a transaction was reverted, indicating that the | ||
/// transaction was not successful. | ||
#[error("execution failed to succeed due to revert! output is: {cause}")] | ||
#[error("execution failed to succeed due to revert!\n gas used is: {gas_used}\n output is {output:?}")] | ||
ExecutionRevert { | ||
/// Provides the amount of gas used by the transaction. | ||
gas_used: u64, | ||
|
||
/// Provides the output or reason why the transaction was reverted. | ||
cause: String, | ||
output: revm::primitives::Bytes, | ||
}, | ||
|
||
/// The execution of a transaction halted unexpectedly. | ||
#[error("execution failed to succeed due to halt! output is: {cause}")] | ||
#[error("execution failed to succeed due to halt!\n reason is: {reason:?}\n gas used is: {gas_used}")] | ||
ExecutionHalt { | ||
/// Provides the output or reason for the halt. | ||
cause: String, | ||
/// Provides the reason for the halt. | ||
reason: revm::primitives::Halt, | ||
|
||
/// Provides the amount of gas used by the transaction. | ||
gas_used: u64, | ||
}, | ||
} | ||
|
||
|
@@ -167,7 +173,7 @@ impl MiddlewareError for RevmMiddlewareError { | |
} | ||
|
||
fn as_inner(&self) -> Option<&Self::Inner> { | ||
Some(self) | ||
None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain this to me? The middleware onion has been a little black boxed for to only handle it on one layer at a time. |
||
} | ||
} | ||
|
||
|
@@ -280,7 +286,6 @@ impl Middleware for RevmMiddleware { | |
nonce: None, | ||
access_list: Vec::new(), | ||
}; | ||
println!("gotten past creating txenv"); | ||
self.provider() | ||
.as_ref() | ||
.tx_sender | ||
|
@@ -292,7 +297,7 @@ impl Middleware for RevmMiddleware { | |
.map_err(|e| RevmMiddlewareError::Send { | ||
cause: e.to_string(), | ||
})?; | ||
println!("sent to provider"); | ||
|
||
let revm_result = self | ||
.provider() | ||
.as_ref() | ||
|
@@ -308,7 +313,13 @@ impl Middleware for RevmMiddleware { | |
_gas_refunded: _, | ||
logs, | ||
output, | ||
} = unpack_execution_result(revm_result.result)?; | ||
} = match unpack_execution_result(revm_result.result) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice i was wondering about this when i was debugging my issue There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh shit. I don't actually want to do it this way. Doing it with |
||
Ok(success) => success, | ||
Err(e) => { | ||
return Err(e); | ||
} | ||
}; | ||
|
||
match output { | ||
Output::Create(_, address) => { | ||
let address = address.ok_or(RevmMiddlewareError::MissingData { | ||
|
@@ -389,6 +400,7 @@ impl Middleware for RevmMiddleware { | |
.map_err(|e| RevmMiddlewareError::Receive { | ||
cause: e.to_string(), | ||
})?; | ||
|
||
let output = unpack_execution_result(revm_result.result)?.output; | ||
match output { | ||
Output::Create(bytes, ..) => { | ||
|
@@ -417,7 +429,6 @@ impl Middleware for RevmMiddleware { | |
} | ||
FilterKind::Logs(filter) => ("eth_newFilter", filter), | ||
}; | ||
println!("args: {:?}", args); | ||
let filter = args.clone(); | ||
let mut hasher = Sha256::new(); | ||
hasher.update( | ||
|
@@ -574,6 +585,7 @@ pub(crate) struct FilterReceiver { | |
} | ||
|
||
/// Contains the result of a successful transaction execution. | ||
#[derive(Debug)] | ||
struct Success { | ||
_reason: revm::primitives::Eval, | ||
_gas_used: u64, | ||
|
@@ -607,18 +619,12 @@ fn unpack_execution_result( | |
output, | ||
}) | ||
} | ||
ExecutionResult::Revert { gas_used, output } => Err(RevmMiddlewareError::ExecutionRevert { | ||
cause: format!( | ||
"Transaction reverted and used {} gas and output {:?}", | ||
gas_used, output | ||
), | ||
}), | ||
ExecutionResult::Halt { reason, gas_used } => Err(RevmMiddlewareError::ExecutionHalt { | ||
cause: format!( | ||
"Transaction halted for reasond {:?} gas and output {:?}", | ||
reason, gas_used | ||
), | ||
}), | ||
ExecutionResult::Revert { gas_used, output } => { | ||
Err(RevmMiddlewareError::ExecutionRevert { gas_used, output }) | ||
} | ||
ExecutionResult::Halt { reason, gas_used } => { | ||
Err(RevmMiddlewareError::ExecutionHalt { reason, gas_used }) | ||
} | ||
} | ||
} | ||
|
||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remind me why we are doing this again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we don't actually reference the
evm
field ofEnvironment
anywhere else in the crate, so we are safe to keep its visibility to private. I feel it's usually good to minimize visibility to the lowest point.