@@ -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 {
@@ -200,22 +197,33 @@ impl SubmitTask {
200
197
}
201
198
202
199
/// Creates a transaction request for the blob with the given header and signature values.
203
- async fn tx_request (
200
+ async fn new_tx_request (
204
201
& self ,
205
202
retry_count : usize ,
206
203
resp : & SignResponse ,
207
204
block : & BuiltBlock ,
208
- v : u8 ,
209
- r : FixedBytes < 32 > ,
210
- s : FixedBytes < 32 > ,
211
205
) -> Result < TransactionRequest , eyre:: Error > {
212
206
// TODO: ENG-1082 Implement fills
213
207
let fills = vec ! [ ] ;
214
208
215
- // Bump gas with each retry to replace the previous transaction while maintaining the same nonce
216
- let gas_coefficient = 10 * ( retry_count + 1 ) as u64 ;
217
- let gas_limit = 1_000_000 + ( gas_coefficient * 1_000_000 ) ;
218
- debug ! ( retry_count, gas_coefficient, gas_limit, "calculated gas limit" ) ;
209
+ // Extract the signature components from the response
210
+ let ( v, r, s) = extract_signature_components ( & resp. sig ) ;
211
+
212
+ // Bump gas with each retry to replace the previous
213
+ // transaction while maintaining the same nonce
214
+ // TODO: Clean this up if this works
215
+ let gas_coefficient: u64 = ( 15 * ( retry_count + 1 ) ) . try_into ( ) . unwrap ( ) ;
216
+ let gas_limit: u64 = 1_500_000 + ( gas_coefficient * 1_000_000 ) ;
217
+ let max_priority_fee_per_gas: u128 = ( retry_count as u128 ) ;
218
+ debug ! (
219
+ retry_count,
220
+ gas_coefficient, gas_limit, max_priority_fee_per_gas, "calculated gas limit"
221
+ ) ;
222
+
223
+ // manually retrieve nonce
224
+ let nonce =
225
+ self . provider ( ) . get_transaction_count ( self . provider ( ) . default_signer_address ( ) ) . await ?;
226
+ debug ! ( nonce, "assigned nonce" ) ;
219
227
220
228
// Build the block header
221
229
let header: BlockHeader = BlockHeader {
@@ -227,17 +235,14 @@ impl SubmitTask {
227
235
} ;
228
236
debug ! ( ?header, "built block header" ) ;
229
237
230
- // manually retrieve nonce
231
- let nonce =
232
- self . provider ( ) . get_transaction_count ( self . provider ( ) . default_signer_address ( ) ) . await ?;
233
- debug ! ( nonce, "manually setting transaction nonce" ) ;
234
-
235
238
// Create a blob transaction with the blob header and signature values and return it
236
239
let tx = self
237
240
. build_blob_tx ( fills, header, v, r, s, block) ?
238
241
. with_from ( self . provider ( ) . default_signer_address ( ) )
239
242
. with_to ( self . config . builder_helper_address )
240
- . with_gas_limit ( gas_limit) ;
243
+ . with_gas_limit ( gas_limit)
244
+ . with_max_priority_fee_per_gas ( max_priority_fee_per_gas)
245
+ . with_nonce ( nonce) ;
241
246
242
247
debug ! ( ?tx, "prepared transaction request" ) ;
243
248
Ok ( tx)
@@ -335,7 +340,6 @@ impl SubmitTask {
335
340
// Retry loop
336
341
let result = loop {
337
342
let span = debug_span ! ( "SubmitTask::retrying_handle_inbound" , retries) ;
338
- debug ! ( retries, "number of retries" ) ;
339
343
340
344
let inbound_result = match self
341
345
. handle_inbound ( retries, block)
@@ -349,17 +353,14 @@ impl SubmitTask {
349
353
Err ( err) => {
350
354
// Log the retry attempt
351
355
retries += 1 ;
352
- error ! ( error = %err, "error handling inbound block" ) ;
353
356
354
357
// Delay until next slot if we get a 403 error
355
- if err. to_string ( ) . contains ( "403" ) {
356
- let ( slot_number, _, end) = self . calculate_slot_window ( ) ?;
357
- let now = self . now ( ) ;
358
- if end > now {
359
- let sleep_duration = std:: time:: Duration :: from_secs ( end - now) ;
360
- debug ! ( sleep_duration = ?sleep_duration, slot_number, "403 detected - sleeping until end of slot" ) ;
361
- tokio:: time:: sleep ( sleep_duration) . await ;
362
- }
358
+ if err. to_string ( ) . contains ( "403 Forbidden" ) {
359
+ let ( slot_number, _, _) = self . calculate_slot_window ( ) ?;
360
+ debug ! ( slot_number, ?block, "403 detected - not assigned to slot" ) ;
361
+ return Ok ( ControlFlow :: Skip ) ;
362
+ } else {
363
+ error ! ( error = %err, "error handling inbound block" ) ;
363
364
}
364
365
365
366
ControlFlow :: Retry
0 commit comments