Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Fix Ethereum DApp error response formatting #7392

Closed
StephenHeaps opened this issue May 4, 2023 · 1 comment · Fixed by #7393
Closed

Fix Ethereum DApp error response formatting #7392

StephenHeaps opened this issue May 4, 2023 · 1 comment · Fixed by #7393

Comments

@StephenHeaps
Copy link
Contributor

StephenHeaps commented May 4, 2023

Description:

WebKit prefixes Error: when responding to script messages with an error. Similar to Solana, we need to strip this prefix so the json formatting is preserved.

ref: brave/brave-talk#882

Steps to Reproduce

  1. Visit Brave Talk with a Premium account
  2. Connect your wallet to Brave Talk
  3. Tap Host a Web3 Call
  4. Tap cancel on the signature request
  5. Observe poorly formatted error message as the DApp could not parse the response.

Alternative steps without Brave Talk:

  1. Visit https://metamask.github.io/test-dapp/
  2. Connect your wallet to the test DApp
  3. Tap Sign under Personal Sign.
  4. Tap cancel on the signature request
  5. Observe ERROR: ("CODE": 4001, 'MESSAGE": "THE USER REJECTED THE REQUEST.).
    • Expected: ERROR: THE USER REJECTED THE REQUEST

Actual result:

Simulator.Screen.Recording.-.iPhone.14.Pro.-.2023-05-04.at.14.07.45.mp4

Expected result:

Screenshot from Android when correct error response is given for cancel/reject:
Screenshot_2023-05-04-12-13-13-44_e4424258c8b8649f6e67d283a50a2cbc

Reproduces how often: [Easily reproduced, Intermittent Issue]

Brave Version:

  • Can you reproduce this issue with the most recent build from TestFlight?
  • Can you reproduce this issue with the previous version of the current build from TestFlight?
  • Can you reproduce this issue with the current build from AppStore?

Device details:

Website problems only:

  • did you check with Brave Shields down?
  • did you check in Safari/Firefox (WkWebView-based browsers)?

Additional Information

@StephenHeaps StephenHeaps added this to the 1.51 milestone May 4, 2023
@StephenHeaps StephenHeaps self-assigned this May 4, 2023
@StephenHeaps StephenHeaps added this to Web3 May 4, 2023
@StephenHeaps StephenHeaps moved this to In Progress in Web3 May 4, 2023
StephenHeaps added a commit that referenced this issue May 5, 2023
Fix error formatting for Ethereum DApp responses
@github-project-automation github-project-automation bot moved this from In Progress to Done in Web3 May 5, 2023
StephenHeaps added a commit that referenced this issue May 5, 2023
Fix error formatting for Ethereum DApp responses
@srirambv
Copy link
Contributor

srirambv commented May 8, 2023

Verification passed on the following devices running 1.51 (2.5.5.18)

  • Verified steps from #7393
  • Verified cancel sign message shows proper response message instead of json response
iPhone 7+ (iOS 15.7.3) iPhone 13 (iOS 16.4.1) iPad Pro (16.4 Beta 4)
7392-iPhone.7+.MP4
7392-iPhone.13.MP4
7392-iPad.Pro.MP4

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