chore: migrate project to Kotlin 2.0.0 and fix null-safety in tests (#1040)

* chore: update kotlin-gradle-plugin to 2.0.0

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* fix: add null-safety (!!) for micrometer gauge/counter/timer in tests for Kotlin 2.0

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* chore: update kotlin-reflect dependency to 2.0.0 in besu-plugin

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* chore: add kotlin 2.0.0 version to version catalog

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* chore: update kotlin dependencies and plugins to 2.0.0 in testing-tools

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* fix: add null-safety (!!) for micrometer gauge/counter/timer in tests for Kotlin 2.0

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update ProverClientFactoryTest.kt

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update build.gradle

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update build.gradle

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update libs.versions.toml

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update libs.versions.toml

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update MicrometerMetricsFacadeTest.kt

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update MicrometerMetricsFacadeTest.kt

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update build.gradle

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update build.gradle

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update build.gradle

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update build.gradle

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update build.gradle

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Create gradle.properties

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update libs.versions.toml

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Delete buildSrc/gradle.properties

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* Update gradle.properties

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>

* feat: add gradle.properties for buildSrc

* feat: upgrade to gradle 8.12.1 and log4j to 2.24.3 and fixed missing test fixture dependencies

* feat: update kotlinx-serialization-json to 1.8.1

---------

Signed-off-by: VolodymyrBg <aqdrgg19@gmail.com>
Co-authored-by: Jones Ho <jones.ho@consensys.net>
Co-authored-by: jonesho <81145364+jonesho@users.noreply.github.com>
This commit is contained in:
VolodymyrBg
2025-06-17 11:50:53 +03:00
committed by GitHub
parent 1fea41b066
commit e39fd7f244
18 changed files with 46 additions and 18 deletions

View File

@@ -10,7 +10,7 @@ dependencies {
compileOnly("info.picocli:picocli:${libs.versions.picoli.get()}") { compileOnly("info.picocli:picocli:${libs.versions.picoli.get()}") {
because 'Required for command line parsing. Provided by Besu at runtime.' because 'Required for command line parsing. Provided by Besu at runtime.'
} }
implementation "org.jetbrains.kotlin:kotlin-reflect:1.9.21" implementation "org.jetbrains.kotlin:kotlin-reflect:${kotlinVersion}"
api(project(":jvm-libs:generic:vertx-helper")) api(project(":jvm-libs:generic:vertx-helper"))
api(project(":jvm-libs:generic:serialization:jackson")) api(project(":jvm-libs:generic:serialization:jackson"))
api(project(":jvm-libs:linea:metrics:micrometer")) api(project(":jvm-libs:linea:metrics:micrometer"))

View File

@@ -8,7 +8,7 @@ repositories {
} }
dependencies { dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
implementation("org.web3j:codegen:4.12.0") implementation("org.web3j:codegen:4.12.0")
} }

View File

@@ -0,0 +1 @@
kotlinVersion=2.1.21

View File

