Change net.version to eth.chainId for default transaction params #1378
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What was wrong?
On a chain using a different network id and chain id, the default parameters for a transaction would be incorrectly filled when using Parity / Geth. It would use the
net_version
RPC instead ofeth_chainId
Parity's net_version RPC: https://wiki.parity.io/JSONRPC-net-module#net_version
Parity's eth_chainId RPC: https://wiki.parity.io/JSONRPC-eth-module#eth_chainid
Geth net_version RPC: https://github.com/ethereumproject/go-ethereum/wiki/JSON-RPC#net_version
Geth eth_chainId RPC: https://github.com/ethereumproject/go-ethereum/wiki/JSON-RPC#eth_chainId
Related to Issue #1293
How was it fixed?
Change the
TRANSACTION_DEFAULTS
to use web3.eth.chainIdThis works for Parity and Geth afaik. It does not comply with EIP1474: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md#description-4
But as noted in the related issue, the EIP1474 should be updated and the EIP is in draft state.
I could not write a proper test for it since I would need a test chain with a different network and chain id, and could not find a relatively quick way to do that.
Cute Animal Picture
Edit: I know I messed up and wrote
chaindId
instead ofchainId
, also looking into fixing some tests.