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

sendSignedTransaction fails for rawTransaction with leading zeroes #1126

Closed
matthieu-merlyn opened this issue Oct 20, 2017 · 3 comments
Closed
Assignees
Labels
Bug Addressing a bug

Comments

@matthieu-merlyn
Copy link

matthieu-merlyn commented Oct 20, 2017

Version: 1.0.0-beta.23

When the result of web3.eth.accounts.signTransaction contains a signature with an R or S value starting with leading zeroes and the rawTransaction is then passed to web3.eth.sendSignedTransaction, this returns

(node:66148) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Error: Returned error: rlp: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.txdata).S

Bypassed this in my test application (private chain) by adding 1 Wei to my tx value and resigning the tx until the signature no longer contains leading zeroes, which fixes the issue for now but obviously is not a desirable solution.

@littleskunk
Copy link
Contributor

littleskunk commented Oct 23, 2017

I don't think it is sendSignedTransaction. It looks more like a bug in signTransaction (rawTransaction A). I used mytherwallet offline send with the same inputs and I get a different signed rawTransaction (rawTransaction B).

rawTransaction A looks invalid to me. web3 and myetherwallet don't want to broadcast it. Invalid RLP
rawTransaction B is working. I can broadcast it without any problems.

Difference between A and B is the signature at the end. Leading zeroes as described.

Changing sender or receiver address is bypassing it for me. I have a list of transactions and can mix sender and receiver without changing the final outcome.

@ldn0x7dc
Copy link

@Freyert
Copy link
Contributor

Freyert commented Mar 20, 2018

#1170

Mine happens like so:

Error: Returned error: rlp: non-canonical integer (leading zero bytes) for *big.Int, decoding into (types.Transaction)(types.txdata).S
    at Object.ErrorResponse (/project/node_modules/web3/packages/web3-core-helpers/src/errors.js:29:16)
    at /project/node_modules/web3/packages/web3-core-requestmanager/src/index.js:137:36
    at XMLHttpRequest.request.onreadystatechange (/project/node_modules/web3/packages/web3-providers-http/src/index.js:64:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/project/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:64:18)
    at XMLHttpRequest._setReadyState (/project/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:354:12)
    at XMLHttpRequest._onHttpResponseEnd (/project/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:509:12)
    at IncomingMessage.<anonymous> (/project/node_modules/web3/packages/web3-providers-http/node_modules/xhr2/lib/xhr2.js:469:24)
    at IncomingMessage.emit (events.js:185:15)
    at endReadableNT (_stream_readable.js:1101:12)
    at process._tickCallback (internal/process/next_tick.js:114:19)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Addressing a bug
Projects
None yet
Development

No branches or pull requests

5 participants