Use Nimbus specific agent string instead of nim-presto defaults. (#6424)
* Use Nimbus specific agent string instead of nim-presto defaults. Use response(code) overload. * Fix REST API test.
This commit is contained in:
parent
baa085e8b1
commit
f751fde417
|
@ -826,6 +826,7 @@ proc init*(T: type BeaconNode,
|
||||||
RestServerRef.init(config.restAddress, config.restPort,
|
RestServerRef.init(config.restAddress, config.restPort,
|
||||||
config.restAllowedOrigin,
|
config.restAllowedOrigin,
|
||||||
validateBeaconApiQueries,
|
validateBeaconApiQueries,
|
||||||
|
nimbusAgentStr,
|
||||||
config)
|
config)
|
||||||
else:
|
else:
|
||||||
nil
|
nil
|
||||||
|
|
|
@ -357,6 +357,7 @@ proc init*(T: type RestServerRef,
|
||||||
port: Port,
|
port: Port,
|
||||||
allowedOrigin: Option[string],
|
allowedOrigin: Option[string],
|
||||||
validateFn: PatternCallback,
|
validateFn: PatternCallback,
|
||||||
|
ident: string,
|
||||||
config: AnyConf): T =
|
config: AnyConf): T =
|
||||||
let
|
let
|
||||||
address = initTAddress(ip, port)
|
address = initTAddress(ip, port)
|
||||||
|
@ -375,6 +376,7 @@ proc init*(T: type RestServerRef,
|
||||||
|
|
||||||
let res = RestServerRef.new(RestRouter.init(validateFn, allowedOrigin),
|
let res = RestServerRef.new(RestRouter.init(validateFn, allowedOrigin),
|
||||||
address, serverFlags = serverFlags,
|
address, serverFlags = serverFlags,
|
||||||
|
serverIdent = ident,
|
||||||
httpHeadersTimeout = headersTimeout,
|
httpHeadersTimeout = headersTimeout,
|
||||||
maxHeadersSize = maxHeadersSize,
|
maxHeadersSize = maxHeadersSize,
|
||||||
maxRequestBodySize = maxRequestBodySize,
|
maxRequestBodySize = maxRequestBodySize,
|
||||||
|
@ -428,11 +430,13 @@ proc initKeymanagerServer*(
|
||||||
RestServerRef.init(config.keymanagerAddress, config.keymanagerPort,
|
RestServerRef.init(config.keymanagerAddress, config.keymanagerPort,
|
||||||
config.keymanagerAllowedOrigin,
|
config.keymanagerAllowedOrigin,
|
||||||
validateKeymanagerApiQueries,
|
validateKeymanagerApiQueries,
|
||||||
|
nimbusAgentStr,
|
||||||
config)
|
config)
|
||||||
else:
|
else:
|
||||||
RestServerRef.init(config.keymanagerAddress, config.keymanagerPort,
|
RestServerRef.init(config.keymanagerAddress, config.keymanagerPort,
|
||||||
config.keymanagerAllowedOrigin,
|
config.keymanagerAllowedOrigin,
|
||||||
validateKeymanagerApiQueries,
|
validateKeymanagerApiQueries,
|
||||||
|
nimbusAgentStr,
|
||||||
config)
|
config)
|
||||||
else:
|
else:
|
||||||
nil
|
nil
|
||||||
|
|
|
@ -141,7 +141,7 @@ proc getP2PAddresses(node: BeaconNode): seq[string] =
|
||||||
proc installNodeApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
proc installNodeApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
let
|
let
|
||||||
cachedVersion =
|
cachedVersion =
|
||||||
RestApiResponse.prepareJsonResponse((version: "Nimbus/" & fullVersionStr))
|
RestApiResponse.prepareJsonResponse((version: nimbusAgentStr))
|
||||||
|
|
||||||
# https://ethereum.github.io/beacon-APIs/#/Node/getNetworkIdentity
|
# https://ethereum.github.io/beacon-APIs/#/Node/getNetworkIdentity
|
||||||
router.api2(MethodGet, "/eth/v1/node/identity") do () -> RestApiResponse:
|
router.api2(MethodGet, "/eth/v1/node/identity") do () -> RestApiResponse:
|
||||||
|
@ -283,4 +283,4 @@ proc installNodeApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
Http206
|
Http206
|
||||||
else:
|
else:
|
||||||
Http200
|
Http200
|
||||||
RestApiResponse.response("", status, contentType = "")
|
RestApiResponse.response(status)
|
||||||
|
|
|
@ -1102,7 +1102,7 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
numUpdatedFeeRecipients = numUpdated,
|
numUpdatedFeeRecipients = numUpdated,
|
||||||
numRefreshedFeeRecipients = numRefreshed
|
numRefreshedFeeRecipients = numRefreshed
|
||||||
|
|
||||||
RestApiResponse.response("", Http200, "text/plain")
|
RestApiResponse.response(Http200)
|
||||||
|
|
||||||
# https://ethereum.github.io/beacon-APIs/#/Validator/registerValidator
|
# https://ethereum.github.io/beacon-APIs/#/Validator/registerValidator
|
||||||
# https://github.com/ethereum/beacon-APIs/blob/v2.3.0/apis/validator/register_validator.yaml
|
# https://github.com/ethereum/beacon-APIs/blob/v2.3.0/apis/validator/register_validator.yaml
|
||||||
|
@ -1129,7 +1129,7 @@ proc installValidatorApiHandlers*(router: var RestRouter, node: BeaconNode) =
|
||||||
node.externalBuilderRegistrations[signedValidatorRegistration.message.pubkey] =
|
node.externalBuilderRegistrations[signedValidatorRegistration.message.pubkey] =
|
||||||
signedValidatorRegistration
|
signedValidatorRegistration
|
||||||
|
|
||||||
RestApiResponse.response("", Http200, "text/plain")
|
RestApiResponse.response(Http200)
|
||||||
|
|
||||||
# https://ethereum.github.io/beacon-APIs/#/Validator/getLiveness
|
# https://ethereum.github.io/beacon-APIs/#/Validator/getLiveness
|
||||||
router.api2(MethodPost, "/eth/v1/validator/liveness/{epoch}") do (
|
router.api2(MethodPost, "/eth/v1/validator/liveness/{epoch}") do (
|
||||||
|
|
|
@ -51,6 +51,8 @@ const
|
||||||
|
|
||||||
fullVersionStr* = "v" & versionAsStr & "-" & gitRevision & "-" & versionBlob
|
fullVersionStr* = "v" & versionAsStr & "-" & gitRevision & "-" & versionBlob
|
||||||
|
|
||||||
|
nimbusAgentStr* = "Nimbus/" & fullVersionStr
|
||||||
|
|
||||||
func getNimGitHash*(): string =
|
func getNimGitHash*(): string =
|
||||||
const gitPrefix = "git hash: "
|
const gitPrefix = "git hash: "
|
||||||
let tmp = splitLines(nimFullBanner)
|
let tmp = splitLines(nimFullBanner)
|
||||||
|
|
|
@ -4748,8 +4748,7 @@
|
||||||
"body": {"content-type": "application/json", "data": "[{\"message\":{\"fee_recipient\":\"0xb943c2c22b1b186a34f47c4dbe2fe367de9ec180\",\"gas_limit\":\"40000000\",\"timestamp\":\"1661879190\",\"pubkey\":\"0xa37b7bb9c412b8cc318fabf7b1fec33eb9634680687f07b977393180ce99889dbcfda81900f3afb9f2281930cf49f5d8\"},\"signature\":\"0xa493085fab365d13bea2376434abc3dbfba00a576276c853acabd7b9cb2f2b4b0a90738dd9baeaef75d0f42fa94119a70a09b0ed38fbebb6dde92c9ca062447018821f36c19d6fe34eb8c357d62e5d33e5c1d35035472ef7dd22a7425cdba0c5\"}]"}
|
"body": {"content-type": "application/json", "data": "[{\"message\":{\"fee_recipient\":\"0xb943c2c22b1b186a34f47c4dbe2fe367de9ec180\",\"gas_limit\":\"40000000\",\"timestamp\":\"1661879190\",\"pubkey\":\"0xa37b7bb9c412b8cc318fabf7b1fec33eb9634680687f07b977393180ce99889dbcfda81900f3afb9f2281930cf49f5d8\"},\"signature\":\"0xa493085fab365d13bea2376434abc3dbfba00a576276c853acabd7b9cb2f2b4b0a90738dd9baeaef75d0f42fa94119a70a09b0ed38fbebb6dde92c9ca062447018821f36c19d6fe34eb8c357d62e5d33e5c1d35035472ef7dd22a7425cdba0c5\"}]"}
|
||||||
},
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"status": {"operator": "equals", "value": "200"},
|
"status": {"operator": "equals", "value": "200"}
|
||||||
"headers": [{"key": "Content-Type", "value": "text/plain", "operator": "equals"}]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue