From 1149c418e8c0a85270138395769fc31927bf9c25 Mon Sep 17 00:00:00 2001 From: Ryan Ghods Date: Mon, 13 Apr 2020 15:45:55 -0700 Subject: [PATCH] Add docs note for Geth v1.9.12 `eth_call` change (#3467) * Note geth `eth_call` breaking change * Note geth `web3-eth-contract` myMethod call breaking change --- CHANGELOG.md | 6 +++++- docs/web3-eth-contract.rst | 4 ++-- docs/web3-eth.rst | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e2dc19feb46..5339a21ff3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -156,7 +156,11 @@ Released with 1.0.0-beta.37 code base. - Removed old bower and meteor artifacts - Moved logo assets to own folder - Moved github assets to own folder -- Remove @types/node from (non-dev) dependency tree (#3965, #3227) + - Remove @types/node from (non-dev) dependency tree (#3965, #3227) +- *Please note*: Geth [v1.9.12](https://github.com/ethereum/go-ethereum/releases/tag/v1.9.12) contains a breaking change for `eth_call` that will not default to your first account anymore if `from` is not set. If a sender is not explicitly defined, the `eth_call` will be executed from `address(0)`. (#3467) + - This was done to avoid the same input behaving differently in different environments. You should never do `eth_call` without explicitly setting a sender. + - This means that if you're calling `view` methods that refer to a `msg.sender` without explicitly setting a `from` address in your request options, you may see unexpected behavior. + - In `web3.js`, the `from` address can be specified on a per-call basis or by setting the `defaultAccount` property. ### Fixed diff --git a/docs/web3-eth-contract.rst b/docs/web3-eth-contract.rst index f50c7aa2e67..d44347b3d8b 100644 --- a/docs/web3-eth-contract.rst +++ b/docs/web3-eth-contract.rst @@ -745,14 +745,14 @@ methods.myMethod.call myContract.methods.myMethod([param1[, param2[, ...]]]).call(options[, callback]) -Will call a "constant" method and execute its smart contract method in the EVM without sending any transaction. Note calling can not alter the smart contract state. +Will call a "constant" method and execute its smart contract method in the EVM without sending any transaction. Note calling cannot alter the smart contract state. ---------- Parameters ---------- 1. ``options`` - ``Object`` (optional): The options used for calling. - * ``from`` - ``String`` (optional): The address the call "transaction" should be made from. + * ``from`` - ``String`` (optional): The address the call "transaction" should be made from. For calls the ``from`` property is optional however it is highly recommended to explicitly set it or it may default to `address(0)` depending on your node or provider. * ``gasPrice`` - ``String`` (optional): The gas price in wei to use for this call "transaction". * ``gas`` - ``Number`` (optional): The maximum gas provided for this call "transaction" (gas limit). 2. ``callback`` - ``Function`` (optional): This callback will be fired with the result of the smart contract method execution as the second argument, or with an error object as the first argument. diff --git a/docs/web3-eth.rst b/docs/web3-eth.rst index 391f042172a..f2573b4cdba 100644 --- a/docs/web3-eth.rst +++ b/docs/web3-eth.rst @@ -1600,7 +1600,7 @@ Executes a message call transaction, which is directly executed in the VM of the Parameters ---------- -1. ``Object`` - A transaction object see :ref:`web3.eth.sendTransaction `, with the difference that for calls the ``from`` property is optional as well. +1. ``Object`` - A transaction object, see :ref:`web3.eth.sendTransaction `. For calls the ``from`` property is optional however it is highly recommended to explicitly set it or it may default to `address(0)` depending on your node or provider. 2. ``Number|String|BN|BigNumber`` - (optional) If you pass this parameter it will not use the default block set with :ref:`web3.eth.defaultBlock `. Pre-defined block numbers as ``"latest"``, ``"earliest"``, ``"pending"``, and ``"genesis"`` can also be used. 3. ``Function`` - (optional) Optional callback, returns an error object as first parameter and the result as second.