Skip to content

Commit 1ecbb9c

Browse files
committed
refactor tests
1 parent ae215ea commit 1ecbb9c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

core/utils/eth_client_utils.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,19 @@ func WaitForTransactionReceiptRetryable(client eth.InstrumentedClient, fallbackC
3131
}
3232
return receipt, nil
3333
}
34-
return retry.RetryWithData(receipt_func, config)
34+
return receipt_func
35+
}
36+
37+
// WaitForTransactionReceiptRetryable repeatedly attempts to fetch the transaction receipt for a given transaction hash.
38+
// If the receipt is not found, the function will retry with exponential backoff until the specified `waitTimeout` duration is reached.
39+
// If the receipt is still unavailable after `waitTimeout`, it will return an error.
40+
//
41+
// Note: The `time.Second * 2` is set as the max interval in the retry mechanism because we can't reliably measure the specific time the tx will be included in a block.
42+
// Setting a higher value will imply doing less retries across the waitTimeout, and so we might lose the receipt
43+
// All errors are considered Transient Errors
44+
// - Retry times: 0.5s, 1s, 2s, 2s, 2s, ... until it reaches waitTimeout
45+
func WaitForTransactionReceiptRetryable(client eth.InstrumentedClient, fallbackClient eth.InstrumentedClient, txHash gethcommon.Hash, config *retry.RetryConfig) (*types.Receipt, error) {
46+
return retry.RetryWithData(WaitForTransactionReceipt(client, fallbackClient, txHash, config), config)
3547
}
3648

3749
func BytesToQuorumNumbers(quorumNumbersBytes []byte) eigentypes.QuorumNums {

0 commit comments

Comments
 (0)