8

A contract I wrote has an event in its constructor. Since I want to find it back in the logs it doesn't seem possible to start listening to the latest block. Because the event is already 'fired' during the creation of the instance.

So I lookup the event throughout the entire chain starting at the genesis block:

instatiatedEvent = instance.InstatiatedEvent({'senderAddress': senderAddressMock, 
'ownerAddress': ownerAddressMock}, {fromBlock: 0, toBlock: 'latest'});

Both event parameters are indexed.

I tested it on a private blockchain and it the filtering worked, but when I test it on TESTRPC, it returns all the events of the contract instance - without filtering.

Can someone confirm that this functionality isn't working in TESTRPC?

  • I can confirm that I have the same problem with TestRPC v2.0.9. In my case, it even returns all events of all instances of my contract. Can you open an issue? – Xavier Leprêtre B9lab Aug 26 '16 at 16:06
  • This post saved me many hours. +1 Have the same issue with v2.2.3. – Age Sep 1 '16 at 14:55
  • Sounds stupid, but sometimes (in my experience with different eth-libraries) the string 'latest' doesn't seem to work. Try putting a number for the toBlock. – DaveIdito Jun 19 '18 at 3:30
0

This is no longer an issue with Ganache CLI v6.1.0 (ganache-core: 2.1.0)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.