-
Notifications
You must be signed in to change notification settings - Fork 105
fix: retry-failed creates undefined nonce value #766
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
41674fc
6729fd0
7bfeb0c
57f9205
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 |
|---|---|---|
|
|
@@ -78,17 +78,15 @@ const handler: Processor<string, void, string> = async (job: Job<string>) => { | |
| // For example, the developer retried all failed transactions during an RPC outage. | ||
| // An errored queued transaction (resendCount = 0) is safe to retry: the transaction wasn't sent to RPC. | ||
| if (transaction.status === "errored" && resendCount === 0) { | ||
| const { errorMessage, ...omitted } = transaction; | ||
| transaction = { | ||
| ...{ | ||
| ...transaction, | ||
| nonce: undefined, | ||
|
Contributor
Author
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. This was the bug. By setting values to undefined, they were explicitly set to undefined in the type. This is unexpected because the typing implies undefined is not a valid value, which leads to weird edge cases like the code not handling undefined values.
Contributor
Author
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. The fix here was to flatten this code to override certain fields only. Note:
|
||
| errorMessage: undefined, | ||
| gas: undefined, | ||
| gasPrice: undefined, | ||
| maxFeePerGas: undefined, | ||
| maxPriorityFeePerGas: undefined, | ||
| }, | ||
| ...omitted, | ||
| status: "queued", | ||
| resendCount: 0, | ||
| queueId: transaction.queueId, | ||
| queuedAt: transaction.queuedAt, | ||
| value: transaction.value, | ||
| data: transaction.data, | ||
| manuallyResentAt: new Date(), | ||
| } satisfies QueuedTransaction; | ||
| } | ||
|
|
@@ -246,11 +244,14 @@ const _sendUserOp = async ( | |
| waitForDeployment: false, | ||
| })) as UserOperation; // TODO support entrypoint v0.7 accounts | ||
| } catch (error) { | ||
| return { | ||
| const errorMessage = wrapError(error, "Bundler").message; | ||
| const erroredTransaction: ErroredTransaction = { | ||
| ...queuedTransaction, | ||
| status: "errored", | ||
| errorMessage: wrapError(error, "Bundler").message, | ||
| } satisfies ErroredTransaction; | ||
| errorMessage, | ||
| }; | ||
| job.log(`Failed to populate transaction: ${errorMessage}`); | ||
| return erroredTransaction; | ||
|
Comment on lines
+247
to
+254
Contributor
Author
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. Unrelated fix, I previously removed the job.log() here but now I want it back. It's important for us to know if an error was thrown during simulation/estimation or when sending the tx. |
||
| } | ||
|
|
||
| job.log(`Populated userOp: ${stringify(signedUserOp)}`); | ||
|
|
@@ -322,12 +323,15 @@ const _sendTransaction = async ( | |
| maxPriorityFeePerGas: overrides?.maxPriorityFeePerGas, | ||
| }, | ||
| }); | ||
| } catch (e: unknown) { | ||
| return { | ||
| } catch (error: unknown) { | ||
| const errorMessage = wrapError(error, "RPC").message; | ||
| const erroredTransaction: ErroredTransaction = { | ||
| ...queuedTransaction, | ||
| status: "errored", | ||
| errorMessage: wrapError(e, "RPC").message, | ||
| } satisfies ErroredTransaction; | ||
| errorMessage, | ||
| }; | ||
| job.log(`Failed to populate transaction: ${errorMessage}`); | ||
| return erroredTransaction; | ||
| } | ||
|
|
||
| // Handle if `maxFeePerGas` is overridden. | ||
|
|
||
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.
Currently a thrown string is not logged.
While we shouldn't throw raw strings, this update at least prints the string value.