Skip to content

Inconsistent signature notation with personal_sign and Ledger #10850

Closed
@nlordell

Description

Describe the bug

This is quite a minor issue but I noticed that the signatures produced from personal_sign when using a MetaMask account and a Ledger HW wallet account are inconsistent.

Steps to reproduce

In order to reproduce this, simply sign with a MetaMask account and a Ledger account, and see that the notation used for the signature recovery value (a.k.a. v-value) are inconsistent:

  1. Use personal_sign to sign a message with a MetaMask account
    • notice that the signature has v ∊ {27, 28}
  2. Use personal_sign to sign a message with an imported Ledger account
    • notice that the signature has v ∊ {0, 1}
Sample code
const [account] = await window.ethereum.request({ method: "eth_requestAccounts" });
console.log(await window.ethereum.request({
  method: "personal_sign",
  params: [account, "MetaMask rocks!"],
}));

Expected behavior

Expected the signature notation to be the same. Specifically v ∊ {27, 28} as:

Browser details:

  • OS: Fedora 33
  • Hardware Wallet: Ledger Nano S Firmware version 1.6.1
  • Browser: Firefox 87
  • MetaMask Version: 9.3.0

Additional context

I believe that the fix is very easy. It looks like the Ledger keyring mistakenly converts from v ∊ {27, 28} to v ∊ {0, 1} notation: /~https://github.com/MetaMask/eth-ledger-bridge-keyring/blob/d525991401df398f288270f83e2c44b6804c76ee/index.js#L248

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions