Skip to content

Commit

Permalink
Merge pull request #115 from kaleido-io/fix-error-regex
Browse files Browse the repository at this point in the history
Fix the default regex that is used to check for JSON/RPC provider limits
  • Loading branch information
Chengxuan authored Mar 14, 2024
2 parents b7717ac + ace99cb commit 5ded023
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
|Key|Description|Type|Default Value|
|---|-----------|----|-------------|
|blockTimestamps|Whether to include the block timestamps in the event information|`boolean`|`true`
|catchupDownscaleRegex|An error pattern to check for from JSON/RPC providers if they limit response sizes to eth_getLogs(). If an error is returned from eth_getLogs() and that error matches the configured pattern, the number of logs requested (catchupPageSize) will be reduced automatically.|string|`Response size is larger than.*limit error.`
|catchupDownscaleRegex|An error pattern to check for from JSON/RPC providers if they limit response sizes to eth_getLogs(). If an error is returned from eth_getLogs() and that error matches the configured pattern, the number of logs requested (catchupPageSize) will be reduced automatically.|string|`Response size is larger than.*limit`
|catchupPageSize|Number of blocks to query per poll when catching up to the head of the blockchain|`int`|`500`
|catchupThreshold|How many blocks behind the chain head an event stream or listener must be on startup, to enter catchup mode|`int`|`500`
|checkpointBlockGap|The number of blocks at the head of the chain that should be considered unstable (could be dropped from the canonical chain after a re-org). Unless events with a full set of confirmations are detected, the restart checkpoint will this many blocks behind the chain head.|`int`|`50`
Expand Down
2 changes: 1 addition & 1 deletion internal/ethereum/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const (

DefaultCatchupPageSize = 500
DefaultEventsCatchupThreshold = 500
DefaultEventsCatchupDownscaleRegex = "Response size is larger than.*limit error."
DefaultEventsCatchupDownscaleRegex = "Response size is larger than.*limit"
DefaultEventsCheckpointBlockGap = 50

DefaultRetryInitDelay = "100ms"
Expand Down
4 changes: 2 additions & 2 deletions internal/ethereum/event_listener_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ func TestListenerCatchupScalesBackNTimesOnExpectedError(t *testing.T) {
Number: ethtypes.NewHexInteger64(1001),
}
})
mRPC.On("CallRPC", mock.Anything, mock.Anything, "eth_getLogs", mock.Anything).Return(&rpcbackend.RPCError{Message: "Response size is larger than 150MB limit error."}).Times(5)
mRPC.On("CallRPC", mock.Anything, mock.Anything, "eth_getLogs", mock.Anything).Return(&rpcbackend.RPCError{Message: "Response size is larger than 150MB limit"}).Times(5)
mRPC.On("CallRPC", mock.Anything, mock.Anything, "eth_getLogs", mock.Anything).Return(nil).Run(func(args mock.Arguments) {
*args[1].(*[]*logJSONRPC) = []*logJSONRPC{sampleTransferLog()}
// Cancel the context here so we exit pushing the event
Expand All @@ -255,7 +255,7 @@ func TestListenerCatchupScalesBackToOne(t *testing.T) {
Number: ethtypes.NewHexInteger64(1001),
}
})
mRPC.On("CallRPC", mock.Anything, mock.Anything, "eth_getLogs", mock.Anything).Return(&rpcbackend.RPCError{Message: "Response size is larger than 150MB limit error."}).Times(50)
mRPC.On("CallRPC", mock.Anything, mock.Anything, "eth_getLogs", mock.Anything).Return(&rpcbackend.RPCError{Message: "Response size is larger than 150MB limit"}).Times(50)
mRPC.On("CallRPC", mock.Anything, mock.Anything, "eth_getLogs", mock.Anything).Return(nil).Run(func(args mock.Arguments) {
*args[1].(*[]*logJSONRPC) = []*logJSONRPC{sampleTransferLog()}
// Cancel the context here so we exit pushing the event
Expand Down

0 comments on commit 5ded023

Please sign in to comment.