mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-11 10:51:03 +00:00
make node interactions generic
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
+31
-5
@@ -10,9 +10,12 @@ use std::{
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use alloy::rpc::types::{
|
||||
TransactionReceipt, TransactionRequest,
|
||||
trace::geth::{DiffMode, PreStateFrame},
|
||||
use alloy::{
|
||||
providers::{Provider, ProviderBuilder, ext::DebugApi},
|
||||
rpc::types::{
|
||||
TransactionReceipt, TransactionRequest,
|
||||
trace::geth::{DiffMode, GethDebugTracingOptions, PreStateConfig, PreStateFrame},
|
||||
},
|
||||
};
|
||||
use revive_dt_config::Arguments;
|
||||
use revive_dt_node_interaction::{
|
||||
@@ -144,14 +147,37 @@ impl EthereumNode for Instance {
|
||||
&self,
|
||||
transaction: TransactionRequest,
|
||||
) -> anyhow::Result<alloy::rpc::types::TransactionReceipt> {
|
||||
execute_transaction(transaction, self.connection_string())
|
||||
let connection_string = self.connection_string();
|
||||
|
||||
execute_transaction(Box::pin(async move {
|
||||
Ok(ProviderBuilder::new()
|
||||
.connect(&connection_string)
|
||||
.await?
|
||||
.send_transaction(transaction)
|
||||
.await?
|
||||
.get_receipt()
|
||||
.await?)
|
||||
}))
|
||||
}
|
||||
|
||||
fn trace_transaction(
|
||||
&self,
|
||||
transaction: TransactionReceipt,
|
||||
) -> anyhow::Result<alloy::rpc::types::trace::geth::GethTrace> {
|
||||
trace_transaction(transaction, Default::default(), self.connection_string())
|
||||
let connection_string = self.connection_string();
|
||||
let trace_options = GethDebugTracingOptions::prestate_tracer(PreStateConfig {
|
||||
diff_mode: Some(true),
|
||||
disable_code: None,
|
||||
disable_storage: None,
|
||||
});
|
||||
|
||||
trace_transaction(Box::pin(async move {
|
||||
Ok(ProviderBuilder::new()
|
||||
.connect(&connection_string)
|
||||
.await?
|
||||
.debug_trace_transaction(transaction.transaction_hash, trace_options)
|
||||
.await?)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ where
|
||||
}
|
||||
|
||||
fn spawn_node<T: Node + Send>(args: &Arguments, genesis: String) -> anyhow::Result<T> {
|
||||
let mut node = T::new(&args);
|
||||
let mut node = T::new(args);
|
||||
log::info!("starting node: {}", node.connection_string());
|
||||
node.spawn(genesis)?;
|
||||
Ok(node)
|
||||
|
||||
Reference in New Issue
Block a user