Skip to content

Commit 1899445

Browse files
committed
DELETE Graffiti API
1 parent c8a800c commit 1899445

File tree

3 files changed

+130
-0
lines changed

3 files changed

+130
-0
lines changed

Diff for: validator/client/src/main/java/tech/pegasys/teku/validator/client/restapi/ValidatorRestApi.java

+3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import tech.pegasys.teku.validator.client.doppelganger.DoppelgangerDetector;
3939
import tech.pegasys.teku.validator.client.restapi.apis.DeleteFeeRecipient;
4040
import tech.pegasys.teku.validator.client.restapi.apis.DeleteGasLimit;
41+
import tech.pegasys.teku.validator.client.restapi.apis.DeleteGraffiti;
4142
import tech.pegasys.teku.validator.client.restapi.apis.DeleteKeys;
4243
import tech.pegasys.teku.validator.client.restapi.apis.DeleteRemoteKeys;
4344
import tech.pegasys.teku.validator.client.restapi.apis.GetFeeRecipient;
@@ -57,6 +58,7 @@ public class ValidatorRestApi {
5758
public static final String TAG_KEY_MANAGEMENT = "Key Management";
5859
public static final String TAG_FEE_RECIPIENT = "Fee Recipient";
5960
public static final String TAG_GAS_LIMIT = "Gas Limit";
61+
public static final String TAG_GRAFFITI = "Graffiti";
6062

6163
public static RestApi create(
6264
final Spec spec,
@@ -128,6 +130,7 @@ public static RestApi create(
128130
.endpoint(new DeleteFeeRecipient(proposerConfigManager))
129131
.endpoint(new DeleteGasLimit(proposerConfigManager))
130132
.endpoint(new PostVoluntaryExit(voluntaryExitDataProvider))
133+
.endpoint(new DeleteGraffiti())
131134
.sslCertificate(config.getRestApiKeystoreFile(), config.getRestApiKeystorePasswordFile())
132135
.passwordFilePath(validatorApiBearerFile)
133136
.build();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright Consensys Software Inc., 2024
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
5+
* the License. You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
10+
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
11+
* specific language governing permissions and limitations under the License.
12+
*/
13+
14+
package tech.pegasys.teku.validator.client.restapi.apis;
15+
16+
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_NO_CONTENT;
17+
import static tech.pegasys.teku.validator.client.restapi.ValidatorRestApi.TAG_GRAFFITI;
18+
import static tech.pegasys.teku.validator.client.restapi.ValidatorTypes.PARAM_PUBKEY_TYPE;
19+
20+
import com.fasterxml.jackson.core.JsonProcessingException;
21+
import org.apache.commons.lang3.NotImplementedException;
22+
import tech.pegasys.teku.infrastructure.restapi.endpoints.EndpointMetadata;
23+
import tech.pegasys.teku.infrastructure.restapi.endpoints.RestApiEndpoint;
24+
import tech.pegasys.teku.infrastructure.restapi.endpoints.RestApiRequest;
25+
26+
public class DeleteGraffiti extends RestApiEndpoint {
27+
public static final String ROUTE = "/eth/v1/validator/{pubkey}/graffiti";
28+
29+
public DeleteGraffiti() {
30+
super(
31+
EndpointMetadata.delete(ROUTE)
32+
.operationId("deleteGraffiti")
33+
.summary("Delete Configured Graffiti")
34+
.description("Delete the configured graffiti for the specified public key.")
35+
.tags(TAG_GRAFFITI)
36+
.withBearerAuthSecurity()
37+
.pathParam(PARAM_PUBKEY_TYPE)
38+
.response(
39+
SC_NO_CONTENT,
40+
"Successfully removed the graffiti, or there was no graffiti set for the requested public key.")
41+
.withAuthenticationResponses()
42+
.withNotFoundResponse()
43+
.build());
44+
}
45+
46+
@Override
47+
public void handleRequest(RestApiRequest request) throws JsonProcessingException {
48+
throw new NotImplementedException("Not Implemented");
49+
}
50+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"delete" : {
3+
"tags" : [ "Graffiti" ],
4+
"operationId" : "deleteGraffiti",
5+
"summary" : "Delete Configured Graffiti",
6+
"description" : "Delete the configured graffiti for the specified public key.",
7+
"parameters" : [ {
8+
"name" : "pubkey",
9+
"required" : true,
10+
"in" : "path",
11+
"schema" : {
12+
"type" : "string",
13+
"pattern" : "^0x[a-fA-F0-9]{96}$",
14+
"example" : "0x93247f2209abcacf57b75a51dafae777f9dd38bc7053d1af526f220a7489a6d3a2753e5f3e8b1cfe39b56f43611df74a"
15+
}
16+
} ],
17+
"security" : [ {
18+
"bearerAuth" : [ ]
19+
} ],
20+
"responses" : {
21+
"204" : {
22+
"description" : "Successfully removed the graffiti, or there was no graffiti set for the requested public key.",
23+
"content" : { }
24+
},
25+
"401" : {
26+
"description" : "Unauthorized, no token is found",
27+
"content" : {
28+
"application/json" : {
29+
"schema" : {
30+
"$ref" : "#/components/schemas/HttpErrorResponse"
31+
}
32+
}
33+
}
34+
},
35+
"403" : {
36+
"description" : "Forbidden, a token is found but is invalid",
37+
"content" : {
38+
"application/json" : {
39+
"schema" : {
40+
"$ref" : "#/components/schemas/HttpErrorResponse"
41+
}
42+
}
43+
}
44+
},
45+
"404" : {
46+
"description" : "Not found",
47+
"content" : {
48+
"application/json" : {
49+
"schema" : {
50+
"$ref" : "#/components/schemas/HttpErrorResponse"
51+
}
52+
}
53+
}
54+
},
55+
"400" : {
56+
"description" : "The request could not be processed, check the response for more information.",
57+
"content" : {
58+
"application/json" : {
59+
"schema" : {
60+
"$ref" : "#/components/schemas/HttpErrorResponse"
61+
}
62+
}
63+
}
64+
},
65+
"500" : {
66+
"description" : "Internal server error",
67+
"content" : {
68+
"application/json" : {
69+
"schema" : {
70+
"$ref" : "#/components/schemas/HttpErrorResponse"
71+
}
72+
}
73+
}
74+
}
75+
}
76+
}
77+
}

0 commit comments

Comments
 (0)