Update Pools for delayed collections#197
Update Pools for delayed collections#197Data-Nexus wants to merge 2 commits intographprotocol:masterfrom
Conversation
|
Great catch @Data-Nexus! Although after going through the code I found another potential bug that wouldn't allow this to work as expected: Because of how createOrLoadEpoch works, if the epoch was already created at some point, we won't get the epoch we want, but actually the current one: https://github.com/Data-Nexus-Web3/graph-network-subgraph/blob/b7380721c35d0b9c9a2af3b86b481422335d58c5/src/mappings/helpers.ts#L379-L408 Because of this line: https://github.com/Data-Nexus-Web3/graph-network-subgraph/blob/b7380721c35d0b9c9a2af3b86b481422335d58c5/src/mappings/helpers.ts#L403-L406 |
Very minor change to detect delayed collections (collect in an epoch grater than the closedAtEpoch).
Per the Staking.sol contract, query fees are added to the rebate pool in which the allocation was closed (not when the collect function is run).
Updated pool to attempt to use the closedAtEpoch if available, otherwise use the current epoch, but only update
epoch.queryFeesCollectedandpool.totalQueryFeeswhen the allocation is closed so it can mirror what's seen in the rebate pool.Example: Epoch 634 has a total
feesof765540551752580194585per the Staking Contract yet thepool.totalQueryFeesshows918822211489531994645. queryConsideration: What happens if an allocation is collected on twice post allocation closure? This doesn't appear to be prevented in the contract and could result in double counting.