ApeWorX / ApeWorX/web3.py

Mismatching chain ids between web3.eth.chainId and chainid opcode

Open
#1,677 6 comments 0 reactions 0 assignees View on GitHub
priority: p3 nice to have
Dominant language
Python
Stars
5.5k
Forks
1.7k
Avg merge
3d 10h
Merged PRs (30d)
2

Description

Calling `web3.eth.chainId` will return the chain id as set in
https://github.com/ethereum/web3.py/blob/master/web3/providers/eth_tester/defaults.py#L215, but using
```solididty
uint256 id;
assembly {
id := chainid()
}
```
returns 0 as `id`, which is the default value in pyevm.

There should be a way to set up an `EthereumTesterProvider` so that these match up. Ideally, this would be the default when doing
```solididty
ethereum_tester = EthereumTester(PyEVMBackend())
provider = EthereumTesterProvider(ethereum_tester)
web3 = Web3(provider)
```

Is this issue something that can/should be fixed in web3, or should I move it to eth_tester or pyevm?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.