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

Use eth_chainId when signing transactions #3097

Merged
merged 4 commits into from
Oct 8, 2019
Merged

Use eth_chainId when signing transactions #3097

merged 4 commits into from
Oct 8, 2019

Conversation

cgewecke
Copy link
Collaborator

@cgewecke cgewecke commented Oct 3, 2019

Addresses #2378 and #1169 for the 1.x branch. Makes web3 conform to EIP 155 and fetch chainId via eth_chainId instead of net_version. For ethereum public nets there's no problem here because network id == chain id. For ganache, ETC and possibly others - the two values are different.

Note: these endpoints return their ids in different formats:

Client net_version eth_chainId
geth --dev "1337" "0x539"
parity --dev "17" "0x11"
ganache-cli "1570135120814" "0x539"

eth_chainId is not documented in the JSON_RPC spec. This is a case where it would be nice to have E2E tests vs the three main clients to be sure Web3's mocked responses correspond to reality.

@coveralls
Copy link

coveralls commented Oct 3, 2019

Coverage Status

Coverage remained the same at 83.02% when pulling 7e3f319 on cgewecke:issue/2378 into 139144e on ethereum:1.x.

@gabmontes
Copy link
Contributor

@cgewecke these changes are good IMHO.

I've been patching beta 37 with this exact set of changes in several Metronome projects for quite some time and works flawlessly.

Hope this is merged soon.

@cgewecke
Copy link
Collaborator Author

cgewecke commented Oct 7, 2019

Thanks @gabmontes, good to know.

@nivida nivida added 1.x 1.0 related issues Bug Addressing a bug labels Oct 7, 2019
Copy link
Contributor

@nivida nivida left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update the changelog for this and all other PRs you proposed?

@cgewecke
Copy link
Collaborator Author

cgewecke commented Oct 8, 2019

@nivida Do want the changelog updated under 1.2.2? Or unreleased?

@nivida
Copy link
Contributor

nivida commented Oct 8, 2019

„Unreleased“ is just the tag to label the unreleased version and the related changes. You can just extend the list of 1.2.2. @cgewecke

@cgewecke
Copy link
Collaborator Author

cgewecke commented Oct 8, 2019

@nivida Oh I just remembered something - not sure how you do this exactly but there is a nice npm utility called changelog that helps you generate a version-based changelog in one post-publication step.

The output still needs to be edited etc, but it seems like a convenient way of avoiding merge conflicts when there are lots of small PRs queued up like this and they all modify the same file.

@nivida
Copy link
Contributor

nivida commented Oct 8, 2019

@cgewecke Let us discuss this in an issue. :)

@nivida nivida merged commit 6d4ea0d into web3:1.x Oct 8, 2019
@cgewecke cgewecke deleted the issue/2378 branch October 8, 2019 05:25
nachomazzara pushed a commit to nachomazzara/web3.js that referenced this pull request Jun 4, 2020
* Use eth_chainId when signing transactions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.x 1.0 related issues Bug Addressing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants