Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Error: Invalid signature length #276

Closed
davidqhr opened this issue Dec 19, 2017 · 2 comments
Closed

Error: Invalid signature length #276

davidqhr opened this issue Dec 19, 2017 · 2 comments
Assignees

Comments

@davidqhr
Copy link

Sometime I met this error when running the tests, but sometimes may be not

Here is the stack

Error: Invalid signature length
  at Object.exports.fromRpcSig (/Users/david/Documents/my_test/node_modules/ethereumjs-util/index.js:401:11)
  at Object.parseSignatureHexAsRSV (/Users/david/Documents/my_test/node_modules/0x.js/src/utils/signature_utils.ts:37:15)
  at ZeroEx.<anonymous> (/Users/david/Documents/my_test/node_modules/0x.js/src/0x.ts:273:47)
  at step (/Users/david/Documents/my_test/node_modules/0x.js/lib/src/0x.js:40:23)
  at Object.next (/Users/david/Documents/my_test/node_modules/0x.js/lib/src/0x.js:21:53)
  at fulfilled (/Users/david/Documents/my_test/node_modules/0x.js/lib/src/0x.js:12:58)
  at propagateAslWrapper (/Users/david/Documents/my_test/node_modules/async-listener/index.js:478:23)
  at /Users/david/Documents/my_test/node_modules/async-listener/glue.js:188:31
  at /Users/david/Documents/my_test/node_modules/async-listener/index.js:515:70
  at /Users/david/Documents/my_test/node_modules/async-listener/glue.js:188:31
  at <anonymous>

I tried to debug ethereumjs-util, It seems that sig.length is 64 sometime.

Any help is appreciated.

@davidqhr
Copy link
Author

davidqhr commented Dec 23, 2017

I'm here to answer my own question.

This is a bug in my code, not 0x.

I used a wrong function to get the buffer of a vrs
https://github.com/MetaMask/provider-engine/blob/176cafc0f8212b83b5327b63b80a6bb43909ee68/subproviders/hooked-wallet-ethtx.js#L69

The correct one
https://github.com/MetaMask/eth-sig-util/blob/master/index.js#L6

@davidqhr
Copy link
Author

Add a error case

{ r: <Buffer 6b cd 56 90 c9 eb 90 e9 78 94 d1 dd 89 40 42 32 10 cf 02 35 f7 c0 62 a7 d5 a9 b8 0d fc b7 06 b6>,
  s: <Buffer 00 12 0c c5 f1 9b ec 47 76 d8 cf aa 12 81 7c f3 42 96 f9 eb 82 b0 87 72 a8 86 74 24 56 93 30 e1>,
  v: 28 } 

result 1

0x6bcd5690c9eb90e97894d1dd8940423210cf0235f7c062a7d5a9b80dfcb706b6120cc5f19bec4776d8cfaa12817cf34296f9eb82b08772a8867424569330e11c

result 2

0x6bcd5690c9eb90e97894d1dd8940423210cf0235f7c062a7d5a9b80dfcb706b600120cc5f19bec4776d8cfaa12817cf34296f9eb82b08772a8867424569330e11c

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants