From b4fd15520be19fa550d87ea1f360687c715431dc Mon Sep 17 00:00:00 2001 From: Stefan Bratanov Date: Sun, 29 Dec 2024 15:28:56 +0200 Subject: [PATCH] Remove jackson module --- data/serializer/build.gradle | 1 - ethereum/execution-types/build.gradle | 1 - infrastructure/jackson/build.gradle | 8 ----- .../bytes/Bytes32Deserializer.java | 29 ------------------ .../deserializers/bytes/BytesSerializer.java | 30 ------------------- infrastructure/yaml/build.gradle | 1 - .../pegasys/teku/data/yaml/YamlProvider.java | 21 +++++++++++-- settings.gradle | 1 - validator/client/build.gradle | 1 - .../loader}/Bytes48KeyDeserializer.java | 2 +- .../loader/ProposerConfigLoader.java | 1 - 11 files changed, 20 insertions(+), 76 deletions(-) delete mode 100644 infrastructure/jackson/build.gradle delete mode 100644 infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes/Bytes32Deserializer.java delete mode 100644 infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes/BytesSerializer.java rename {infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes => validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/loader}/Bytes48KeyDeserializer.java (94%) diff --git a/data/serializer/build.gradle b/data/serializer/build.gradle index 5fd9cd1f607..f24eb8983ed 100644 --- a/data/serializer/build.gradle +++ b/data/serializer/build.gradle @@ -6,7 +6,6 @@ dependencies { implementation project(':ethereum:spec') implementation project(':infrastructure:bls') implementation project(':infrastructure:bytes') - implementation project(':infrastructure:jackson') implementation project(':infrastructure:async') implementation 'io.tmio:tuweni-units' diff --git a/ethereum/execution-types/build.gradle b/ethereum/execution-types/build.gradle index c8ce4745c85..d74220fb994 100644 --- a/ethereum/execution-types/build.gradle +++ b/ethereum/execution-types/build.gradle @@ -3,7 +3,6 @@ dependencies { implementation project(':infrastructure:crypto') implementation project(':infrastructure:json') - testFixturesApi project(':infrastructure:jackson') testImplementation project(':ethereum:json-types') testImplementation testFixtures(project(':infrastructure:json')) diff --git a/infrastructure/jackson/build.gradle b/infrastructure/jackson/build.gradle deleted file mode 100644 index 3f1451d6923..00000000000 --- a/infrastructure/jackson/build.gradle +++ /dev/null @@ -1,8 +0,0 @@ -dependencies { - api 'com.fasterxml.jackson.core:jackson-databind' - api 'io.swagger.core.v3:swagger-annotations' - - implementation project(':infrastructure:bytes') - - implementation 'io.tmio:tuweni-units' -} \ No newline at end of file diff --git a/infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes/Bytes32Deserializer.java b/infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes/Bytes32Deserializer.java deleted file mode 100644 index 5fcd75d8ef1..00000000000 --- a/infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes/Bytes32Deserializer.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright Consensys Software Inc., 2022 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.infrastructure.jackson.deserializers.bytes; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import java.io.IOException; -import org.apache.tuweni.bytes.Bytes32; - -public class Bytes32Deserializer extends JsonDeserializer { - - @Override - public Bytes32 deserialize(final JsonParser p, final DeserializationContext ctxt) - throws IOException { - return Bytes32.fromHexString(p.getValueAsString()); - } -} diff --git a/infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes/BytesSerializer.java b/infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes/BytesSerializer.java deleted file mode 100644 index 2fafab35ae0..00000000000 --- a/infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes/BytesSerializer.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright Consensys Software Inc., 2022 - * - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the - * specific language governing permissions and limitations under the License. - */ - -package tech.pegasys.teku.infrastructure.jackson.deserializers.bytes; - -import com.fasterxml.jackson.core.JsonGenerator; -import com.fasterxml.jackson.databind.JsonSerializer; -import com.fasterxml.jackson.databind.SerializerProvider; -import java.io.IOException; -import java.util.Locale; -import org.apache.tuweni.bytes.Bytes; - -public class BytesSerializer extends JsonSerializer { - @Override - public void serialize( - final Bytes value, final JsonGenerator gen, final SerializerProvider provider) - throws IOException { - gen.writeString(value.toHexString().toLowerCase(Locale.ROOT)); - } -} diff --git a/infrastructure/yaml/build.gradle b/infrastructure/yaml/build.gradle index e184a680e03..91430265c1e 100644 --- a/infrastructure/yaml/build.gradle +++ b/infrastructure/yaml/build.gradle @@ -1,5 +1,4 @@ dependencies { - implementation project(':infrastructure:jackson') implementation 'io.tmio:tuweni-bytes' implementation 'com.fasterxml.jackson.core:jackson-databind' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml' diff --git a/infrastructure/yaml/src/main/java/tech/pegasys/teku/data/yaml/YamlProvider.java b/infrastructure/yaml/src/main/java/tech/pegasys/teku/data/yaml/YamlProvider.java index b3f2fe47ff7..5adcc835158 100644 --- a/infrastructure/yaml/src/main/java/tech/pegasys/teku/data/yaml/YamlProvider.java +++ b/infrastructure/yaml/src/main/java/tech/pegasys/teku/data/yaml/YamlProvider.java @@ -33,11 +33,10 @@ import java.io.OutputStream; import java.io.StringWriter; import java.io.UncheckedIOException; +import java.util.Locale; import java.util.stream.Stream; import org.apache.tuweni.bytes.Bytes; import org.apache.tuweni.bytes.Bytes32; -import tech.pegasys.teku.infrastructure.jackson.deserializers.bytes.Bytes32Deserializer; -import tech.pegasys.teku.infrastructure.jackson.deserializers.bytes.BytesSerializer; import tech.pegasys.teku.infrastructure.unsigned.UInt64; public class YamlProvider { @@ -113,4 +112,22 @@ public void serialize( gen.writeNumber(value.bigIntegerValue()); } } + + public static class Bytes32Deserializer extends JsonDeserializer { + + @Override + public Bytes32 deserialize(final JsonParser p, final DeserializationContext ctxt) + throws IOException { + return Bytes32.fromHexString(p.getValueAsString()); + } + } + + public static class BytesSerializer extends JsonSerializer { + @Override + public void serialize( + final Bytes value, final JsonGenerator gen, final SerializerProvider provider) + throws IOException { + gen.writeString(value.toHexString().toLowerCase(Locale.ROOT)); + } + } } diff --git a/settings.gradle b/settings.gradle index 8d9747b8d3d..b17af30b975 100644 --- a/settings.gradle +++ b/settings.gradle @@ -33,7 +33,6 @@ include 'infrastructure:events' include 'infrastructure:exceptions' include 'infrastructure:http' include 'infrastructure:io' -include 'infrastructure:jackson' include 'infrastructure:json' include 'infrastructure:kzg' include 'infrastructure:metrics' diff --git a/validator/client/build.gradle b/validator/client/build.gradle index 64cc30b7181..742e1a23937 100644 --- a/validator/client/build.gradle +++ b/validator/client/build.gradle @@ -4,7 +4,6 @@ dependencies { implementation project(':infrastructure:crypto') implementation project(':infrastructure:exceptions') implementation project(':infrastructure:io') - implementation project(':infrastructure:jackson') implementation project(':infrastructure:metrics') implementation project(':infrastructure:http') implementation project(':ethereum:json-types') diff --git a/infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes/Bytes48KeyDeserializer.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/loader/Bytes48KeyDeserializer.java similarity index 94% rename from infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes/Bytes48KeyDeserializer.java rename to validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/loader/Bytes48KeyDeserializer.java index f10eb2c028c..1c5e32ba6ca 100644 --- a/infrastructure/jackson/src/main/java/tech/pegasys/teku/infrastructure/jackson/deserializers/bytes/Bytes48KeyDeserializer.java +++ b/validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/loader/Bytes48KeyDeserializer.java @@ -11,7 +11,7 @@ * specific language governing permissions and limitations under the License. */ -package tech.pegasys.teku.infrastructure.jackson.deserializers.bytes; +package tech.pegasys.teku.validator.client.proposerconfig.loader; import com.fasterxml.jackson.core.JacksonException; import com.fasterxml.jackson.databind.DeserializationContext; diff --git a/validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/loader/ProposerConfigLoader.java b/validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/loader/ProposerConfigLoader.java index 543025c9317..6229ddad858 100644 --- a/validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/loader/ProposerConfigLoader.java +++ b/validator/client/src/main/java/tech/pegasys/teku/validator/client/proposerconfig/loader/ProposerConfigLoader.java @@ -27,7 +27,6 @@ import tech.pegasys.teku.infrastructure.exceptions.ExceptionUtil; import tech.pegasys.teku.infrastructure.exceptions.InvalidConfigurationException; import tech.pegasys.teku.infrastructure.http.UrlSanitizer; -import tech.pegasys.teku.infrastructure.jackson.deserializers.bytes.Bytes48KeyDeserializer; import tech.pegasys.teku.validator.client.ProposerConfig; public class ProposerConfigLoader {