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

Document workarounds for ECDSA.recover with Ganache #2190

Closed
frangio opened this issue Apr 15, 2020 · 4 comments · Fixed by #2619
Closed

Document workarounds for ECDSA.recover with Ganache #2190

frangio opened this issue Apr 15, 2020 · 4 comments · Fixed by #2619

Comments

@frangio
Copy link
Contributor

frangio commented Apr 15, 2020

In 2.2.0 we introduced protections against malleability of ECDSA signatures. More details can be found in #1622.

One unfortunate side effect of this has been that ECDSA.recover stopped working with Ganache-generated signatures, because they use the signatures parameters that the library rejects. This seems to be a problem with Ganache only. There seems to be plans to fix it in the next major version of Ganache, with an unknown ETA. The relevant issues are trufflesuite/ganache#451, trufflesuite/ganache#556.

We evaluated rolling back the changes to ECDSA in Contracts 3.0. Given that we think malleability protection makes sense in general, that the issue only affects the current version of Ganache, and that there are workarounds, we decided to keep the current behavior and instead improve the documentation by including the workarounds that are required to make it work in Ganache, and more details about the issue to understand it.

The workaround can be found in test/helpers/sign.js: fixSignature. We should move it to test-helpers to make it available as a complement to the documentation.

@frangio frangio changed the title ECD Improve docs for ECDSA.recover malleability checks Apr 15, 2020
@frangio frangio changed the title Improve docs for ECDSA.recover malleability checks Document workarounds for ECDSA.recover with Ganache Apr 15, 2020
@nventuro
Copy link
Contributor

I want to add a short clarification, given a bit of context is needed to understand this.

The current ECDSA code is correct, safe, and will work as intended in all testnets and the main Ethereum network. This is a side-effect of an issue with how a Ganache node behaves on eth_sign RPC requests, which on the worst case will lead to head-scratching while developing locally against a ganache node.

@shinsuny
Copy link

shinsuny commented Jan 28, 2021

This side effect took my 16 hrs of debugging.
@frangio Thanks for listing the issue.

Without fix Ganache will throw:
ECDSA: invalid signature 'v' value

@nventuro
Copy link
Contributor

which on the worst case will lead to head-scratching while developing locally against a ganache node.

😅 sorry this caused you so much trouble @sarveshwar-singh!

@giuseppeg
Copy link

giuseppeg commented Oct 14, 2022

Hello there. I just stumbled upon this issue and would appreciate any help:

I signed a message with web3.eth.sign(message, myAddress) using MM 10.20.0 and web3 1.8.0 and still need to fix the signature otherwise ECDSA.recover 4.7.3 fails with

ECDSA: invalid signature 'v' value

Looking at this commit though it seems that the workaround shouldn't be needed anymore.

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.

4 participants