Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readjust thresholds and add default retry intervals #286

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading