Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

After calling evm_mine, eth_getLogs returns same logs for all blocks #533

Open
fabioberger opened this issue Jan 9, 2020 · 7 comments
Open

Comments

@fabioberger
Copy link

Expected Behavior

eth_getLogs should return the logs for the blockHash specified in the request.

Current Behavior

After executing a evm_mine or evm_increaseTime call to Ganache, eth_getLogs always returns the logs for the latest block even if the request specifies a different blockHash.

Possible Solution

Figure out what stateful change made during the evm_mine call is causing subsequent eth_getLogs calls to ignore the supplied blockHash and always use the latest block.

Steps to Reproduce (for bugs)

  1. Start Ganache
  2. Execute a txn that generates a log (e.g., ERC20 transfer)
  3. Execute an evm_mine or evm_increaseTime call with or without params
  4. Execute another txn that generates a log (e.g. ERC20 allowance)
  5. Call eth_getLogs specifying any blockHash and you will always receive the logs from the latest block mined.

Context

I am trying to write smart contract tests that check 0x order filling and expiration. I cannot cause orders to expire deterministically without use of evm_mine/evm_increaseTime but cannot use it if it bricks eth_getLogs.

Your Environment

  • Version used: Mac OS
  • Version of Truffle/Remix/Other tools used: Ganache CLI v6.7.0 (ganache-core: 2.8.0)
  • NodeJS Version: 10.x
  • Operating System and version (include distro if Linux): mhart/alpine-node:10
  • I intend to submit a pull request to fix this issue: [ ]
@fabioberger
Copy link
Author

fabioberger commented Jan 15, 2020

Any update on this?

@davidmurdoch
Copy link
Member

I've updated your comment to remove Ben, as he doesn't work on this project anymore.

Thanks for taking the time to file this issue. I've added it to our queue of issues but don't currently have an ETA for the fix.

@davidmurdoch davidmurdoch transferred this issue from trufflesuite/ganache-cli-archive Jan 15, 2020
@fabioberger
Copy link
Author

Thanks for the heads up @davidmurdoch.

@bigspider
Copy link

We ran into this issue as well because of tests using evm_mine.

@gnidan
Copy link
Contributor

gnidan commented Mar 24, 2021

We'll need to look into this. Don't like the sound of it!

Thanks for reporting.

@marmistrz-stc
Copy link

I have a slightly different issue. I'm using eth_getFilterChanges to get notifications for new blocks. If a block is mined because eth_sendTransaction (+ instamine), then I'm properly getting the new block's hash returned by eth_getFilterChanges. However, if I use evm_mine instead, I don't get any new block notifications.

I'm using Ganache 7.0.0 alpha2.

@davidmurdoch
Copy link
Member

@marmistrz-stc can you provide a reproduction script?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Status: Backlog
Development

No branches or pull requests

6 participants