-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Labels
Description
Description
Refactor and improve the _shouldRetryViemSendRawTranasctionError function in ViemBlockchainClientAdapter to enhance maintainability, readability, and testability. The function currently contains hardcoded error codes, complex nested conditionals, and a typo in its name ("Tranasction" → "Transaction").
Motivation
This function is critical for transaction retry logic and determines which errors should trigger retries. We want to improve
- Maintainability and readability
- Correctness
- Documentation
Tasks
- Fix typo in function name from _shouldRetryViemSendRawTranasctionError to _shouldRetryViemSendRawTransactionError
- Create constants/enums file for RPC error codes, HTTP status codes, and error type names with documentation
- Refactor function to use extracted constants instead of magic numbers
- Restructure function logic to reduce nesting (consider early returns, helper functions, or lookup tables)
- Default retry behavior: Current default to retry unknown errors might be too aggressive - consider documenting or reviewing this decision
Risks
- Refactoring might inadvertently change retry logic - ensure comprehensive test coverage
Remember to
- Add the
documentationlabel in case there is an impact on the documentation - Add
priorityandteamlabels - Add Task for updating the Runbook or adding/updating existing metrics and alerts.