From f38e651e9224c8cb385166f96582f180282956d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caner=20=C3=87=C4=B1dam?= Date: Mon, 6 Nov 2023 14:22:04 +0300 Subject: [PATCH 1/2] readjust chain thresholds --- protocol/settings/chain.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/protocol/settings/chain.go b/protocol/settings/chain.go index b56fda04..e5677a6e 100644 --- a/protocol/settings/chain.go +++ b/protocol/settings/chain.go @@ -40,7 +40,7 @@ var allChainSettings = []ChainSettings{ EnableTrace: false, JsonRpcRateLimiting: defaultRateLimiting, InspectionInterval: 100, - BlockThreshold: 8, + BlockThreshold: 10, }, { ChainID: 56, @@ -64,7 +64,7 @@ var allChainSettings = []ChainSettings{ EnableTrace: true, JsonRpcRateLimiting: defaultRateLimiting, InspectionInterval: 750, - BlockThreshold: 35, + BlockThreshold: 37, }, { ChainID: 42161, @@ -80,7 +80,7 @@ var allChainSettings = []ChainSettings{ EnableTrace: false, JsonRpcRateLimiting: defaultRateLimiting, InspectionInterval: 350, - BlockThreshold: 30, + BlockThreshold: 32, }, } From 348a29f7037cec97dcb42c01e9d047d8fdbf71ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caner=20=C3=87=C4=B1dam?= Date: Mon, 6 Nov 2023 14:27:26 +0300 Subject: [PATCH 2/2] add retry intervals --- protocol/settings/chain.go | 104 ++++++++++++++++++++----------------- 1 file changed, 56 insertions(+), 48 deletions(-) diff --git a/protocol/settings/chain.go b/protocol/settings/chain.go index e5677a6e..7b706ffb 100644 --- a/protocol/settings/chain.go +++ b/protocol/settings/chain.go @@ -7,12 +7,13 @@ var defaultRateLimiting = &RateLimit{ // ChainSettings contains chain-specific settings. type ChainSettings struct { - ChainID int - Name string - EnableTrace bool - JsonRpcRateLimiting *RateLimit - InspectionInterval int // in block number - BlockThreshold int + ChainID int + Name string + EnableTrace bool + JsonRpcRateLimiting *RateLimit + InspectionInterval int // in block number + BlockThreshold int + JSONRPCRetryIntervalSeconds int } // RateLimit is token bucket algorithm parameters. @@ -27,60 +28,67 @@ type RateLimit struct { // safe offsets are adjusted to be 5-10% of the block threshold (at least 1) var allChainSettings = []ChainSettings{ { - ChainID: 1, - Name: "Ethereum Mainnet", - EnableTrace: true, - JsonRpcRateLimiting: defaultRateLimiting, - InspectionInterval: 50, - BlockThreshold: 8, + ChainID: 1, + Name: "Ethereum Mainnet", + EnableTrace: true, + JsonRpcRateLimiting: defaultRateLimiting, + InspectionInterval: 50, + BlockThreshold: 8, + JSONRPCRetryIntervalSeconds: 8, }, { - ChainID: 10, - Name: "Optimism", - EnableTrace: false, - JsonRpcRateLimiting: defaultRateLimiting, - InspectionInterval: 100, - BlockThreshold: 10, + ChainID: 10, + Name: "Optimism", + EnableTrace: false, + JsonRpcRateLimiting: defaultRateLimiting, + InspectionInterval: 100, + BlockThreshold: 10, + JSONRPCRetryIntervalSeconds: 4, }, { - ChainID: 56, - Name: "BSC", - EnableTrace: false, - JsonRpcRateLimiting: defaultRateLimiting, - InspectionInterval: 250, - BlockThreshold: 20, + ChainID: 56, + Name: "BSC", + EnableTrace: false, + JsonRpcRateLimiting: defaultRateLimiting, + InspectionInterval: 250, + BlockThreshold: 20, + JSONRPCRetryIntervalSeconds: 4, }, { - ChainID: 137, - Name: "Polygon", - EnableTrace: false, - JsonRpcRateLimiting: defaultRateLimiting, - InspectionInterval: 70, - BlockThreshold: 30, + ChainID: 137, + Name: "Polygon", + EnableTrace: false, + JsonRpcRateLimiting: defaultRateLimiting, + InspectionInterval: 70, + BlockThreshold: 30, + JSONRPCRetryIntervalSeconds: 4, }, { - ChainID: 250, - Name: "Fantom", - EnableTrace: true, - JsonRpcRateLimiting: defaultRateLimiting, - InspectionInterval: 750, - BlockThreshold: 37, + ChainID: 250, + Name: "Fantom", + EnableTrace: true, + JsonRpcRateLimiting: defaultRateLimiting, + InspectionInterval: 750, + BlockThreshold: 37, + JSONRPCRetryIntervalSeconds: 4, }, { - ChainID: 42161, - Name: "Arbitrum", - EnableTrace: false, - JsonRpcRateLimiting: defaultRateLimiting, - InspectionInterval: 1500, - BlockThreshold: 80, + ChainID: 42161, + Name: "Arbitrum", + EnableTrace: false, + JsonRpcRateLimiting: defaultRateLimiting, + InspectionInterval: 1500, + BlockThreshold: 80, + JSONRPCRetryIntervalSeconds: 4, }, { - ChainID: 43114, - Name: "Avalanche", - EnableTrace: false, - JsonRpcRateLimiting: defaultRateLimiting, - InspectionInterval: 350, - BlockThreshold: 32, + ChainID: 43114, + Name: "Avalanche", + EnableTrace: false, + JsonRpcRateLimiting: defaultRateLimiting, + InspectionInterval: 350, + BlockThreshold: 32, + JSONRPCRetryIntervalSeconds: 4, }, }