Skip to content

Commit

Permalink
Reduce relay rejection by adjusting session sync allowance
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jorgecuesta committed Aug 7, 2024
1 parent 8d658a4 commit b93e2fd
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/cmd/rpc/mesh/fullnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/robfig/cron/v3"
"io"
log2 "log"
"math"
"net/http"
"net/url"
"strings"
Expand Down Expand Up @@ -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),
)
}

Expand Down

0 comments on commit b93e2fd

Please sign in to comment.