@@ -118,10 +118,9 @@ open class GenericFileBasedProverClient<Request, Response, RequestDto, ResponseD
FileMonitor.ErrorType.TIMED_OUT -> { FileMonitor.ErrorType.TIMED_OUT -> {
SafeFuture.failedFuture<Path>(RuntimeException("Timeout waiting for response file=$responseFilePath")) SafeFuture.failedFuture<Path>(RuntimeException("Timeout waiting for response file=$responseFilePath"))
} }
// else -> {
else -> { // SafeFuture.failedFuture(RuntimeException("Unexpected error=$it"))
SafeFuture.failedFuture(RuntimeException("Unexpected error=$it")) // }
}
} }
} else { } else {
SafeFuture.completedFuture(responseFilePath) SafeFuture.completedFuture(responseFilePath)

View File

@@ -22,6 +22,7 @@ dependencies {
testFixturesImplementation project(':jvm-libs:linea:metrics:micrometer') testFixturesImplementation project(':jvm-libs:linea:metrics:micrometer')
testImplementation(project(':jvm-libs:generic:logging')) testImplementation(project(':jvm-libs:generic:logging'))
testImplementation(project(':jvm-libs:linea:metrics:micrometer'))
testImplementation(testFixtures(project(':jvm-libs:linea:clients:interfaces'))) testImplementation(testFixtures(project(':jvm-libs:linea:clients:interfaces')))
testImplementation(testFixtures(project(':jvm-libs:linea:core:traces'))) testImplementation(testFixtures(project(':jvm-libs:linea:core:traces')))
testImplementation(testFixtures(project(':jvm-libs:generic:extensions:kotlin'))) testImplementation(testFixtures(project(':jvm-libs:generic:extensions:kotlin')))

View File

@@ -85,7 +85,7 @@ fun makeDeployLineaRollup(
deploymentPrivateKey?.let { env["DEPLOYMENT_PRIVATE_KEY"] = it } deploymentPrivateKey?.let { env["DEPLOYMENT_PRIVATE_KEY"] = it }
val command = when (contractVersion) { val command = when (contractVersion) {
LineaContractVersion.V6 -> "make deploy-linea-rollup-v6" LineaContractVersion.V6 -> "make deploy-linea-rollup-v6"
else -> throw IllegalArgumentException("Unsupported contract version: $contractVersion") // else -> throw IllegalArgumentException("Unsupported contract version: $contractVersion")
} }
return deployContract( return deployContract(

View File

@@ -9,3 +9,5 @@ lineaSequencerProjectPath=:besu-plugins:linea-sequencer
# Version of the project, at release override this value with # Version of the project, at release override this value with
# /gradlew jvm-libs:blob-compressor:publish -Pversion=0.0.3 # /gradlew jvm-libs:blob-compressor:publish -Pversion=0.0.3
# version=0.0.0-SNAPSHOT # version=0.0.0-SNAPSHOT
kotlinVersion=2.1.21

View File

@@ -40,7 +40,7 @@ kotlinResult = "1.1.16"
kotlinxDatetime = "0.6.2" kotlinxDatetime = "0.6.2"
ktlint = "0.50.0" ktlint = "0.50.0"
lineaKotlin = "0.1.0" lineaKotlin = "0.1.0"
log4j = "2.24.1" log4j = "2.24.3"
micrometer = "1.12.13" micrometer = "1.12.13"
netty = "4.1.92.Final" netty = "4.1.92.Final"
picoli = "4.7.6" picoli = "4.7.6"

Binary file not shown.

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
networkTimeout=10000 networkTimeout=10000
validateDistributionUrl=true validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

10
gradlew vendored
View File

@@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
# SPDX-License-Identifier: Apache-2.0
#
############################################################################## ##############################################################################
# #
@@ -84,7 +86,7 @@ done
# shellcheck disable=SC2034 # shellcheck disable=SC2034
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -112,7 +114,7 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;; NONSTOP* ) nonstop=true ;;
esac esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM. # Determine the Java command to use to start the JVM.
@@ -203,7 +205,7 @@ fi
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command: # Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, # * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped. # and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line. # treated as '${Hostname}' itself on the command line.
@@ -211,7 +213,7 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \ set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \ "-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \ -classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@" "$@"
# Stop when "xargs" is not available. # Stop when "xargs" is not available.

6
gradlew.bat vendored
View File

@@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and @rem See the License for the specific language governing permissions and
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%"=="" @echo off
@rem ########################################################################## @rem ##########################################################################
@@ -68,11 +70,11 @@ goto fail
:execute :execute
@rem Setup the command line @rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar set CLASSPATH=
@rem Execute Gradle @rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell

View File

@@ -6,6 +6,15 @@ plugins {
description = "JSON RPC 2.0 utilities" description = "JSON RPC 2.0 utilities"
configurations {
testFixturesDeps {
extendsFrom implementation // Inherit plugin's dependencies
canBeConsumed = false
canBeResolved = false
}
testFixturesImplementation.extendsFrom testFixturesDeps
}
dependencies { dependencies {
implementation project(":jvm-libs:linea:core:metrics") implementation project(":jvm-libs:linea:core:metrics")
implementation project(":jvm-libs:linea:metrics:micrometer") implementation project(":jvm-libs:linea:metrics:micrometer")

View File

@@ -14,6 +14,7 @@ dependencies {
testImplementation "net.java.dev.jna:jna:${libs.versions.jna.get()}" testImplementation "net.java.dev.jna:jna:${libs.versions.jna.get()}"
testImplementation project(":jvm-libs:linea:blob-shnarf-calculator") testImplementation project(":jvm-libs:linea:blob-shnarf-calculator")
testImplementation project(":jvm-libs:generic:extensions:kotlin")
testFixturesImplementation project(':jvm-libs:linea:besu-libs') testFixturesImplementation project(':jvm-libs:linea:besu-libs')
testFixturesImplementation project(':jvm-libs:linea:besu-rlp-and-mappers') testFixturesImplementation project(':jvm-libs:linea:besu-rlp-and-mappers')
testFixturesImplementation(project(":jvm-libs:linea:testing:file-system")) testFixturesImplementation(project(":jvm-libs:linea:testing:file-system"))

View File

@@ -5,6 +5,15 @@ plugins {
description="Interfaces for interaction with Linea Smart Contract" description="Interfaces for interaction with Linea Smart Contract"
configurations {
testFixturesDeps {
extendsFrom implementation // Inherit plugin's dependencies
canBeConsumed = false
canBeResolved = false
}
testFixturesImplementation.extendsFrom testFixturesDeps
}
dependencies { dependencies {
api project(':jvm-libs:linea:core:domain-models') api project(':jvm-libs:linea:core:domain-models')
api project(':jvm-libs:generic:extensions:futures') api project(':jvm-libs:generic:extensions:futures')

View File

@@ -9,6 +9,7 @@ dependencies {
implementation project(":jvm-libs:generic:extensions:kotlin") implementation project(":jvm-libs:generic:extensions:kotlin")
testFixturesApi "org.jetbrains.kotlinx:kotlinx-datetime:${libs.versions.kotlinxDatetime.get()}" testFixturesApi "org.jetbrains.kotlinx:kotlinx-datetime:${libs.versions.kotlinxDatetime.get()}"
testFixturesApi project(":jvm-libs:linea:besu-libs") testFixturesApi project(":jvm-libs:linea:besu-libs")
testFixturesApi project(":jvm-libs:generic:extensions:kotlin")
} }
jar { jar {

View File

@@ -22,6 +22,7 @@ dependencies {
testImplementation "com.fasterxml.jackson.core:jackson-databind:${libs.versions.jackson.get()}" testImplementation "com.fasterxml.jackson.core:jackson-databind:${libs.versions.jackson.get()}"
testImplementation "org.wiremock:wiremock:${libs.versions.wiremock.get()}" testImplementation "org.wiremock:wiremock:${libs.versions.wiremock.get()}"
testImplementation project(":jvm-libs:linea:besu-rlp-and-mappers") testImplementation project(":jvm-libs:linea:besu-rlp-and-mappers")
testFixturesImplementation "org.apache.logging.log4j:log4j-slf4j2-impl:${libs.versions.log4j.get()}"
} }
jar { jar {

View File

@@ -3,7 +3,7 @@ plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2' id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java-library' id 'java-library'
id "org.openapi.generator" version "7.2.0" id "org.openapi.generator" version "7.2.0"
id "org.jetbrains.kotlin.plugin.serialization" version "1.9.20" id "org.jetbrains.kotlin.plugin.serialization" version "${kotlinVersion}"
} }
openApiGenerate { openApiGenerate {
@@ -39,6 +39,6 @@ dependencies {
testImplementation "org.junit.jupiter:junit-jupiter" testImplementation "org.junit.jupiter:junit-jupiter"
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2' testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.2'
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2' testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
testImplementation "org.jetbrains.kotlin:kotlin-test-junit:1.9.20" testImplementation "org.jetbrains.kotlin:kotlin-test-junit:${kotlinVersion}"
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1") implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1")
} }