Skip to content
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

eth_signTypedData_v4 signature never completes #12097

Closed
alfetopito opened this issue May 7, 2021 · 9 comments · Fixed by #12109
Closed

eth_signTypedData_v4 signature never completes #12097

alfetopito opened this issue May 7, 2021 · 9 comments · Fixed by #12109
Assignees

Comments

@alfetopito
Copy link

Bug Report

Problem

Signing a message with eth_signTypedData_v4 never completes.
It keeps "processing" indefinitely.
The same is true for eth_signTypedData_v3

Expected behavior

The message is signed

Actual behavior

The app is "processing" after the card is connected and never completes.

Reproduction

  1. Setup this repo in your local network https://github.com/BboyAkers/js-eth-personal-sign-examples
    1. Clone the repo, cd into it, then: npm i && npm run build && npx serve
    2. It should serve a page in your local host at http://<your local ip>:5000
  2. Make sure your mobile device is connected in the same network as the device serving the above page
  3. Open Status
  4. Open the app browser
  5. Open http://<your local ip>:5000
  6. Click on connect and accept the local connection
  7. Click on eth sign typed data v4 (the behaviour is the same with v3)
  8. Follow the steps to use your keycard to sign the message

Additional Information

  • Status version: 1.13.0
  • Operating System: Android
@bitgamma
Copy link
Member

bitgamma commented May 7, 2021

could it be a duplicate of #11706? For example if you are connected to mainnet but the dapp specifies test chain or private chain in the data to sign

@alfetopito
Copy link
Author

Well, I'm not sure, since I have no access to an in app debugger.

I first observed the failure while testing our dApp on Mainnet: https://cowswap.exchage

Actually, the dApp takes the network from the injected provider, so it should use whatever the wallet is giving, which I assume is mainnet.

To reproduce that in CowSwap it'll cost you ETH for one approval and ERC20 funds to actually swap, as that is required before doing a swap.
After that you should be prompted for the signature.

For this reason I went with the github repo where the signature is requested straight away.

@bitgamma
Copy link
Member

bitgamma commented May 11, 2021

I managed to reproduce the issue. I had to switch to the signature-refactor branch to make it work which was not indicated in the reproduction steps so it took a while to get there.

My findings are as follow:

  1. This is not related to Keycard, although the issue signing typed data with wrong chain ID fails without proper error message #11706 makes it harder to debug since you don't get the error message and it just hangs. If you use a regular account you get an error message
  2. Status is correct refusing to sign the v3 example. The problem is that the chainId value while specified to be a number in the JSON it is as string. More pratically, instead of "chainId": 1 the dapp sends "chainId": "1" (note the quotes). This causes the error json: cannot unmarshal string into Go value of type int64. By changing netId to parseInt(netId) at line 301 of the dapp, signing works.
  3. in the v4 example the chainId is hardcoded to 1 (which is OK if testing on mainnet) and is indeed a number. The error is json: cannot unmarshall number into Go struct field TypedDataDomain.domain.chainId of type *math.HexOrDecimal256. This one needs more investigation

@bitgamma
Copy link
Member

@alfetopito we have changed the implementation to accept either a string or number as chainID. Now a signature is generated both for v3 and v4

@alfetopito
Copy link
Author

Awesome, thanks for that @bitgamma

Any idea when that change will go live? I assume it requires a new app release on the respective stores (Android/iOS)

@bitgamma
Copy link
Member

It will be in the next release, but I cannot tell for sure when it will be. We release roughly once a month. If you wish to try it out you can download a nightly build (if you are on Android) from https://status.im/nightly/

@anxolin
Copy link

anxolin commented May 13, 2021

Hi @bitgamma how can I try it for IOS?

IMG_9424

IMG_9425

@bitgamma
Copy link
Member

@anxolin because of how software distribution works on iOS, you will need to wait for the official release unfortunately

@alfetopito
Copy link
Author

Tested out the nightly version on Android, worked perfectly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants