Increase REST server default limits. (#2991)

* Increase REST server default limits.

* Fix compilation error.

* Fix tests.
This commit is contained in:
Eugene Kabanov 2021-10-18 10:14:44 +03:00 committed by GitHub
parent b66e7c8573
commit 75a8fe3b2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View File

@ -65,9 +65,14 @@ template init(T: type RestServerRef, ip: ValidIpAddress, port: Port): T =
HttpServerFlags.NotifyDisconnect} HttpServerFlags.NotifyDisconnect}
# We increase default timeout to help validator clients who poll our server # We increase default timeout to help validator clients who poll our server
# at least once per slot (12.seconds). # at least once per slot (12.seconds).
let headersTimeout = seconds(2'i64 * int64(SECONDS_PER_SLOT)) let
headersTimeout = seconds(2'i64 * int64(SECONDS_PER_SLOT))
maxHeadersSize = 65536 # 64 kilobytes
maxRequestBodySize = 16_777_216 # 16 megabytes
let res = RestServerRef.new(getRouter(), address, serverFlags = serverFlags, let res = RestServerRef.new(getRouter(), address, serverFlags = serverFlags,
httpHeadersTimeout = headersTimeout) httpHeadersTimeout = headersTimeout,
maxHeadersSize = maxHeadersSize,
maxRequestBodySize = maxRequestBodySize)
if res.isErr(): if res.isErr():
notice "Rest server could not be started", address = $address, notice "Rest server could not be started", address = $address,
reason = res.error() reason = res.error()

View File

@ -24,7 +24,7 @@ export forks, phase0, altair
const const
# https://github.com/ethereum/eth2.0-APIs/blob/master/apis/beacon/states/validator_balances.yaml#L17 # https://github.com/ethereum/eth2.0-APIs/blob/master/apis/beacon/states/validator_balances.yaml#L17
# https://github.com/ethereum/eth2.0-APIs/blob/master/apis/beacon/states/validators.yaml#L17 # https://github.com/ethereum/eth2.0-APIs/blob/master/apis/beacon/states/validators.yaml#L17
MaximumValidatorIds* = 30 MaximumValidatorIds* = 16384
type type
EventTopic* {.pure.} = enum EventTopic* {.pure.} = enum

View File

@ -531,9 +531,9 @@
"headers": {"Accept": "application/json"} "headers": {"Accept": "application/json"}
}, },
"response": { "response": {
"status": {"operator": "equals", "value": "400"}, "status": {"operator": "equals", "value": "200"},
"headers": [{"key": "Content-Type", "value": "application/json", "operator": "equals"}], "headers": [{"key": "Content-Type", "value": "application/json", "operator": "equals"}],
"body": [{"operator": "jstructcmpns", "value": {"code": "", "message": ""}}] "body": [{"operator": "jstructcmps", "start": ["data"], "value": [{"index": "", "balance": "", "status": "", "validator": {"pubkey": "", "withdrawal_credentials": "", "effective_balance": "", "slashed": false, "activation_eligibility_epoch": "", "activation_epoch": "", "exit_epoch": "", "withdrawable_epoch": ""}}]}]
} }
}, },
{ {
@ -1218,9 +1218,9 @@
"headers": {"Accept": "application/json"} "headers": {"Accept": "application/json"}
}, },
"response": { "response": {
"status": {"operator": "equals", "value": "400"}, "status": {"operator": "equals", "value": "200"},
"headers": [{"key": "Content-Type", "value": "application/json", "operator": "equals"}], "headers": [{"key": "Content-Type", "value": "application/json", "operator": "equals"}],
"body": [{"operator": "jstructcmpns", "value": {"code": "", "message": ""}}] "body": [{"operator": "jstructcmps", "start": ["data"], "value": [{"index": "", "balance": ""}]}]
} }
}, },
{ {