initialize geth via the standard json

Signed-off-by: xermicus <bigcyrill@hotmail.com>
This commit is contained in:
xermicus
2025-03-23 00:05:53 +01:00
parent f9a0542d49
commit 6cd4519d89
15 changed files with 228 additions and 64 deletions
+2 -3
View File
@@ -2,15 +2,14 @@
use alloy::rpc::types::trace::geth::GethTrace;
use alloy::rpc::types::{TransactionReceipt, TransactionRequest};
use revive_dt_node::Node;
use tokio_runtime::TO_TOKIO;
mod tokio_runtime;
pub mod trace;
pub mod transaction;
/// An interface for all node interactions.
pub trait NodeInteraction: Node {
/// An interface for all interactions with Ethereum compatible nodes.
pub trait EthereumNode {
/// Execute the [TransactionRequest] and return a [TransactionReceipt].
fn execute_transaction(
&self,
+3 -4
View File
@@ -5,7 +5,6 @@ use alloy::providers::ProviderBuilder;
use alloy::providers::ext::DebugApi;
use alloy::rpc::types::TransactionReceipt;
use alloy::rpc::types::trace::geth::{GethDebugTracingOptions, GethTrace};
use revive_dt_node::Node;
use tokio::sync::mpsc;
use crate::TO_TOKIO;
@@ -37,10 +36,10 @@ impl AsyncNodeInteraction for Trace {
/// Trace the transaction in [TransactionReceipt] against the `node`,
/// using the provided [GethDebugTracingOptions].
pub fn trace_transaction<T: Node>(
pub fn trace_transaction(
transaction_receipt: TransactionReceipt,
options: GethDebugTracingOptions,
node: &T,
connection_string: String,
) -> anyhow::Result<GethTrace> {
let trace_sender = TO_TOKIO.lock().unwrap().trace_sender.clone();
let (geth_trace_sender, mut geth_trace_receiver) = mpsc::channel(1);
@@ -49,7 +48,7 @@ pub fn trace_transaction<T: Node>(
transaction_hash: transaction_receipt.transaction_hash,
options,
geth_trace_sender,
connection_string: node.connection_string(),
connection_string,
})?;
geth_trace_receiver
+3 -4
View File
@@ -2,7 +2,6 @@
use alloy::providers::{Provider, ProviderBuilder};
use alloy::rpc::types::{TransactionReceipt, TransactionRequest};
use revive_dt_node::Node;
use tokio::sync::mpsc;
use crate::TO_TOKIO;
@@ -34,9 +33,9 @@ impl AsyncNodeInteraction for Transaction {
}
/// Execute the [TransactionRequest] against the `node`.
pub fn execute_transaction<T: Node>(
pub fn execute_transaction(
transaction_request: TransactionRequest,
node: &T,
connection_string: String,
) -> anyhow::Result<TransactionReceipt> {
let request_sender = TO_TOKIO.lock().unwrap().transaction_sender.clone();
let (receipt_sender, mut receipt_receiver) = mpsc::channel(1);
@@ -44,7 +43,7 @@ pub fn execute_transaction<T: Node>(
request_sender.blocking_send(Transaction {
transaction_request,
receipt_sender,
connection_string: node.connection_string(),
connection_string,
})?;
receipt_receiver