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

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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant