Hi, I need a dev to take a look at this problem.
I’ve tried in a couple of ways and I’m starting to think that either I’m misunderstanding something or there is a problem in how you emit events in your smart contract(Matterhorn)
Basically, what I’ve found is that there is a mistmatch in the subgraph depending on which events you watch, specifically in the number of channels opened. I’ve deployed 2 subgraphs to demonstrate the issue, this is your subgraph (from hopr community) thegraph (dot) com/hosted-service/subgraph/eliaxie/hopr-channels (approx 2500 open channels) and this is the one I’ve developed thegraph (dot) com/hosted-service/subgraph/eliaxie/hopr-subgraph-v2 (approx 500 open channels).
So, what’s the code behind them
for the first one, I’ve deployed directly this github(dot)com/hoprnet/hopr-community/tree/main/subgraph-channels
For the second one I’ve got 2 version, 1 that I wrote myself and found the approx 500 entities and then to double check I’ve taken your code (the one for the first subgraph) and split it in ChannelOpened and ChannelClosureInitiated instead of watching channelUpdate, as you can see here github(dot)com/Eliaxie/HoprSubgraph/blob/main/src/mapping.ts
The result is that even with basically the same code from the first subgraph (I’ve just replicated the two parts, removed some parameters in the nodes which was impossible to get from those 2 events, and splitted the logic in the 2 events instead of channelUpdated), we have 500 instead of 2500 open channels on the subgraph. As I’m developing the subgraph to be used inside a bounty, I’m not sure which one to use