Correct URLs for the DeleteKeys request in the Keymanager API (#3727)

Other changes:

* Make it easier to run the REST tests locally through a Makefile target
This commit is contained in:
zah 2022-06-19 20:54:12 +03:00 committed by GitHub
parent b3caacd59d
commit 5402dfab6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 23 deletions

View File

@ -110,12 +110,12 @@ OK: 2/2 Fail: 0/2 Skip: 0/2
OK: 2/2 Fail: 0/2 Skip: 0/2
## DeleteKeys requests [Preset: mainnet]
```diff
+ Deleting not existing key [Preset: mainnet] OK
+ Invalid Authorization Header [Preset: mainnet] OK
+ Invalid Authorization Token [Preset: mainnet] OK
+ Missing Authorization header [Preset: mainnet] OK
- Deleting not existing key [Preset: mainnet] Fail
- Invalid Authorization Header [Preset: mainnet] Fail
- Invalid Authorization Token [Preset: mainnet] Fail
- Missing Authorization header [Preset: mainnet] Fail
```
OK: 4/4 Fail: 0/4 Skip: 0/4
OK: 0/4 Fail: 4/4 Skip: 0/4
## DeleteRemoteKeys requests [Preset: mainnet]
```diff
+ Deleting existing local key and remote key [Preset: mainnet] OK
@ -224,12 +224,12 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
OK: 4/4 Fail: 0/4 Skip: 0/4
## ImportKeystores requests [Preset: mainnet]
```diff
+ ImportKeystores/ListKeystores/DeleteKeystores [Preset: mainnet] OK
- ImportKeystores/ListKeystores/DeleteKeystores [Preset: mainnet] Fail
+ Invalid Authorization Header [Preset: mainnet] OK
+ Invalid Authorization Token [Preset: mainnet] OK
+ Missing Authorization header [Preset: mainnet] OK
- Missing Authorization header [Preset: mainnet] Fail
```
OK: 4/4 Fail: 0/4 Skip: 0/4
OK: 2/4 Fail: 2/4 Skip: 0/4
## ImportRemoteKeys/ListRemoteKeys/DeleteRemoteKeys [Preset: mainnet]
```diff
+ Importing list of remote keys [Preset: mainnet] OK
@ -339,6 +339,11 @@ OK: 12/12 Fail: 0/12 Skip: 0/12
+ vesion 2 single remote OK
```
OK: 3/3 Fail: 0/3 Skip: 0/3
## Serialization/deserialization [Preset: mainnet]
```diff
+ Deserialization test vectors OK
```
OK: 1/1 Fail: 0/1 Skip: 0/1
## Slashing Interchange tests [Preset: mainnet]
```diff
+ Slashing test: duplicate_pubkey_not_slashable.json OK
@ -568,4 +573,4 @@ OK: 1/1 Fail: 0/1 Skip: 0/1
OK: 9/9 Fail: 0/9 Skip: 0/9
---TOTAL---
OK: 317/322 Fail: 0/322 Skip: 5/322
OK: 312/323 Fail: 6/323 Skip: 5/323

7
Jenkinsfile vendored
View File

@ -43,12 +43,7 @@ def runStages(nodeDir) {
} }
stage("REST test suite") { timeout(5) {
sh """#!/bin/bash
set -e
./tests/simulation/restapi.sh --data-dir resttest0_data --base-port \$(( 9100 + EXECUTOR_NUMBER * 100 )) \
--base-rest-port \$(( 7100 + EXECUTOR_NUMBER * 100 )) --base-metrics-port \
\$(( 8108 + EXECUTOR_NUMBER * 100 )) --resttest-delay 30 --kill-old-processes
"""
sh "make restapi-test"
} }
stage("Testnet finalization") { timeout(75) {

View File

@ -25,6 +25,7 @@ NODE_ID := 0
BASE_PORT := 9000
BASE_REST_PORT := 5052
BASE_METRICS_PORT := 8008
EXECUTOR_NUMBER := 0
ROPSTEN_WEB3_URL := "--web3-url=wss://ropsten.infura.io/ws/v3/809a18497dd74102b5f37d25aae3c85a"
SEPOLIA_WEB3_URL := "--web3-url=https://rpc.sepolia.dev --web3-url=https://www.sepoliarpc.space"
@ -147,6 +148,15 @@ update: | update-common
libbacktrace:
+ "$(MAKE)" -C vendor/nim-libbacktrace --no-print-directory BUILD_CXX_LIB=0
restapi-test:
./tests/simulation/restapi.sh \
--data-dir resttest0_data \
--base-port $$(( 9100 + EXECUTOR_NUMBER * 100 )) \
--base-rest-port $$(( 7100 + EXECUTOR_NUMBER * 100 )) \
--base-metrics-port $$(( 8108 + EXECUTOR_NUMBER * 100 )) \
--resttest-delay 30 \
--kill-old-processes
# test binaries that can output an XML report
XML_TEST_BINARIES := \
consensus_spec_tests_mainnet \

View File

@ -165,7 +165,7 @@ proc installKeymanagerHandlers*(router: var RestRouter, node: BeaconNode) =
return RestApiResponse.jsonResponsePlain(response)
# https://ethereum.github.io/keymanager-APIs/#/Keymanager/DeleteKeys
router.api(MethodPost, "/api/eth/v1/keystores/delete") do (
router.api(MethodDelete, "/api/eth/v1/keystores") do (
contentBody: Option[ContentBody]) -> RestApiResponse:
let authStatus = checkAuthorization(request, node)
if authStatus.isErr():
@ -369,9 +369,9 @@ proc installKeymanagerHandlers*(router: var RestRouter, node: BeaconNode) =
"/api/eth/v1/keystores")
router.redirect(
MethodPost,
"/eth/v1/keystores/delete",
"/api/eth/v1/keystores/delete")
MethodDelete,
"/eth/v1/keystores",
"/api/eth/v1/keystores")
router.redirect(
MethodGet,

View File

@ -32,8 +32,8 @@ proc importKeystoresPlain*(body: KeystoresAndSlashingProtection
## https://ethereum.github.io/keymanager-APIs/#/Keymanager/ImportKeystores
proc deleteKeysPlain*(body: DeleteKeystoresBody): RestPlainResponse {.
rest, endpoint: "/eth/v1/keystores/delete",
meth: MethodPost.}
rest, endpoint: "/eth/v1/keystores",
meth: MethodDelete.}
## https://ethereum.github.io/keymanager-APIs/#/Keymanager/DeleteKeys
proc listKeys*(client: RestClientRef,

View File

@ -3338,8 +3338,8 @@
{
"topics": ["key_management", "delete_keys"],
"request": {
"url": "/eth/v1/keystores/delete",
"method": "POST",
"url": "/eth/v1/keystores",
"method": "DELETE",
"headers": {"Accept": "application/json", "Authorization": "Bearer testToken"},
"body": {"content-type": "application/json", "data": "{\"pubkeys\":[\"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\", \"0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001\"]}"
}