-
Notifications
You must be signed in to change notification settings - Fork 285
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(connector-besu): do not crash if ledger unreachable - send HTTP 503
Primary Changes --------------- 1. Yarn patch to [email protected] so that it does not crash nodejs process Without the catch block, the rejection is an unhandled rejection that bubbles up to the top of the callstack where NodeJS itself catches it and then crashes the entire process. (used to be that it just logged a warning but since some of the newer versions it crashes which allows us to find these bugs in our code / library's code) 2. It is returning a 503 instead of a 500 3. Added a static retry-after header value of 5 seconds 4. Added test case in test-ledger which has run-transaction at the end that is expected to give error 503 when the backing ledger is unavailable Fixes: #3406 Co-authored-by: Peter Somogyvari <[email protected]> Signed-off-by: ruzell22 <[email protected]> Signed-off-by: Peter Somogyvari <[email protected]>
- Loading branch information
Showing
24 changed files
with
1,311 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
.yarn/patches/web3-eth-accounts-npm-1.6.1-c95f31ca81.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/lib/index.js b/lib/index.js | ||
index de2853c247b334e6b22cee42b3e597281c44efdc..787aecf6758228c092f1a3cd8097f64e76cc573d 100644 | ||
--- a/lib/index.js | ||
+++ b/lib/index.js | ||
@@ -344,7 +344,7 @@ function _handleTxPricing(_this, tx) { | ||
throw Error("Network doesn't support eip-1559"); | ||
resolve({ gasPrice }); | ||
} | ||
- }); | ||
+ }).catch((ex) => reject(ex)); | ||
} | ||
} | ||
catch (error) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
157 changes: 157 additions & 0 deletions
157
packages/cactus-common/src/main/typescript/http/http-header.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
/** | ||
* A list of well-known headers as published on Wikipedia. | ||
* @see https://en.wikipedia.org/wiki/List_of_HTTP_header_fields | ||
* | ||
* TODO Finish documenting each enum item and make sure to also include | ||
* the examples provided on the linked Wikipedia page above. The first | ||
* few headers are documented this way but we need all of them like that. | ||
* | ||
* TODO Ensure that there are no typos in the header names. | ||
*/ | ||
export enum HttpHeader { | ||
// Standard request fields | ||
|
||
/** | ||
* Acceptable instance-manipulations for the request. | ||
* @example A-IM: feed | ||
* @see https://datatracker.ietf.org/doc/html/rfc3229 | ||
*/ | ||
A_IM = "A-IM", | ||
/** | ||
* Media type(s) that is/are acceptable for the response. See Content negotiation. | ||
* @example Accept: text/html | ||
* @see https://datatracker.ietf.org/doc/html/rfc9110 | ||
*/ | ||
Accept = "Accept", | ||
/** | ||
* Character sets that are acceptable. | ||
* @example Accept-Charset: utf-8 | ||
* @see https://datatracker.ietf.org/doc/html/rfc9110 | ||
*/ | ||
AcceptCharset = "Accept-Charset", | ||
/** | ||
* Acceptable version in time. | ||
* @example Accept-Datetime: Thu, 31 May 2007 20:35:00 GMT | ||
* @see https://datatracker.ietf.org/doc/html/rfc7089 | ||
*/ | ||
AcceptDatetime = "Accept-Datetime", | ||
AcceptEncoding = "Accept-Encoding", | ||
AcceptLanguage = "Accept-Language", | ||
AccessControlAllowOrigin = "Access-Control-Allow-Origin", | ||
AccessControlAllowCredentials = "Access-Control-Allow-Credentials", | ||
AccessControlExposeHeaders = "Access-Control-Expose-Headers", | ||
AccessControlMaxAge = "Access-Control-Max-Age", | ||
AccessControlAllowMethods = "Access-Control-Allow-Methods", | ||
AccessControlAllowHeaders = "Access-Control-Allow-Headers", | ||
Authorization = "Authorization", | ||
CacheControl = "Cache-Control", | ||
Connection = "Connection", | ||
ContentDisposition = "Content-Disposition", | ||
ContentEncoding = "Content-Encoding", | ||
ContentLength = "Content-Length", | ||
ContentLocation = "Content-Location", | ||
ContentMD5 = "Content-MD5", | ||
ContentType = "Content-Type", | ||
Cookie = "Cookie", | ||
Date = "Date", | ||
Expect = "Expect", | ||
Forwarded = "Forwarded", | ||
From = "From", | ||
Host = "Host", | ||
IfMatch = "If-Match", | ||
IfModifiedSince = "If-Modified-Since", | ||
IfNoneMatch = "If-None-Match", | ||
IfRange = "If-Range", | ||
IfUnmodifiedSince = "If-Unmodified-Since", | ||
MaxForwards = "Max-Forwards", | ||
Origin = "Origin", | ||
Pragma = "Pragma", | ||
Prefer = "Prefer", | ||
ProxyAuthorization = "Proxy-Authorization", | ||
Range = "Range", | ||
Referer = "Referer", | ||
TE = "TE", | ||
Trailer = "Trailer", | ||
TransferEncoding = "Transfer-Encoding", | ||
Upgrade = "Upgrade", | ||
UserAgent = "User-Agent", | ||
|
||
// Common non-standard request fields | ||
UpgradeInsecureRequests = "Upgrade-Insecure-Requests", | ||
XRequestedWith = "X-Requested-With", | ||
DNT = "DNT", | ||
XForwardedFor = "X-Forwarded-For", | ||
XForwardedHost = "X-Forwarded-Host", | ||
XForwardedProto = "X-Forwarded-Proto", | ||
FrontEndHttps = "Front-End-Https", | ||
XHttpMethodOverride = "X-Http-Method-Override", | ||
XAttDeviceId = "X-Att-DeviceId", | ||
XWapProfile = "X-Wap-Profile", | ||
ProxyConnection = "Proxy-Connection", | ||
XUIDH = "X-UIDH", | ||
XCsrfToken = "X-Csrf-Token", | ||
XRequestId = "X-Request-ID", // Alternative X-Request-Id | ||
CorrelationId = "X-Correlation-ID", // Alternative Correlation-ID | ||
SaveData = "Save-Data", | ||
SecGpc = "Sec-GPC", | ||
|
||
// Standard response fields | ||
AcceptCH = "Accept-CH", | ||
AcceptPatch = "Accept-Patch", | ||
AltSvc = "Alt-Svc", | ||
Age = "Age", | ||
Allow = "Allow", | ||
Expires = "Expires", | ||
IM = "IM", | ||
LastModified = "Last-Modified", | ||
Link = "Link", | ||
Location = "Location", | ||
P3P = "P3P", | ||
ProxyAuthenticate = "Proxy-Authenticate", | ||
PublicKeyPins = "Public-Key-Pins", | ||
/** | ||
* f an entity is temporarily unavailable, this instructs the client | ||
* to try again later. Value could be a specified period of time | ||
* (in seconds) or a HTTP-date. | ||
* | ||
* There are two accepted formats when it comes to the values of the header: | ||
* ```http | ||
* Retry-After: <http-date> | ||
* Retry-After: <delay-seconds> | ||
* ``` | ||
* | ||
* `<http-date>` | ||
* A date after which to retry. See the Date header for more details on the HTTP date format. | ||
* | ||
* `<delay-seconds>` | ||
* A non-negative decimal integer indicating the seconds to delay after the response is received. | ||
* | ||
* @example Retry-After: 120 | ||
* @example Retry-After: Fri, 07 Nov 2014 23:59:59 GMT | ||
* | ||
* @see https://datatracker.ietf.org/doc/html/rfc9110#section-10.2.3 | ||
*/ | ||
RetryAfter = "Retry-After", | ||
Server = "Server", | ||
SetCookie = "Set-Cookie", | ||
StrictTransportSecurity = "Strict-Transport-Security", | ||
Tk = "Tk", | ||
Vary = "Vary", | ||
Via = "Via", // Same as request field | ||
/** | ||
* Indicates the authentication scheme that should be used to access the requested entity. | ||
* @example WWW-Authenticate: Basic | ||
* @see https://datatracker.ietf.org/doc/html/rfc9110 | ||
*/ | ||
WWWAuthenticate = "WWW-Authenticate", | ||
XFrameOptions = "X-Frame-Options", | ||
|
||
// Common non-standard response fields | ||
ContentSecurityPolicy = "Content-Security-Policy", | ||
ExpectCT = "Expect-CT", | ||
NEL = "NEL", | ||
PermissionsPolicy = "Permissions-Policy", | ||
Refresh = "Refresh", | ||
ReportTo = "Report-To", | ||
Timing_Allow_Origin = "Timing-Allow-Origin", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.