mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-07-25 08:15:46 +00:00
Switch to callframe trace for exceptions
This commit is contained in:
@@ -8,7 +8,8 @@ use alloy::network::{Ethereum, TransactionBuilder};
|
|||||||
use alloy::primitives::Bytes;
|
use alloy::primitives::Bytes;
|
||||||
use alloy::rpc::types::TransactionReceipt;
|
use alloy::rpc::types::TransactionReceipt;
|
||||||
use alloy::rpc::types::trace::geth::{
|
use alloy::rpc::types::trace::geth::{
|
||||||
DefaultFrame, GethDebugTracingOptions, GethDefaultTracingOptions, GethTrace, PreStateConfig,
|
CallFrame, GethDebugBuiltInTracerType, GethDebugTracerType, GethDebugTracingOptions, GethTrace,
|
||||||
|
PreStateConfig,
|
||||||
};
|
};
|
||||||
use alloy::{
|
use alloy::{
|
||||||
primitives::Address,
|
primitives::Address,
|
||||||
@@ -399,12 +400,14 @@ where
|
|||||||
.trace_transaction(
|
.trace_transaction(
|
||||||
execution_receipt,
|
execution_receipt,
|
||||||
GethDebugTracingOptions {
|
GethDebugTracingOptions {
|
||||||
config: GethDefaultTracingOptions::default().with_enable_return_data(true),
|
tracer: Some(GethDebugTracerType::BuiltInTracer(
|
||||||
|
GethDebugBuiltInTracerType::CallTracer,
|
||||||
|
)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
)?
|
)?
|
||||||
.try_into_default_frame()
|
.try_into_call_frame()
|
||||||
.expect("Impossible. We can't request default tracing and get some other type back");
|
.expect("Impossible - we requested a callframe trace so we must get it back");
|
||||||
|
|
||||||
for expectation in expectations.iter() {
|
for expectation in expectations.iter() {
|
||||||
self.handle_input_expectation_item(
|
self.handle_input_expectation_item(
|
||||||
@@ -425,7 +428,7 @@ where
|
|||||||
execution_receipt: &TransactionReceipt,
|
execution_receipt: &TransactionReceipt,
|
||||||
node: &T::Blockchain,
|
node: &T::Blockchain,
|
||||||
expectation: &ExpectedOutput,
|
expectation: &ExpectedOutput,
|
||||||
tracing_result: &DefaultFrame,
|
tracing_result: &CallFrame,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
// TODO: We want to respect the compiler version filter on the expected output but would
|
// TODO: We want to respect the compiler version filter on the expected output but would
|
||||||
// require some changes to the interfaces of the compiler and such. So, we add it later.
|
// require some changes to the interfaces of the compiler and such. So, we add it later.
|
||||||
@@ -452,7 +455,7 @@ where
|
|||||||
let expected = expected_calldata
|
let expected = expected_calldata
|
||||||
.calldata(self.deployed_contracts.entry(case_idx).or_default(), node)
|
.calldata(self.deployed_contracts.entry(case_idx).or_default(), node)
|
||||||
.map(Bytes::from)?;
|
.map(Bytes::from)?;
|
||||||
let actual = tracing_result.return_value.clone();
|
let actual = tracing_result.output.clone().unwrap_or_default();
|
||||||
if !expected.starts_with(&actual) {
|
if !expected.starts_with(&actual) {
|
||||||
tracing::error!(?execution_receipt, %expected, %actual, "Calldata assertion failed");
|
tracing::error!(?execution_receipt, %expected, %actual, "Calldata assertion failed");
|
||||||
anyhow::bail!("Calldata assertion failed - Expected {expected} but got {actual}",);
|
anyhow::bail!("Calldata assertion failed - Expected {expected} but got {actual}",);
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ use tokio::{
|
|||||||
runtime::Builder,
|
runtime::Builder,
|
||||||
sync::{mpsc::UnboundedSender, oneshot},
|
sync::{mpsc::UnboundedSender, oneshot},
|
||||||
};
|
};
|
||||||
|
use tracing::Instrument;
|
||||||
|
|
||||||
/// A blocking async executor.
|
/// A blocking async executor.
|
||||||
///
|
///
|
||||||
@@ -63,6 +64,11 @@ impl BlockingExecutor {
|
|||||||
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel::<TaskMessage>();
|
let (tx, mut rx) = tokio::sync::mpsc::unbounded_channel::<TaskMessage>();
|
||||||
|
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
|
tracing::info!(
|
||||||
|
thread_id = ?std::thread::current().id(),
|
||||||
|
"Starting async runtime thread"
|
||||||
|
);
|
||||||
|
|
||||||
let runtime = Builder::new_current_thread()
|
let runtime = Builder::new_current_thread()
|
||||||
.enable_all()
|
.enable_all()
|
||||||
.build()
|
.build()
|
||||||
@@ -107,7 +113,9 @@ impl BlockingExecutor {
|
|||||||
// in the task message. In doing this conversion, we lose some of the type information since
|
// in the task message. In doing this conversion, we lose some of the type information since
|
||||||
// we're converting R => dyn Any. However, we will perform down-casting on the result to
|
// we're converting R => dyn Any. However, we will perform down-casting on the result to
|
||||||
// convert it back into R.
|
// convert it back into R.
|
||||||
let future = Box::pin(async move { Box::new(future.await) as Box<dyn Any + Send> });
|
let future = Box::pin(
|
||||||
|
async move { Box::new(future.await) as Box<dyn Any + Send> }.in_current_span(),
|
||||||
|
);
|
||||||
|
|
||||||
let task = TaskMessage::new(future, response_tx);
|
let task = TaskMessage::new(future, response_tx);
|
||||||
if let Err(error) = STATE.tx.send(task) {
|
if let Err(error) = STATE.tx.send(task) {
|
||||||
|
|||||||
Reference in New Issue
Block a user