ethereum / web3.py

A python interface for interacting with the Ethereum blockchain and ecosystem.
http://web3py.readthedocs.io
MIT License
5.03k stars 1.71k forks source link

<contract_func>.call modifies user input #1272

Open charles-cooper opened 5 years ago

charles-cooper commented 5 years ago

What was wrong?

When a block hash is supplied as the block identifier, web3.py replaces the block param with that block's number (cf. https://github.com/ethereum/web3.py/blob/652650d47753927e9cf46c0087f1dd044b1da0fa/web3/contract.py#L1343). This can result in eth_call being called on a different block than the intended block in the case of a reorg.

How can it be fixed?

1) Raise an exception if a block hash is supplied to call instead of modifying user input 2) Make an EIP to change the JSON RPC to accept block hash in addition to QUANTITY|TAG. Then just pass the block hash through instead of changing user input.

pipermerriam commented 5 years ago

Raise an exception if a block hash is supplied to call instead of modifying user input

I'm in favor of this approach and this would be a breaking change that could squeek into v5

charles-cooper commented 5 years ago

Make an EIP to change the JSON RPC to accept block hash in addition to QUANTITY|TAG. Then just pass the block hash through instead of changing user input.

Cf. https://github.com/ethereum/EIPs/pull/1898, could be a ways until this is implemented by nodes though.