-
-
Notifications
You must be signed in to change notification settings - Fork 268
feat: add callTrace errors in the simulation data response #7641
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
base: main
Are you sure you want to change the base?
Conversation
|
|
||
| /** Raw event logs created by the call. */ | ||
| logs: SimulationResponseLog[]; | ||
| logs?: SimulationResponseLog[] | null; |
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.
Why do we need both optional and null?
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.
It might be over "type protective", I have noticed that the property calls can be null and I thought it could be the same with the logs but might not be necessary.
| const gasUsed = response.transactions?.[0]?.gasUsed; | ||
| const gasUsed = transactionResponse?.gasUsed; | ||
| const simulationData = { | ||
| ...(callTraceErrors?.length ? { callTraceErrors } : {}), |
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.
Can we just always include it but as undefined if no errors?
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.
Yes will update.
|
|
||
| return [ | ||
| ...errors, | ||
| ...nestedCalls |
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.
Minor, could we define a nestedErrors above for readability?
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.
Unit tests?
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.
Will add
| const gasUsed = response.transactions?.[0]?.gasUsed; | ||
| const gasUsed = transactionResponse?.gasUsed; | ||
| const simulationData = { | ||
| ...(callTraceErrors?.length ? { callTraceErrors } : {}), |
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.
Why don't errors on the calls bubble to the transaction error?
Is there an error in this scenario, if so, how does it differ?
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.
This is to handle errors coming from nested calls, I don't believe they always bubble up to the transaction error.
Explanation
Sentinel API often returns the real failure reason in callTrace.error, not the top‑level error. Without exposing this, the UI can’t show chain‑specific warnings (e.g., Monad’s reserve balance rule for sponsored transaction).
This PR allows to extract call‑trace errors into simulationData.callTraceErrors and make call‑trace fields optional to match the API.
The clients can display chain‑specific explanations instead of generic “reverted”.
References
Related Extension PR: MetaMask/metamask-extension#39284
Checklist
Note
Surfaces granular simulation failures and aligns types with API.
simulationData.callTraceErrorsand extract errors from nestedcallTracetrees ingetBalanceChangesSimulationResponseCallTrace.calls/logsoptional and add optionalerrorto match APIcallTraceErrorson both success and error paths; propagategasUsed/transaction data via cachedtransactionResponsecallTraceErrorsbehavior and add changelog entryWritten by Cursor Bugbot for commit 3b92fdf. This will update automatically on new commits. Configure here.