From b7c6ddf0230c793d8dcbd965be8b7c2b6f25054a Mon Sep 17 00:00:00 2001 From: Danno Ferrin Date: Wed, 17 Jun 2020 10:04:20 -0600 Subject: [PATCH] Upgrade Library Versions (#1092) * Upgrade Library Versions Upgrade library versions to most recent version Exceptions: * Errorprone - lots of new violations need fixing There will be a follow on PR for this. * picocli - non-trivial conformance changes * EthSigner&Orion - similar non-trivial API changes, plus it's only for integration testing * Kubernetes - significant library revisions * Web3j - Web3j changed some error semantics in 5.0 that broke acceptance tests. Expect an update in a follow on PR. Signed-off-by: Danno Ferrin --- build.gradle | 11 ++- .../api/graphql/GraphQLHttpServiceTest.java | 58 ++++++++++------ ethereum/referencetests/build.gradle | 6 -- gradle/versions.gradle | 68 +++++++++---------- gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 76 insertions(+), 69 deletions(-) diff --git a/build.gradle b/build.gradle index 4c7a783e07..f96f3b5c6f 100644 --- a/build.gradle +++ b/build.gradle @@ -20,13 +20,13 @@ import net.ltgt.gradle.errorprone.CheckSeverity import java.text.SimpleDateFormat plugins { - id 'com.diffplug.gradle.spotless' version '3.25.0' - id 'com.jfrog.bintray' version '1.8.4' - id 'com.github.ben-manes.versions' version '0.26.0' + id 'com.diffplug.gradle.spotless' version '4.3.0' + id 'com.jfrog.bintray' version '1.8.5' + id 'com.github.ben-manes.versions' version '0.28.0' id 'com.github.hierynomus.license' version '0.15.0' - id 'io.spring.dependency-management' version '1.0.8.RELEASE' + id 'io.spring.dependency-management' version '1.0.9.RELEASE' id 'me.champeau.gradle.jmh' version '0.5.0' apply false - id 'net.ltgt.errorprone' version '1.1.1' + id 'net.ltgt.errorprone' version '1.2.1' } if (!JavaVersion.current().java11Compatible) { @@ -151,7 +151,6 @@ allprojects { target '*.gradle' greclipse().configFile(rootProject.file('gradle/formatter.properties')) endWithNewline() - paddedCell() } // Below this line are currently only license header tasks diff --git a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/GraphQLHttpServiceTest.java b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/GraphQLHttpServiceTest.java index 0128ee6418..9e16826754 100644 --- a/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/GraphQLHttpServiceTest.java +++ b/ethereum/api/src/test/java/org/hyperledger/besu/ethereum/api/graphql/GraphQLHttpServiceTest.java @@ -68,9 +68,7 @@ public class GraphQLHttpServiceTest { protected static final MediaType JSON = MediaType.parse("application/json; charset=utf-8"); protected static final MediaType GRAPHQL = MediaType.parse("application/graphql; charset=utf-8"); private static BlockchainQueries blockchainQueries; - private static Synchronizer synchronizer; private static GraphQL graphQL; - private static GraphQLDataFetchers dataFetchers; private static GraphQLDataFetcherContextImpl dataFetcherContext; private static EthHashMiningCoordinator miningCoordinatorMock; @@ -79,7 +77,7 @@ public class GraphQLHttpServiceTest { @BeforeClass public static void initServerAndClient() throws Exception { blockchainQueries = Mockito.mock(BlockchainQueries.class); - synchronizer = Mockito.mock(Synchronizer.class); + final Synchronizer synchronizer = Mockito.mock(Synchronizer.class); graphQL = Mockito.mock(GraphQL.class); miningCoordinatorMock = Mockito.mock(EthHashMiningCoordinator.class); @@ -95,12 +93,13 @@ public class GraphQLHttpServiceTest { final Set supportedCapabilities = new HashSet<>(); supportedCapabilities.add(EthProtocol.ETH62); supportedCapabilities.add(EthProtocol.ETH63); - dataFetchers = new GraphQLDataFetchers(supportedCapabilities); + final GraphQLDataFetchers dataFetchers = new GraphQLDataFetchers(supportedCapabilities); graphQL = GraphQLProvider.buildGraphQL(dataFetchers); service = createGraphQLHttpService(); service.start().join(); // Build an OkHttp client. - client = new OkHttpClient(); + client = new OkHttpClient.Builder().followRedirects(false).build(); + baseUrl = service.url() + "/graphql/"; } @@ -166,20 +165,16 @@ public class GraphQLHttpServiceTest { } @Test - public void handleEmptyRequestAndRedirect() throws Exception { - try (final Response resp = - client.newCall(new Request.Builder().get().url(service.url()).build()).execute()) { - Assertions.assertThat(resp.code()).isEqualTo(HttpResponseStatus.BAD_REQUEST.code()); - } - final RequestBody body = RequestBody.create(null, ""); + public void handleEmptyRequestAndRedirect_post() throws Exception { + final RequestBody body = RequestBody.create("", null); try (final Response resp = client.newCall(new Request.Builder().post(body).url(service.url()).build()).execute()) { Assertions.assertThat(resp.code()).isEqualTo(HttpResponseStatus.PERMANENT_REDIRECT.code()); - String location = resp.header("Location"); + final String location = resp.header("Location"); Assertions.assertThat(location).isNotEmpty().isNotNull(); - HttpUrl redirectUrl = resp.request().url().resolve(location); + final HttpUrl redirectUrl = resp.request().url().resolve(location); Assertions.assertThat(redirectUrl).isNotNull(); - Request.Builder redirectBuilder = resp.request().newBuilder(); + final Request.Builder redirectBuilder = resp.request().newBuilder(); redirectBuilder.post(resp.request().body()); resp.body().close(); try (final Response redirectResp = @@ -189,9 +184,28 @@ public class GraphQLHttpServiceTest { } } + @Test + public void handleEmptyRequestAndRedirect_get() throws Exception { + try (final Response resp = + client.newCall(new Request.Builder().get().url(service.url()).build()).execute()) { + Assertions.assertThat(resp.code()).isEqualTo(HttpResponseStatus.PERMANENT_REDIRECT.code()); + final String location = resp.header("Location"); + Assertions.assertThat(location).isNotEmpty().isNotNull(); + final HttpUrl redirectUrl = resp.request().url().resolve(location); + Assertions.assertThat(redirectUrl).isNotNull(); + final Request.Builder redirectBuilder = resp.request().newBuilder(); + redirectBuilder.get(); + // resp.body().close(); + try (final Response redirectResp = + client.newCall(redirectBuilder.url(redirectUrl).build()).execute()) { + Assertions.assertThat(redirectResp.code()).isEqualTo(HttpResponseStatus.BAD_REQUEST.code()); + } + } + } + @Test public void handleInvalidQuerySchema() throws Exception { - final RequestBody body = RequestBody.create(GRAPHQL, "{gasPrice1}"); + final RequestBody body = RequestBody.create("{gasPrice1}", GRAPHQL); try (final Response resp = client.newCall(buildPostRequest(body)).execute()) { final JsonObject json = new JsonObject(resp.body().string()); @@ -216,7 +230,7 @@ public class GraphQLHttpServiceTest { @Test public void query_jsonPost() throws Exception { - final RequestBody body = RequestBody.create(JSON, "{\"query\":\"{gasPrice}\"}"); + final RequestBody body = RequestBody.create("{\"query\":\"{gasPrice}\"}", JSON); final Wei price = Wei.of(16); Mockito.when(miningCoordinatorMock.getMinTransactionGasPrice()).thenReturn(price); @@ -231,7 +245,7 @@ public class GraphQLHttpServiceTest { @Test public void query_graphqlPost() throws Exception { - final RequestBody body = RequestBody.create(GRAPHQL, "{gasPrice}"); + final RequestBody body = RequestBody.create("{gasPrice}", GRAPHQL); final Wei price = Wei.of(16); Mockito.when(miningCoordinatorMock.getMinTransactionGasPrice()).thenReturn(price); @@ -246,7 +260,7 @@ public class GraphQLHttpServiceTest { @Test public void query_untypedPost() throws Exception { - final RequestBody body = RequestBody.create(null, "{gasPrice}"); + final RequestBody body = RequestBody.create("{gasPrice}", null); final Wei price = Wei.of(16); Mockito.when(miningCoordinatorMock.getMinTransactionGasPrice()).thenReturn(price); @@ -296,7 +310,7 @@ public class GraphQLHttpServiceTest { @Test public void responseContainsJsonContentTypeHeader() throws Exception { - final RequestBody body = RequestBody.create(GRAPHQL, "{gasPrice}"); + final RequestBody body = RequestBody.create("{gasPrice}", GRAPHQL); try (final Response resp = client.newCall(buildPostRequest(body)).execute()) { Assertions.assertThat(resp.header("Content-Type")).isEqualTo(JSON.toString()); @@ -320,7 +334,7 @@ public class GraphQLHttpServiceTest { final String query = "{block(hash:\"" + blockHash.toString() + "\") {ommerCount}}"; - final RequestBody body = RequestBody.create(GRAPHQL, query); + final RequestBody body = RequestBody.create(query, GRAPHQL); try (final Response resp = client.newCall(buildPostRequest(body)).execute()) { Assertions.assertThat(resp.code()).isEqualTo(200); final String jsonStr = resp.body().string(); @@ -346,7 +360,7 @@ public class GraphQLHttpServiceTest { final String query = "{block(number:\"3\") {ommerCount}}"; - final RequestBody body = RequestBody.create(GRAPHQL, query); + final RequestBody body = RequestBody.create(query, GRAPHQL); try (final Response resp = client.newCall(buildPostRequest(body)).execute()) { Assertions.assertThat(resp.code()).isEqualTo(200); final String jsonStr = resp.body().string(); @@ -371,7 +385,7 @@ public class GraphQLHttpServiceTest { final String query = "{block {ommerCount}}"; - final RequestBody body = RequestBody.create(GRAPHQL, query); + final RequestBody body = RequestBody.create(query, GRAPHQL); try (final Response resp = client.newCall(buildPostRequest(body)).execute()) { Assertions.assertThat(resp.code()).isEqualTo(200); final String jsonStr = resp.body().string(); diff --git a/ethereum/referencetests/build.gradle b/ethereum/referencetests/build.gradle index 9d6875ff58..9822f7351a 100644 --- a/ethereum/referencetests/build.gradle +++ b/ethereum/referencetests/build.gradle @@ -13,12 +13,6 @@ * SPDX-License-Identifier: Apache-2.0 */ -spotless { - groovyGradle { - paddedCell() - } -} - sourceSets { test { resources { diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 04329b1be3..1ad12bb5fc 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -18,49 +18,49 @@ dependencyManagement { dependency 'com.fasterxml.jackson.core:jackson-databind:2.11.0' dependency 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.11.0' - dependency 'com.github.tomakehurst:wiremock-jre8:2.25.1' - dependency 'com.github.tomakehurst:wiremock-jre8-standalone:2.25.1' + dependency 'com.github.tomakehurst:wiremock-jre8:2.26.3' + dependency 'com.github.tomakehurst:wiremock-jre8-standalone:2.26.3' - dependency 'com.google.auto.service:auto-service:1.0-rc6' + dependency 'com.google.auto.service:auto-service:1.0-rc7' - dependency 'com.google.dagger:dagger:2.27' - dependency 'com.google.dagger:dagger-compiler:2.27' + dependency 'com.google.dagger:dagger:2.28' + dependency 'com.google.dagger:dagger-compiler:2.28' dependency 'com.google.errorprone:error_prone_annotation:2.3.3' dependency 'com.google.errorprone:error_prone_check_api:2.3.3' dependency 'com.google.errorprone:error_prone_core:2.3.3' dependency 'com.google.errorprone:error_prone_test_helpers:2.3.3' - dependency 'com.google.guava:guava:28.1-jre' + dependency 'com.google.guava:guava:29.0-jre' - dependency 'com.graphql-java:graphql-java:13.0' + dependency 'com.graphql-java:graphql-java:15.0' dependency 'com.splunk.logging:splunk-library-javalogging:1.8.0' - dependency 'com.squareup.okhttp3:okhttp:4.2.2' + dependency 'com.squareup.okhttp3:okhttp:4.7.2' dependency 'commons-codec:commons-codec:1.13' - dependency 'commons-io:commons-io:2.6' + dependency 'commons-io:commons-io:2.7' dependency 'info.picocli:picocli:4.1.4' dependency 'io.kubernetes:client-java:5.0.0' - dependency 'io.pkts:pkts-core:3.0.5' + dependency 'io.pkts:pkts-core:3.0.7' - dependency 'io.prometheus:simpleclient:0.8.0' - dependency 'io.prometheus:simpleclient_common:0.8.0' - dependency 'io.prometheus:simpleclient_hotspot:0.8.0' - dependency 'io.prometheus:simpleclient_pushgateway:0.8.0' + dependency 'io.prometheus:simpleclient:0.9.0' + dependency 'io.prometheus:simpleclient_common:0.9.0' + dependency 'io.prometheus:simpleclient_hotspot:0.9.0' + dependency 'io.prometheus:simpleclient_pushgateway:0.9.0' - dependency 'io.reactivex.rxjava2:rxjava:2.2.16' + dependency 'io.reactivex.rxjava2:rxjava:2.2.19' - dependency 'io.vertx:vertx-auth-jwt:3.8.5' - dependency 'io.vertx:vertx-codegen:3.8.5' - dependency 'io.vertx:vertx-core:3.8.5' - dependency 'io.vertx:vertx-unit:3.8.5' - dependency 'io.vertx:vertx-web:3.8.5' + dependency 'io.vertx:vertx-auth-jwt:3.9.1' + dependency 'io.vertx:vertx-codegen:3.9.1' + dependency 'io.vertx:vertx-core:3.9.1' + dependency 'io.vertx:vertx-unit:3.9.1' + dependency 'io.vertx:vertx-web:3.9.1' dependency 'junit:junit:4.13' @@ -71,9 +71,9 @@ dependencyManagement { dependency 'org.apache.commons:commons-compress:1.20' dependency 'org.apache.commons:commons-text:1.8' - dependency 'org.apache.logging.log4j:log4j-api:2.13.2' - dependency 'org.apache.logging.log4j:log4j-core:2.13.2' - dependency 'org.apache.logging.log4j:log4j-slf4j-impl:2.13.2' + dependency 'org.apache.logging.log4j:log4j-api:2.13.3' + dependency 'org.apache.logging.log4j:log4j-core:2.13.3' + dependency 'org.apache.logging.log4j:log4j-slf4j-impl:2.13.3' dependency 'org.apache.tuweni:tuweni-bytes:1.0.0' dependency 'org.apache.tuweni:tuweni-config:1.0.0' @@ -83,39 +83,39 @@ dependencyManagement { dependency 'org.apache.tuweni:tuweni-units:1.0.0' dependency 'org.apache.tuweni:tuweni-net:1.0.0' - dependency 'org.assertj:assertj-core:3.14.0' + dependency 'org.assertj:assertj-core:3.16.1' - dependency 'org.awaitility:awaitility:4.0.1' + dependency 'org.awaitility:awaitility:4.0.3' - dependency 'org.bouncycastle:bcpkix-jdk15on:1.64' - dependency 'org.bouncycastle:bcprov-jdk15on:1.64' + dependency 'org.bouncycastle:bcpkix-jdk15on:1.65' + dependency 'org.bouncycastle:bcprov-jdk15on:1.65.01' dependency 'org.hyperledger.besu:altbn128:0.2.0' dependency 'org.hyperledger.besu:bls12-381:0.2.0' dependency 'org.hyperledger.besu:secp256k1:0.2.0' - dependency 'org.java-websocket:Java-WebSocket:1.4.0' + dependency 'org.java-websocket:Java-WebSocket:1.5.1' dependency 'org.jupnp:org.jupnp.support:2.5.2' dependency 'org.jupnp:org.jupnp:2.5.2' - dependency 'org.mockito:mockito-core:3.2.4' + dependency 'org.mockito:mockito-core:3.3.3' - dependency 'org.openjdk.jmh:jmh-core:1.22' - dependency 'org.openjdk.jmh:jmh-generator-annprocess:1.22' + dependency 'org.openjdk.jmh:jmh-core:1.23' + dependency 'org.openjdk.jmh:jmh-generator-annprocess:1.23' - dependency 'org.rocksdb:rocksdbjni:6.4.6' + dependency 'org.rocksdb:rocksdbjni:6.8.1' dependency 'org.slf4j:slf4j-log4j12:1.7.26' - dependency 'org.springframework.security:spring-security-crypto:5.2.1.RELEASE' + dependency 'org.springframework.security:spring-security-crypto:5.2.3.RELEASE' dependency 'org.web3j:abi:4.5.15' dependency 'org.web3j:besu:4.5.15' dependency 'org.web3j:core:4.5.15' dependency 'org.web3j:crypto:4.5.15' - dependency 'org.xerial.snappy:snappy-java:1.1.7.3' + dependency 'org.xerial.snappy:snappy-java:1.1.7.5' dependency 'org.yaml:snakeyaml:1.26' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a4b4429748..622ab64a3c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists