2

I am developing an application using solidity, web3js and eventeum. I am testing it locally using ganache-cli. I use Kafka to store all the events to process them at convenience instead of processing them directly.

  • The problem is that when I do truffle tests using my contract logic, the events are logged exactly in the order they were emitted.
  • When eventeum captures them, the events do not appear in order in the kafka topic.
  • When I listen to the same events simultaneously in separate web3js callback functions, they sometimes appear out of order.
  • All these events are emitted within a single transaction.
  • I am connected to the ganache from web3 and eventeum using http://localhost:8545 as the endpoint for provider.

Is it normal that events from events to appear out of order within a single transaction?

P.S.

  • Does connecting using ws:// make a difference?
  • Is it an anomaly with ganache-cli?
arnabkaycee
  • 141
  • 1
  • Possible suspect: I also read this post : https://ethereum.stackexchange.com/questions/63745/can-we-assume-that-ethereum-events-aka-logs-are-in-sequence which says that for long chain of functions the order might get reversed. Any articles/posts on this as well. – arnabkaycee Mar 02 '21 at 16:30
  • @amabkaycee That out-of-orderedness is because the contracts themselves emit them in an undesired order but it should still be consistent. – Rob Hitchens Mar 02 '21 at 17:57
  • 1
    In this case, I suspect the issue is asynchronous activities creating race conditions on the listener side. There is always a deterministic order on the blockchain side. – Rob Hitchens Mar 02 '21 at 17:58

0 Answers0