-
Notifications
You must be signed in to change notification settings - Fork 104
feat: add experimental retry for prepareUserOp errors in transaction processing #916
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -295,12 +295,19 @@ const _sendUserOp = async ( | |||||||||||||||||||
| }); | ||||||||||||||||||||
| } catch (error) { | ||||||||||||||||||||
| const errorMessage = wrapError(error, "Bundler").message; | ||||||||||||||||||||
| job.log(`Failed to populate transaction: ${errorMessage}`); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // If retry is enabled for prepareUserOp errors, throw to trigger job retry | ||||||||||||||||||||
| if (env.EXPERIMENTAL__RETRY_PREPARE_USEROP_ERRORS) { | ||||||||||||||||||||
| throw error; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // Otherwise, return errored transaction as before | ||||||||||||||||||||
| const erroredTransaction: ErroredTransaction = { | ||||||||||||||||||||
| ...queuedTransaction, | ||||||||||||||||||||
| status: "errored", | ||||||||||||||||||||
| errorMessage, | ||||||||||||||||||||
| }; | ||||||||||||||||||||
| job.log(`Failed to populate transaction: ${errorMessage}`); | ||||||||||||||||||||
| return erroredTransaction; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -356,12 +363,19 @@ const _sendUserOp = async ( | |||||||||||||||||||
| const errorMessage = `${ | ||||||||||||||||||||
| wrapError(error, "Bundler").message | ||||||||||||||||||||
| } Failed to sign prepared userop`; | ||||||||||||||||||||
| job.log(`Failed to sign userop: ${errorMessage}`); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // If retry is enabled for prepareUserOp errors, throw to trigger job retry | ||||||||||||||||||||
| if (env.EXPERIMENTAL__RETRY_PREPARE_USEROP_ERRORS) { | ||||||||||||||||||||
| throw error; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
Comment on lines
+368
to
+372
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Rethrow a wrapped Error for consistent typing and telemetry. Mirror the RPC path and the prepare catch: wrap before throwing. - if (env.EXPERIMENTAL__RETRY_PREPARE_USEROP_ERRORS) {
- throw error;
- }
+ if (env.EXPERIMENTAL__RETRY_PREPARE_USEROP_ERRORS) {
+ throw wrapError(error, "Bundler");
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| // Otherwise, return errored transaction as before | ||||||||||||||||||||
| const erroredTransaction: ErroredTransaction = { | ||||||||||||||||||||
| ...queuedTransaction, | ||||||||||||||||||||
| status: "errored", | ||||||||||||||||||||
| errorMessage, | ||||||||||||||||||||
| }; | ||||||||||||||||||||
| job.log(`Failed to sign userop: ${errorMessage}`); | ||||||||||||||||||||
| return erroredTransaction; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -383,12 +397,19 @@ const _sendUserOp = async ( | |||||||||||||||||||
| const errorMessage = `${ | ||||||||||||||||||||
| wrapError(error, "Bundler").message | ||||||||||||||||||||
| } Failed to bundle userop`; | ||||||||||||||||||||
| job.log(`Failed to bundle userop: ${errorMessage}`); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // If retry is enabled for prepareUserOp errors, throw to trigger job retry | ||||||||||||||||||||
| if (env.EXPERIMENTAL__RETRY_PREPARE_USEROP_ERRORS) { | ||||||||||||||||||||
| throw error; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
Comment on lines
+403
to
+406
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Same here: wrap before rethrowing. Aligns error shape and ensures BullMQ receives a proper Error instance. - if (env.EXPERIMENTAL__RETRY_PREPARE_USEROP_ERRORS) {
- throw error;
- }
+ if (env.EXPERIMENTAL__RETRY_PREPARE_USEROP_ERRORS) {
+ throw wrapError(error, "Bundler");
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| // Otherwise, return errored transaction as before | ||||||||||||||||||||
| const erroredTransaction: ErroredTransaction = { | ||||||||||||||||||||
| ...queuedTransaction, | ||||||||||||||||||||
| status: "errored", | ||||||||||||||||||||
| errorMessage, | ||||||||||||||||||||
| }; | ||||||||||||||||||||
| job.log(`Failed to bundle userop: ${errorMessage}`); | ||||||||||||||||||||
| return erroredTransaction; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Throw a wrapped Error and fix log message to match the step.
🤖 Prompt for AI Agents