From 3cd6061ecd25bb833dade00962dffbca712f9d11 Mon Sep 17 00:00:00 2001 From: Oren Date: Sun, 13 Oct 2024 16:35:07 +0300 Subject: [PATCH] CNS-1009: create new cache ctx in the query to make sure the query doesn't change the state --- x/subscription/keeper/grpc_query_estimated_rewards.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/x/subscription/keeper/grpc_query_estimated_rewards.go b/x/subscription/keeper/grpc_query_estimated_rewards.go index 1ba83b603e..a2ae7442cf 100644 --- a/x/subscription/keeper/grpc_query_estimated_rewards.go +++ b/x/subscription/keeper/grpc_query_estimated_rewards.go @@ -21,7 +21,9 @@ func (k Keeper) EstimatedProviderRewards(goCtx context.Context, req *types.Query if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - ctx := sdk.UnwrapSDKContext(goCtx) + oldCtx := sdk.UnwrapSDKContext(goCtx) + ctx, _ := oldCtx.CacheContext() // verify the original ctx is not changed + res := types.QueryEstimatedRewardsResponse{} details := []utils.Attribute{