Skip to content

Conversation

@Julink-eth
Copy link
Contributor

@Julink-eth Julink-eth commented Jan 15, 2026

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

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Surfaces granular simulation failures and aligns types with API.

  • Add simulationData.callTraceErrors and extract errors from nested callTrace trees in getBalanceChanges
  • Make SimulationResponseCallTrace.calls/logs optional and add optional error to match API
  • Return callTraceErrors on both success and error paths; propagate gasUsed/transaction data via cached transactionResponse
  • Update tests to assert callTraceErrors behavior and add changelog entry

Written by Cursor Bugbot for commit 3b92fdf. This will update automatically on new commits. Configure here.

@Julink-eth Julink-eth requested a review from a team as a code owner January 15, 2026 14:33
@Julink-eth Julink-eth requested a review from a team as a code owner January 15, 2026 15:11

/** Raw event logs created by the call. */
logs: SimulationResponseLog[];
logs?: SimulationResponseLog[] | null;
Copy link
Member

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?

Copy link
Contributor Author

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 } : {}),
Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unit tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add

@github-project-automation github-project-automation bot moved this from Needs dev review to Needs more work from the author in PR review queue Jan 23, 2026
const gasUsed = response.transactions?.[0]?.gasUsed;
const gasUsed = transactionResponse?.gasUsed;
const simulationData = {
...(callTraceErrors?.length ? { callTraceErrors } : {}),
Copy link
Member

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?

Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs more work from the author

Development

Successfully merging this pull request may close these issues.

3 participants