Skip to content

Commit 24794d1

Browse files
committed
Resolve pubkey type
1 parent b72ba2d commit 24794d1

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

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

+5-4
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
package tech.pegasys.teku.validator.client.restapi.apis;
1515

16+
import static tech.pegasys.teku.ethereum.json.types.SharedApiTypes.PUBKEY_API_TYPE;
1617
import static tech.pegasys.teku.infrastructure.http.HttpStatusCodes.SC_OK;
1718
import static tech.pegasys.teku.infrastructure.json.types.CoreTypes.STRING_TYPE;
1819
import static tech.pegasys.teku.validator.client.restapi.ValidatorRestApi.TAG_GRAFFITI;
@@ -34,7 +35,7 @@ public class GetGraffiti extends RestApiEndpoint {
3435

3536
private static final SerializableTypeDefinition<GraffitiResponse> GRAFFITI_TYPE =
3637
SerializableTypeDefinition.object(GraffitiResponse.class)
37-
.withOptionalField("pubkey", STRING_TYPE, GraffitiResponse::getPublicKey)
38+
.withOptionalField("pubkey", PUBKEY_API_TYPE, GraffitiResponse::getPublicKey)
3839
.withField("graffiti", STRING_TYPE, GraffitiResponse::getGraffiti)
3940
.build();
4041

@@ -67,15 +68,15 @@ public void handleRequest(RestApiRequest request) throws JsonProcessingException
6768
}
6869

6970
static class GraffitiResponse {
70-
private final Optional<String> publicKey;
71+
private final Optional<BLSPublicKey> publicKey;
7172
private final String graffiti;
7273

7374
GraffitiResponse(final BLSPublicKey publicKey, final String graffiti) {
74-
this.publicKey = Optional.of(publicKey.toHexString());
75+
this.publicKey = Optional.of(publicKey);
7576
this.graffiti = graffiti;
7677
}
7778

78-
Optional<String> getPublicKey() {
79+
Optional<BLSPublicKey> getPublicKey() {
7980
return publicKey;
8081
}
8182

Diff for: validator/client/src/test/resources/tech/pegasys/teku/validator/client/restapi/schema/GraffitiResponse.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"required" : [ "graffiti" ],
99
"properties" : {
1010
"pubkey" : {
11-
"type" : "string"
11+
"$ref" : "#/components/schemas/Pubkey"
1212
},
1313
"graffiti" : {
1414
"type" : "string"

0 commit comments

Comments
 (0)