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

Chain id being set to 9223372036854775790 #13847

Closed
thanasik opened this issue Mar 29, 2017 · 7 comments
Closed

Chain id being set to 9223372036854775790 #13847

thanasik opened this issue Mar 29, 2017 · 7 comments

Comments

@thanasik
Copy link

thanasik commented Mar 29, 2017

System information

Geth version: Tested on 1.5.9 and 1.6.0-unstable
OS & Version: Linux - Ubuntu 16.04
Commit hash : N/A

Expected behaviour

The transaction gets put into the pending transactions pool

Actual behaviour

An error is thrown about an Invalid sender, specifically Invalid v,r,s

Steps to reproduce the behaviour

Start a private geth node with chain id 0

Backtrace

panic: invalid transaction v, r, s values

goroutine 1 [running]:
panic(0x745a80, 0xc4200af5f0)
	/usr/local/go/src/runtime/panic.go:500 +0x1a1

I opened an Ethereum exchange question here as well: http://ethereum.stackexchange.com/questions/13603/whats-wrong-with-this-golang-code-for-transaction-signing-invalid-v-r-s-error

What I believe is happening is the chain id is being mis-set internally to 9223372036854775790 which is 2^64/2 (thank you to @fjl on gitter who pointed this number out), despite being explicitly set to 0 (or any other number).

My understanding is that transactions are being signed with the false chain id (I've printed them out to confirm that the transaction chain id does change to 9223372036854775790) instead of the one I specified, and as a result the transaction's v,r,s values are invalid and so the transaction never gets put into the pending transactions pool.

Some notes about the gist: In that gist I use a Homestead signer, if I use an EIP155Signer, initialized with the chain id, the error is invalid chain id, and the transaction is still signed with the incorrect chain id.

Code to re-create the issue: https://gist.github.com/karysto/3c7c1ab9d3ae736e5c63a2bbe4c47ac2

@obscuren
Copy link
Contributor

Thank you for your detailed description of the issue. We will look in to this.

@fjl
Copy link
Contributor

fjl commented Mar 29, 2017

AFAIK chainID cannot be zero. We should disallow it.

@thanasik
Copy link
Author

thanasik commented Mar 30, 2017

@fjl I agree, I can see issues with the chainID being 0 messing with a signer's chainIdMul (here for instance). I should note that this issue persists whether the chainID is 0 or some other number.

@karalabe
Copy link
Member

There are other issues too where some code might assume that 0 == unset, and default to non EIP-155 signatures, which will be one hell of a hard thing to debug :)

@stale
Copy link

stale bot commented Mar 31, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@fxsecltd
Copy link

It has EIP155 = true, with Geth 1.8.10 it succesfully mined. Please see transactions made via Custom node with EIP155=true and chainid=0 with described node, done yesterday
https://www.myetherwallet.com/?txHash=0xa59ba1757b123cd4ecb00220a7af843d722ab9a7f6f352c6fc99ad53855878af#check-tx-status
https://www.myetherwallet.com/?txHash=0x9b1516957c08eb153fe4f2552bcea13c5dba070f5e6875c25dae6cdeb95fe678#check-tx-status

@fxsecltd
Copy link

What can I do? I have private blockchain with quite large blockheight. Genesis.json has chainid=0
Since large block's height it can not be restarted with another chainid.
Myetherwallet can not use chainid=0 but without chainid = 0 no state-change transactions will available ("invalid sender" error appears for each state-change signed transactions).
Any help would be appreciated!

MyEtherWallet/etherwallet#1882

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

No branches or pull requests

5 participants