Skip to content

Byzantium - eth_estimateGas call no longer provides correct estimates #15186

Closed
@LefterisJP

Description

@LefterisJP

System information

Geth version: 1.7.0
OS & Version: Linux

Expected behaviour

Right before byzantium the eth_estimateGas call provided reasonably accurate estimates for transactions with multiple stack frames containing a REVERT. Presumably because that used to be just an invalid operation equaling to a throw.

Actual behaviour

In ropsten, after block 1.7 million, with Byzantium rules activated it no longer provides correct estimates.

Steps to reproduce the behaviour

Try to estimate gas for a transaction with multiple calls, where one of the calls deeper in the stack frame does REVERT and reverts operation to its parent. Do that with pre-byzantium rules and then post-byzantium rules and you will see the difference.

As a live example on ropsten we can observe raiden's channel manager for a given token. Raiden used to set the gas limit of a transactions as GAS_ESTIMATE * 2.

A newChannel() call before the byzantium fork. Raiden provided a gas limit of 2368060 and the gas used by the transaction was 1168023. 1168023 is close to what estimateGas used to return.

Now let's check a post-Byzantium fork newChannel transaction where Raiden still relies on estimateGas. The gas limit provided by Raiden is 58070 which means the estimate was about 29035 for the same call which above took 1168023.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions