@@ -7,7 +7,7 @@ mod report;
77
88/// Equality rpc test error
99enum TestError {
10- Diff { rpc1 : serde_json:: Value , rpc2 : serde_json:: Value } ,
10+ Diff { rpc1 : serde_json:: Value , rpc2 : serde_json:: Value , args : Option < String > } ,
1111 Rpc1Err ( String ) ,
1212 Rpc2Err ( String ) ,
1313}
@@ -21,54 +21,61 @@ type MethodName = String;
2121/// Provider macro that boxes all method future results.
2222#[ macro_export]
2323macro_rules! rpc {
24- ( $self: expr, $method: ident $( , $args: expr ) * ) => {
24+ ( $self: expr, $method: ident $( , $args: expr ) * ) => { {
25+ let args_str = Some ( format!( "{}" , [ $( format!( "{:?}" , $args) ) ,* ] . join( ", " ) ) ) ;
2526 Box :: pin( $self. test_rpc_call(
2627 stringify!( $method) ,
28+ args_str,
2729 move |provider: & P | {
2830 provider. $method( $( $args. clone( ) , ) * )
2931 }
3032 ) ) as Pin <Box <dyn Future <Output = ( MethodName , Result <( ) , TestError >) > + Send >>
31- } ;
33+ } } ;
3234}
3335
3436/// Provider macro to call methods that return `RpcWithBlock` and box the future results.
3537#[ macro_export]
3638macro_rules! rpc_with_block {
37- ( $self: expr, $method: ident $( , $args: expr ) * ; $blockid: expr) => {
39+ ( $self: expr, $method: ident $( , $args: expr ) * ; $blockid: expr) => { {
40+ let args_str = Some ( format!( "{}, block_id: {:?}" , [ $( format!( "{:?}" , $args) ) ,* ] . join( ", " ) , $blockid) ) ;
3841 Box :: pin( $self. test_rpc_call(
3942 stringify!( $method) ,
43+ args_str,
4044 move |provider: & P | {
4145 provider. $method( $( $args. clone( ) , ) * ) . block_id( $blockid) . into_future( )
4246 }
4347 ) ) as Pin <Box <dyn Future <Output = ( MethodName , Result <( ) , TestError >) > + Send >>
44- } ;
48+ } } ;
4549}
4650
4751/// Macro to call the `get_logs` rpc method and box the future result.
4852#[ macro_export]
4953macro_rules! get_logs {
50- ( $self: expr, $arg: expr) => {
54+ ( $self: expr, $arg: expr) => { {
55+ let args_str = Some ( format!( "{:?}" , $arg) ) ;
5156 Box :: pin( async move {
5257 let filter = $arg. clone( ) ;
5358 $self
54- . test_rpc_call( stringify!( get_logs) , move |provider: & P | {
59+ . test_rpc_call( stringify!( get_logs) , args_str , move |provider: & P | {
5560 let filter = filter. clone( ) ;
5661 async move { provider. get_logs( & filter) . await }
5762 } )
5863 . await
5964 } ) as Pin <Box <dyn Future <Output = ( MethodName , Result <( ) , TestError >) > + Send >>
60- } ;
65+ } } ;
6166}
6267
6368/// Macro to create raw request and box the future result.
6469#[ macro_export]
6570macro_rules! rpc_raw {
66- ( $self: expr, $method: ident, $ret: ident $( , $args: expr ) * ) => {
71+ ( $self: expr, $method: ident, $ret: ident $( , $args: expr ) * ) => { {
72+ let args_str = Some ( format!( "{}" , [ $( format!( "{:?}" , $args) ) ,* ] . join( ", " ) ) ) ;
6773 Box :: pin( $self. test_rpc_call(
6874 stringify!( $method) ,
75+ args_str,
6976 move |provider: & P | {
7077 provider. raw_request:: <_, $ret>( stringify!( $method) . into( ) , $( $args. clone( ) , ) * )
7178 }
7279 ) ) as Pin <Box <dyn Future <Output = ( MethodName , Result <( ) , TestError >) > + Send >>
73- } ;
80+ } } ;
7481}
0 commit comments