Skip to content

Commit

Permalink
feat: add down-scoring for metadata ssz size error (#6366)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewkeil committed Jan 29, 2024
1 parent 6adbd27 commit 291e178
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/beacon-node/src/network/reqresp/score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export function onOutgoingReqRespError(e: RequestError, method: ReqRespMethod):
switch (e.type.code) {
case RequestErrorCode.INVALID_REQUEST:
case RequestErrorCode.INVALID_RESPONSE_SSZ:
case RequestErrorCode.SSZ_OVER_MAX_SIZE:
return PeerAction.LowToleranceError;

case RequestErrorCode.SERVER_ERROR:
Expand Down
5 changes: 4 additions & 1 deletion packages/reqresp/src/request/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ export enum RequestErrorCode {
RESP_TIMEOUT = "REQUEST_ERROR_RESP_TIMEOUT",
/** Request rate limited */
REQUEST_RATE_LIMITED = "REQUEST_ERROR_RATE_LIMITED",
/** */
SSZ_OVER_MAX_SIZE = "SSZ_SNAPPY_ERROR_OVER_SSZ_MAX_SIZE",
}

type RequestErrorType =
Expand All @@ -47,7 +49,8 @@ type RequestErrorType =
| {code: RequestErrorCode.EMPTY_RESPONSE}
| {code: RequestErrorCode.TTFB_TIMEOUT}
| {code: RequestErrorCode.RESP_TIMEOUT}
| {code: RequestErrorCode.REQUEST_RATE_LIMITED};
| {code: RequestErrorCode.REQUEST_RATE_LIMITED}
| {code: RequestErrorCode.SSZ_OVER_MAX_SIZE};

export const REQUEST_ERROR_CLASS_NAME = "RequestError";

Expand Down

0 comments on commit 291e178

Please sign in to comment.