Skip to content

Commit e113336

Browse files
committed
Fix rewards snapshot not being called when POI presented is 0x0 (#459)
When an indexer calls closeAllocation() with a POI=0x0 the function distributeRewards() is not called, as a consequence, takeRewards() is not called and in turn the snapshots are not updated before unallocating tokens. This creates a situation where the rewards manager considers there are a different amount of allocated tokens and distort calculations until it is called next time. This fix will call `_updateRewards()` when the POI presented is 0x0 before unallocating the tokens.
1 parent 2de7b5e commit e113336

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

contracts/staking/Staking.sol

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1195,6 +1195,8 @@ contract Staking is StakingV2Storage, GraphUpgradeable, IStaking {
11951195
// Distribute rewards if proof of indexing was presented by the indexer or operator
11961196
if (isIndexer && _poi != 0) {
11971197
_distributeRewards(_allocationID, alloc.indexer);
1198+
} else {
1199+
_updateRewards(alloc.subgraphDeploymentID);
11981200
}
11991201

12001202
// Free allocated tokens from use

0 commit comments

Comments
 (0)