-
Notifications
You must be signed in to change notification settings - Fork 105
feat: add experimental retry for prepareUserOp errors in transaction processing #916
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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