Skip to content

Commit

Permalink
Merge pull request #286 from forta-network/caner/readjust-thresholds
Browse files Browse the repository at this point in the history
Readjust thresholds and add default retry intervals
  • Loading branch information
canercidam authored Nov 6, 2023
2 parents 60cc4e5 + 348a29f commit 7ec6377
Showing 1 changed file with 56 additions and 48 deletions.
104 changes: 56 additions & 48 deletions protocol/settings/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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: 8,
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: 35,
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: 30,
ChainID: 43114,
Name: "Avalanche",
EnableTrace: false,
JsonRpcRateLimiting: defaultRateLimiting,
InspectionInterval: 350,
BlockThreshold: 32,
JSONRPCRetryIntervalSeconds: 4,
},
}

Expand Down

0 comments on commit 7ec6377

Please sign in to comment.