cmditch / elm-ethereum

dApps in Elm
https://package.elm-lang.org/packages/cmditch/elm-ethereum/1.0.1/
BSD 3-Clause "New" or "Revised" License
146 stars 21 forks source link

Event Sentry returning duplicate events #75

Closed coinop-logan closed 5 years ago

coinop-logan commented 5 years ago

The event sentry seems to reliably return a duplicate event when the filter's block range is fromBlock: Latest, toBlock: [the current latest blocknum]

Well, that's my guess. It happens just after I create a new contract, and then immediately nagivate to a page which loads that contract's event history--using its creation block as the fromBlock and Latest as the toBlock. If I refresh the page, I never get the duplicate event.

cmditch commented 5 years ago

Interesting... Not surprising honestly. Spent a fair amount of time thinking about how to prevent this scenario from happening, but looks like I missed a case.

Have links from the relevant parts of your code by chance?

coinop-logan commented 5 years ago

Oh sure: https://github.com/coinop-logan/toastytrade-lite/blob/master/src/Interact/State.elm#L88

That's from the Interact page. When I use the Create page to initialize a trade, it redirects me to the Interact page as soon as the transaction is mined. Then the Interact pages fetches newCreationInfo, which will then have a blocknum indicating the block number that the creation call was mined in--which just happened seconds ago.

Let me know if you have any other questions!

coinop-logan commented 5 years ago

Seems to have been something in my code! My apologies!