From b93e2fd33cf8ad09207d405d81908483c6e68d37 Mon Sep 17 00:00:00 2001 From: "Jorge S. Cuesta" Date: Wed, 7 Aug 2024 15:07:21 -0400 Subject: [PATCH] Reduce relay rejection by adjusting session sync allowance Decrease the client session sync allowance to improve relay handling within tolerance. This adjustment provides an additional block for mesh to notify the servicer about relays, helping to prevent relay rejection due to evidence sealing. Aim for better session rotation timing with the new configuration. --- app/cmd/rpc/mesh/fullnode.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/cmd/rpc/mesh/fullnode.go b/app/cmd/rpc/mesh/fullnode.go index 64b100876..ad968bb3f 100644 --- a/app/cmd/rpc/mesh/fullnode.go +++ b/app/cmd/rpc/mesh/fullnode.go @@ -13,6 +13,7 @@ import ( "github.com/robfig/cron/v3" "io" log2 "log" + "math" "net/http" "net/url" "strings" @@ -49,11 +50,18 @@ func (node *fullNode) ShouldAssumeOptimisticSession(dispatcherSessionBlockHeight } func (node *fullNode) CanHandleRelayWithinTolerance(dispatcherSessionBlockHeight int64) bool { + // Reduce the amount in one to reduce the number of relays rejected by the node due to evidence sealed (code=90) + // if the servicer allows 1, mesh will allow 0, so mesh has 1 block to keep notifying servicer about relays on + // servicer queue. + // The best here is set the Servicer in 2 or 3 so mesh will receive slow session rotation from gateways up to 1 or 2 + // blocks + clientSessionSyncAllowance := math.Max(float64(0), float64(node.ClientSessionSyncAllowance-1)) + return pocketTypes.IsProofSessionHeightWithinTolerance( node.GetLatestSessionBlockHeight(), node.BlocksPerSession, dispatcherSessionBlockHeight, - node.ClientSessionSyncAllowance, + int64(clientSessionSyncAllowance), ) }