File tree Expand file tree Collapse file tree 4 files changed +27
-28
lines changed
Expand file tree Collapse file tree 4 files changed +27
-28
lines changed Original file line number Diff line number Diff line change 11//! This crate implements all node interactions.
22
3- use alloy:: rpc:: types:: trace:: geth:: GethTrace ;
3+ use alloy:: rpc:: types:: trace:: geth:: { DiffMode , GethTrace } ;
44use alloy:: rpc:: types:: { TransactionReceipt , TransactionRequest } ;
55use tokio_runtime:: TO_TOKIO ;
66
@@ -18,4 +18,7 @@ pub trait EthereumNode {
1818
1919 /// Trace the transaction in the [TransactionReceipt] and return a [GethTrace].
2020 fn trace_transaction ( & self , transaction : TransactionReceipt ) -> anyhow:: Result < GethTrace > ;
21+
22+ /// Returns the state diff of the transaction hash in the [TransactionReceipt].
23+ fn state_diff ( & self , transaction : TransactionReceipt ) -> anyhow:: Result < DiffMode > ;
2124}
Original file line number Diff line number Diff line change @@ -185,6 +185,19 @@ impl EthereumNode for Instance {
185185 . await ?)
186186 } ) )
187187 }
188+
189+ fn state_diff (
190+ & self ,
191+ transaction : alloy:: rpc:: types:: TransactionReceipt ,
192+ ) -> anyhow:: Result < DiffMode > {
193+ match self
194+ . trace_transaction ( transaction) ?
195+ . try_into_pre_state_frame ( ) ?
196+ {
197+ PreStateFrame :: Diff ( diff) => Ok ( diff) ,
198+ _ => anyhow:: bail!( "expected a diff mode trace" ) ,
199+ }
200+ }
188201}
189202
190203impl Node for Instance {
@@ -219,19 +232,6 @@ impl Node for Instance {
219232 Ok ( ( ) )
220233 }
221234
222- fn state_diff (
223- & self ,
224- transaction : alloy:: rpc:: types:: TransactionReceipt ,
225- ) -> anyhow:: Result < DiffMode > {
226- match self
227- . trace_transaction ( transaction) ?
228- . try_into_pre_state_frame ( ) ?
229- {
230- PreStateFrame :: Diff ( diff) => Ok ( diff) ,
231- _ => anyhow:: bail!( "expected a diff mode trace" ) ,
232- }
233- }
234-
235235 fn version ( & self ) -> anyhow:: Result < String > {
236236 let output = Command :: new ( & self . geth )
237237 . arg ( "--version" )
Original file line number Diff line number Diff line change @@ -279,6 +279,16 @@ impl EthereumNode for KitchensinkNode {
279279 . await ?)
280280 } ) )
281281 }
282+
283+ fn state_diff ( & self , transaction : TransactionReceipt ) -> anyhow:: Result < DiffMode > {
284+ match self
285+ . trace_transaction ( transaction) ?
286+ . try_into_pre_state_frame ( ) ?
287+ {
288+ PreStateFrame :: Diff ( diff) => Ok ( diff) ,
289+ _ => anyhow:: bail!( "expected a diff mode trace" ) ,
290+ }
291+ }
282292}
283293
284294impl Node for KitchensinkNode {
@@ -317,16 +327,6 @@ impl Node for KitchensinkNode {
317327 self . init ( & genesis) ?. spawn_process ( )
318328 }
319329
320- fn state_diff ( & self , transaction : TransactionReceipt ) -> anyhow:: Result < DiffMode > {
321- match self
322- . trace_transaction ( transaction) ?
323- . try_into_pre_state_frame ( ) ?
324- {
325- PreStateFrame :: Diff ( diff) => Ok ( diff) ,
326- _ => anyhow:: bail!( "expected a diff mode trace" ) ,
327- }
328- }
329-
330330 fn version ( & self ) -> anyhow:: Result < String > {
331331 let output = Command :: new ( & self . substrate_binary )
332332 . arg ( "--version" )
Original file line number Diff line number Diff line change 11//! This crate implements the testing nodes.
22
3- use alloy:: rpc:: types:: { TransactionReceipt , trace:: geth:: DiffMode } ;
43use revive_dt_config:: Arguments ;
54use revive_dt_node_interaction:: EthereumNode ;
65
@@ -29,9 +28,6 @@ pub trait Node: EthereumNode {
2928 /// Returns the nodes connection string.
3029 fn connection_string ( & self ) -> String ;
3130
32- /// Returns the state diff of the transaction hash in the [TransactionReceipt].
33- fn state_diff ( & self , transaction : TransactionReceipt ) -> anyhow:: Result < DiffMode > ;
34-
3531 /// Returns the node version.
3632 fn version ( & self ) -> anyhow:: Result < String > ;
3733}
You can’t perform that action at this time.
0 commit comments