Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

The parameters that are sent to eth_sign is swapped #2555

Closed
samueltangz opened this issue Mar 22, 2019 · 0 comments · Fixed by #2547
Closed

The parameters that are sent to eth_sign is swapped #2555

samueltangz opened this issue Mar 22, 2019 · 0 comments · Fixed by #2547

Comments

@samueltangz
Copy link

Description

According to the documentation, the parameters for web3.eth.sign would be dataToSign and address [1][2][3].

However, for eth_sign, the parameters in order should be address and data; which is reversed compared to the given web3.eth.sign [4].

From [1] to [3], the order of parameters are not swapped. For versions prior to 1.0.0-beta.37, it seems to be handled.

Expected behavior

Either one of the following should work:

  1. web3.eth.sign('hello', '0xBCe00FD336be3be338458e93EfC80Da14f8a3e05') (according to the documentation);
  2. web3.eth.sign('0xBCe00FD336be3be338458e93EfC80Da14f8a3e05', 'hello') (according to the RPC)
    would work.

Actual behavior

In the current (recent) versions, none of the above works:

When calling web3.eth.sign('hello', '0xBCe00FD336be3be338458e93EfC80Da14f8a3e05'), it shows

MetaMask - RPC Error: Error: WalletMiddleware - Invalid "from" address.

Yet, when calling web3.eth.sign('0xBCe00FD336be3be338458e93EfC80Da14f8a3e05', 'hello'), it shows

Error: Provided address "hello" is invalid, the capitalization checksum test failed, or its an indrect IBAN address which can't be converted.

I am testing with the MetaMask provider, but I tried HookedWalletSubprovider and it doesn't work too.

Versions

  • web3.js: 1.0.0-beta.50 (probably since 1.0.0-beta.38)
  • nodejs: v10.15.3
  • browser: Google Chrome Version 70.0.3538.77 (Official Build) (64-bit)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant