@@ -11,7 +11,7 @@ use builder::config::HostProvider;
11
11
use init4_bin_base:: {
12
12
deps:: {
13
13
metrics:: { counter, histogram} ,
14
- tracing,
14
+ tracing:: { debug , error } ,
15
15
} ,
16
16
init4,
17
17
utils:: { from_env:: FromEnv , signer:: LocalOrAwsConfig } ,
@@ -52,16 +52,17 @@ async fn main() {
52
52
let _guard = init4 ( ) ;
53
53
54
54
let config = Config :: from_env ( ) . unwrap ( ) ;
55
- tracing:: trace!( "connecting to provider" ) ;
55
+ debug ! ( ?config. recipient_address, "connecting to provider" ) ;
56
+
56
57
let provider = config. provider ( ) . await ;
57
58
let recipient_address = config. recipient_address ;
58
59
let sleep_time = config. sleep_time ;
59
60
60
61
loop {
61
- tracing :: debug!( "attempting transaction" ) ;
62
+ debug ! ( ?recipient_address , "attempting transaction" ) ;
62
63
send_transaction ( & provider, recipient_address) . await ;
63
64
64
- tracing :: debug!( sleep_time, "sleeping" ) ;
65
+ debug ! ( sleep_time, "sleeping" ) ;
65
66
tokio:: time:: sleep ( tokio:: time:: Duration :: from_secs ( sleep_time) ) . await ;
66
67
}
67
68
}
@@ -78,18 +79,17 @@ async fn send_transaction(provider: &HostProvider, recipient_address: Address) {
78
79
let dispatch_start_time: Instant = Instant :: now ( ) ;
79
80
80
81
// dispatch the transaction
81
- tracing:: debug!( "dispatching transaction" ) ;
82
82
let result = provider. send_transaction ( tx) . await . unwrap ( ) ;
83
83
84
84
// wait for the transaction to mine
85
85
let receipt = match timeout ( Duration :: from_secs ( 240 ) , result. get_receipt ( ) ) . await {
86
86
Ok ( Ok ( receipt) ) => receipt,
87
87
Ok ( Err ( e) ) => {
88
- tracing :: error!( error = ?e, "failed to get transaction receipt" ) ;
88
+ error ! ( error = ?e, "failed to get transaction receipt" ) ;
89
89
return ;
90
90
}
91
91
Err ( _) => {
92
- tracing :: error!( "timeout waiting for transaction receipt" ) ;
92
+ error ! ( "timeout waiting for transaction receipt" ) ;
93
93
counter ! ( "txn_submitter.tx_timeout" ) . increment ( 1 ) ;
94
94
return ;
95
95
}
@@ -99,6 +99,6 @@ async fn send_transaction(provider: &HostProvider, recipient_address: Address) {
99
99
100
100
// record metrics for how long it took to mine the transaction
101
101
let mine_time = dispatch_start_time. elapsed ( ) . as_secs ( ) ;
102
- tracing :: debug!( success = receipt. status( ) , mine_time, hash, "transaction mined" ) ;
102
+ debug ! ( success = receipt. status( ) , mine_time, hash, "transaction mined" ) ;
103
103
histogram ! ( "txn_submitter.tx_mine_time" ) . record ( mine_time as f64 ) ;
104
104
}
0 commit comments