mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-13 23:21:04 +00:00
the state diff method belongs to node interactions (#20)
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
//! This crate implements all node interactions.
|
//! This crate implements all node interactions.
|
||||||
|
|
||||||
use alloy::rpc::types::trace::geth::GethTrace;
|
use alloy::rpc::types::trace::geth::{DiffMode, GethTrace};
|
||||||
use alloy::rpc::types::{TransactionReceipt, TransactionRequest};
|
use alloy::rpc::types::{TransactionReceipt, TransactionRequest};
|
||||||
use tokio_runtime::TO_TOKIO;
|
use tokio_runtime::TO_TOKIO;
|
||||||
|
|
||||||
@@ -18,4 +18,7 @@ pub trait EthereumNode {
|
|||||||
|
|
||||||
/// Trace the transaction in the [TransactionReceipt] and return a [GethTrace].
|
/// Trace the transaction in the [TransactionReceipt] and return a [GethTrace].
|
||||||
fn trace_transaction(&self, transaction: TransactionReceipt) -> anyhow::Result<GethTrace>;
|
fn trace_transaction(&self, transaction: TransactionReceipt) -> anyhow::Result<GethTrace>;
|
||||||
|
|
||||||
|
/// Returns the state diff of the transaction hash in the [TransactionReceipt].
|
||||||
|
fn state_diff(&self, transaction: TransactionReceipt) -> anyhow::Result<DiffMode>;
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-13
@@ -185,6 +185,19 @@ impl EthereumNode for Instance {
|
|||||||
.await?)
|
.await?)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn state_diff(
|
||||||
|
&self,
|
||||||
|
transaction: alloy::rpc::types::TransactionReceipt,
|
||||||
|
) -> anyhow::Result<DiffMode> {
|
||||||
|
match self
|
||||||
|
.trace_transaction(transaction)?
|
||||||
|
.try_into_pre_state_frame()?
|
||||||
|
{
|
||||||
|
PreStateFrame::Diff(diff) => Ok(diff),
|
||||||
|
_ => anyhow::bail!("expected a diff mode trace"),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Node for Instance {
|
impl Node for Instance {
|
||||||
@@ -219,19 +232,6 @@ impl Node for Instance {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn state_diff(
|
|
||||||
&self,
|
|
||||||
transaction: alloy::rpc::types::TransactionReceipt,
|
|
||||||
) -> anyhow::Result<DiffMode> {
|
|
||||||
match self
|
|
||||||
.trace_transaction(transaction)?
|
|
||||||
.try_into_pre_state_frame()?
|
|
||||||
{
|
|
||||||
PreStateFrame::Diff(diff) => Ok(diff),
|
|
||||||
_ => anyhow::bail!("expected a diff mode trace"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn version(&self) -> anyhow::Result<String> {
|
fn version(&self) -> anyhow::Result<String> {
|
||||||
let output = Command::new(&self.geth)
|
let output = Command::new(&self.geth)
|
||||||
.arg("--version")
|
.arg("--version")
|
||||||
|
|||||||
@@ -279,6 +279,16 @@ impl EthereumNode for KitchensinkNode {
|
|||||||
.await?)
|
.await?)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn state_diff(&self, transaction: TransactionReceipt) -> anyhow::Result<DiffMode> {
|
||||||
|
match self
|
||||||
|
.trace_transaction(transaction)?
|
||||||
|
.try_into_pre_state_frame()?
|
||||||
|
{
|
||||||
|
PreStateFrame::Diff(diff) => Ok(diff),
|
||||||
|
_ => anyhow::bail!("expected a diff mode trace"),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Node for KitchensinkNode {
|
impl Node for KitchensinkNode {
|
||||||
@@ -317,16 +327,6 @@ impl Node for KitchensinkNode {
|
|||||||
self.init(&genesis)?.spawn_process()
|
self.init(&genesis)?.spawn_process()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn state_diff(&self, transaction: TransactionReceipt) -> anyhow::Result<DiffMode> {
|
|
||||||
match self
|
|
||||||
.trace_transaction(transaction)?
|
|
||||||
.try_into_pre_state_frame()?
|
|
||||||
{
|
|
||||||
PreStateFrame::Diff(diff) => Ok(diff),
|
|
||||||
_ => anyhow::bail!("expected a diff mode trace"),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn version(&self) -> anyhow::Result<String> {
|
fn version(&self) -> anyhow::Result<String> {
|
||||||
let output = Command::new(&self.substrate_binary)
|
let output = Command::new(&self.substrate_binary)
|
||||||
.arg("--version")
|
.arg("--version")
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
//! This crate implements the testing nodes.
|
//! This crate implements the testing nodes.
|
||||||
|
|
||||||
use alloy::rpc::types::{TransactionReceipt, trace::geth::DiffMode};
|
|
||||||
use revive_dt_config::Arguments;
|
use revive_dt_config::Arguments;
|
||||||
use revive_dt_node_interaction::EthereumNode;
|
use revive_dt_node_interaction::EthereumNode;
|
||||||
|
|
||||||
@@ -29,9 +28,6 @@ pub trait Node: EthereumNode {
|
|||||||
/// Returns the nodes connection string.
|
/// Returns the nodes connection string.
|
||||||
fn connection_string(&self) -> String;
|
fn connection_string(&self) -> String;
|
||||||
|
|
||||||
/// Returns the state diff of the transaction hash in the [TransactionReceipt].
|
|
||||||
fn state_diff(&self, transaction: TransactionReceipt) -> anyhow::Result<DiffMode>;
|
|
||||||
|
|
||||||
/// Returns the node version.
|
/// Returns the node version.
|
||||||
fn version(&self) -> anyhow::Result<String>;
|
fn version(&self) -> anyhow::Result<String>;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user