Skip to content

Incorrect block number #362

@barakman

Description

@barakman

With ganache-cli 6.4.4, there is a discrepancy between the actual ("on-chain") block number and the reported ("off-chain") block number.

One would expect web3.eth.blockNumber to be equal to block.number, but the former is always "1 unit behind" the latter

In other words, web3.eth.blockNumber is always equal to block.number - 1.

This problem seems to have been resolved on ganache-cli 6.5.1 (or possibly even on an earlier version).

I have reported it at ConsenSys-archive/ganache#667, where you can see how to reproduce it very easily.

However being fixed, it is still present on testrpc-sc (the version of ganache-cli used by solidity-coverage).

Hence, upgrading to ganache-cli 6.5.1 yields exactly one of the following:

  • If I don't fix the test to comply with v6.5.1, then truffle test fails
  • If I do fix the test to comply with v6.5.1, then solidity-coverage fails

I have tested this on solidity-coverage 0.6.2 and 0.6.3 (the current latest version).

Would you be able to take the fix which occurred between ganache-cli 6.4.4 and ganache-cli 6.5.1, and apply it on testrpc-sc?

Thanks

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