Skip to content

Commit

Permalink
Case insensitive version comparison (#4621)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Harris <[email protected]>
  • Loading branch information
ajsutton and rolfyone authored Nov 12, 2021
1 parent 995d7a2 commit f9df80c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.Locale;
import tech.pegasys.teku.api.response.v2.validator.GetNewBlockResponseV2;
import tech.pegasys.teku.api.schema.BeaconBlock;
import tech.pegasys.teku.api.schema.Version;
Expand All @@ -37,7 +38,8 @@ public GetNewBlockResponseV2Deserializer(final ObjectMapper mapper) {
public GetNewBlockResponseV2 deserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException {
JsonNode node = jp.getCodec().readTree(jp);
final Version version = Version.valueOf(node.findValue("version").asText());
final Version version =
Version.valueOf(node.findValue("version").asText().toLowerCase(Locale.ROOT));
final BeaconBlock block;
switch (version) {
case merge:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.util.Locale;
import tech.pegasys.teku.api.response.v2.debug.GetStateResponseV2;
import tech.pegasys.teku.api.schema.BeaconState;
import tech.pegasys.teku.api.schema.Version;
Expand All @@ -36,7 +37,8 @@ public GetStateResponseV2Deserializer(final ObjectMapper mapper) {
public GetStateResponseV2 deserialize(final JsonParser jp, final DeserializationContext ctxt)
throws IOException {
JsonNode node = jp.getCodec().readTree(jp);
final Version version = Version.valueOf(node.findValue("version").asText());
final Version version =
Version.valueOf(node.findValue("version").asText().toLowerCase(Locale.ROOT));
final BeaconState state;
switch (version) {
case altair:
Expand Down

0 comments on commit f9df80c

Please sign in to comment.