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

[Bug]: Signature fails with Ledger #18232

Closed
atillabirer opened this issue Mar 18, 2023 · 3 comments
Closed

[Bug]: Signature fails with Ledger #18232

atillabirer opened this issue Mar 18, 2023 · 3 comments
Labels
Sev2-normal Normal severity; minor loss of service or inconvenience. team-accounts type-bug

Comments

@atillabirer
Copy link

Describe the bug

When we attempt to sign a message using ethersjs and Ledger, signing fails with Network Error in the console and the signature pop-up keeps coming back. The called contract reverts with a hex that basically says InvalidSignature() . Signing normally on browser (without ledger) works normally. Ledger with Trust wallet also works normally.

image

Steps to reproduce

  1. Connect ledger to metamask
  2. call any transaction that requires signing

Error messages or log output

No response

Version

10.25.0

Build type

None

Browser

Chrome, Firefox, Brave

Operating system

MacOS, Linux

Hardware wallet

Ledger

Additional context

No response

@danjm
Copy link
Contributor

danjm commented Mar 20, 2023

Can you share a code sample that we could run to reproduce the failure you are seeing?

@danjm danjm added Sev2-normal Normal severity; minor loss of service or inconvenience. team-accounts labels Mar 21, 2023
@atillabirer
Copy link
Author

handled it this way:

        const signature = await signer._signTypedData(domain, types, values)
        //replace 
        let {r,s,v} = utils.splitSignature(signature);
        console.log("rsv:",{r,s,v})
        if(v == 0) v = 27
        if(v == 1) v = 28
        console.log(utils.joinSignature({r,s,v}))
        const joined = utils.joinSignature({r,s,v});


        return { signature: joined, permit, witness }

but it would be good if metamask flipped v = 0,1 to v=27,28 when ledger returns the v as 0,1.

@plasmacorral
Copy link
Contributor

This was resolved with MetaMask/eth-ledger-bridge-keyring#152

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sev2-normal Normal severity; minor loss of service or inconvenience. team-accounts type-bug
Projects
None yet
Development

No branches or pull requests

3 participants