You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GetRewardsEst(which is called in RewardsEst grpc query) calls FilteredLocksDistributionEst, which iterates all over the locked tokens(https://github.com/osmosis-labs/osmosis/blob/main/x/incentives/keeper/pot.go#L164). This causes issues on performance side, as it need to recalculate the reward every time when the query happens.
The suggested solution is limit the lockup period to the epoch, and make the lockup module updates the total amount when there is lock related event happens. The incentive module will read the cached state when queried.
GetRewardsEst is for a single address, so we should be able to determine the rewards for that address without iterating over all locks. We just need to get the locks associated with that address, and the total amount of shares for each pot that the lock contributes to. Then we can calculate the reward going to that address
GetRewardsEst
(which is called inRewardsEst
grpc query) callsFilteredLocksDistributionEst
, which iterates all over the locked tokens(https://github.com/osmosis-labs/osmosis/blob/main/x/incentives/keeper/pot.go#L164). This causes issues on performance side, as it need to recalculate the reward every time when the query happens.The suggested solution is limit the lockup period to the epoch, and make the lockup module updates the total amount when there is lock related event happens. The incentive module will read the cached state when queried.
ref @Thunnini
The text was updated successfully, but these errors were encountered: