@@ -135,11 +135,8 @@ impl SubmitTask {
135
135
resp : & SignResponse ,
136
136
block : & BuiltBlock ,
137
137
) -> Result < TransactionRequest , eyre:: Error > {
138
- // Extract the signature components from the response
139
- let ( v, r, s) = extract_signature_components ( & resp. sig ) ;
140
-
141
138
// Create the transaction request with the signature values
142
- let tx: TransactionRequest = self . tx_request ( retry_count, resp, block, v , r , s ) . await ?;
139
+ let tx: TransactionRequest = self . new_tx_request ( retry_count, resp, block) . await ?;
143
140
144
141
// Simulate the transaction with a call to the host provider
145
142
if let Some ( maybe_error) = self . sim_with_call ( & tx) . await {
@@ -202,22 +199,33 @@ impl SubmitTask {
202
199
}
203
200
204
201
/// Creates a transaction request for the blob with the given header and signature values.
205
- async fn tx_request (
202
+ async fn new_tx_request (
206
203
& self ,
207
204
retry_count : usize ,
208
205
resp : & SignResponse ,
209
206
block : & BuiltBlock ,
210
- v : u8 ,
211
- r : FixedBytes < 32 > ,
212
- s : FixedBytes < 32 > ,
213
207
) -> Result < TransactionRequest , eyre:: Error > {
214
208
// TODO: ENG-1082 Implement fills
215
209
let fills = vec ! [ ] ;
216
210
217
- // Bump gas with each retry to replace the previous transaction while maintaining the same nonce
218
- let gas_coefficient = 10 * ( retry_count + 1 ) as u64 ;
219
- let gas_limit = 1_000_000 + ( gas_coefficient * 1_000_000 ) ;
220
- debug ! ( retry_count, gas_coefficient, gas_limit, "calculated gas limit" ) ;
211
+ // Extract the signature components from the response
212
+ let ( v, r, s) = extract_signature_components ( & resp. sig ) ;
213
+
214
+ // Bump gas with each retry to replace the previous
215
+ // transaction while maintaining the same nonce
216
+ // TODO: Clean this up if this works
217
+ let gas_coefficient: u64 = ( 15 * ( retry_count + 1 ) ) . try_into ( ) . unwrap ( ) ;
218
+ let gas_limit: u64 = 1_500_000 + ( gas_coefficient * 1_000_000 ) ;
219
+ let max_priority_fee_per_gas: u128 = ( retry_count as u128 ) ;
220
+ debug ! (
221
+ retry_count,
222
+ gas_coefficient, gas_limit, max_priority_fee_per_gas, "calculated gas limit"
223
+ ) ;
224
+
225
+ // manually retrieve nonce
226
+ let nonce =
227
+ self . provider ( ) . get_transaction_count ( self . provider ( ) . default_signer_address ( ) ) . await ?;
228
+ debug ! ( nonce, "assigned nonce" ) ;
221
229
222
230
// Build the block header
223
231
let header: BlockHeader = BlockHeader {
@@ -229,17 +237,14 @@ impl SubmitTask {
229
237
} ;
230
238
debug ! ( ?header, "built block header" ) ;
231
239
232
- // manually retrieve nonce
233
- let nonce =
234
- self . provider ( ) . get_transaction_count ( self . provider ( ) . default_signer_address ( ) ) . await ?;
235
- debug ! ( nonce, "manually setting transaction nonce" ) ;
236
-
237
240
// Create a blob transaction with the blob header and signature values and return it
238
241
let tx = self
239
242
. build_blob_tx ( fills, header, v, r, s, block) ?
240
243
. with_from ( self . provider ( ) . default_signer_address ( ) )
241
244
. with_to ( self . config . builder_helper_address )
242
- . with_gas_limit ( gas_limit) ;
245
+ . with_gas_limit ( gas_limit)
246
+ . with_max_priority_fee_per_gas ( max_priority_fee_per_gas)
247
+ . with_nonce ( nonce) ;
243
248
244
249
debug ! ( ?tx, "prepared transaction request" ) ;
245
250
Ok ( tx)
@@ -286,14 +291,14 @@ impl SubmitTask {
286
291
}
287
292
288
293
// Okay so the code gets all the way to this log
289
- // but we don't see the tx hash in the logs or in the explorer,
294
+ // but we don't see the tx hash in the logs or in the explorer,
290
295
// not even as a failed TX, just not at all.
291
296
info ! (
292
297
tx_hash = %tx. tx_hash( ) ,
293
298
ru_chain_id = %resp. req. ru_chain_id,
294
299
gas_limit = %resp. req. gas_limit,
295
300
"dispatched to network"
296
- ) ;
301
+ ) ;
297
302
298
303
Ok ( ControlFlow :: Done )
299
304
}
@@ -337,7 +342,6 @@ impl SubmitTask {
337
342
// Retry loop
338
343
let result = loop {
339
344
let span = debug_span ! ( "SubmitTask::retrying_handle_inbound" , retries) ;
340
- debug ! ( retries, "number of retries" ) ;
341
345
342
346
let inbound_result = match self
343
347
. handle_inbound ( retries, block)
@@ -351,17 +355,14 @@ impl SubmitTask {
351
355
Err ( err) => {
352
356
// Log the retry attempt
353
357
retries += 1 ;
354
- error ! ( error = %err, "error handling inbound block" ) ;
355
358
356
359
// Delay until next slot if we get a 403 error
357
- if err. to_string ( ) . contains ( "403" ) {
358
- let ( slot_number, _, end) = self . calculate_slot_window ( ) ?;
359
- let now = self . now ( ) ;
360
- if end > now {
361
- let sleep_duration = std:: time:: Duration :: from_secs ( end - now) ;
362
- debug ! ( sleep_duration = ?sleep_duration, slot_number, "403 detected - sleeping until end of slot" ) ;
363
- tokio:: time:: sleep ( sleep_duration) . await ;
364
- }
360
+ if err. to_string ( ) . contains ( "403 Forbidden" ) {
361
+ let ( slot_number, _, _) = self . calculate_slot_window ( ) ?;
362
+ debug ! ( slot_number, ?block, "403 detected - not assigned to slot" ) ;
363
+ return Ok ( ControlFlow :: Skip ) ;
364
+ } else {
365
+ error ! ( error = %err, "error handling inbound block" ) ;
365
366
}
366
367
367
368
ControlFlow :: Retry
0 commit comments