Skip to content

Commit

Permalink
Merge pull request #56 from optimism-java/libp2p
Browse files Browse the repository at this point in the history
Libp2p
  • Loading branch information
GrapeBaBa authored Nov 5, 2023
2 parents 4f3752c + 7ae610c commit 7d45054
Show file tree
Hide file tree
Showing 184 changed files with 20,373 additions and 13,715 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [ '20.0.1' ]
java-version: [ '20.0.1' ]
version: [ '21.0.1' ]
java-version: [ '21' ]
os: [ macos-latest ]

outputs:
Expand Down Expand Up @@ -74,8 +74,8 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [ '20.0.1' ]
java-version: [ '20.0.1' ]
version: [ '21.0.1' ]
java-version: [ '21' ]
os: [ windows-latest ]

outputs:
Expand Down Expand Up @@ -118,8 +118,8 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [ '20.0.1' ]
java-version: [ '20.0.1' ]
version: [ '21.0.1' ]
java-version: [ '21' ]
os: [ ubuntu-latest ]

outputs:
Expand Down Expand Up @@ -170,8 +170,8 @@ jobs:
- name: ☕ Setup GraalVM Build
uses: graalvm/setup-graalvm@v1
with:
version: '20.0.1'
java-version: '20.0.1'
version: '21.0.1'
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'gradle'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Hildr

Hildr is an OP Stack rollup client written in the Java 20 with GraalVM native.
Hildr is an OP Stack rollup client written in the Java 21 with GraalVM native.

Follow the [spec](https://github.com/ethereum-optimism/optimism/blob/develop/specs/rollup-node.md)

Expand Down
16 changes: 10 additions & 6 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,31 @@
FROM ubuntu:latest as builder
RUN apt-get update && apt-get install -y wget curl tar build-essential libz-dev zlib1g-dev musl-tools
ENV JAVA_PKG=https://download.oracle.com/graalvm/20/latest/graalvm-jdk-20_linux-x64_bin.tar.gz \
JAVA_HOME=/usr/java/jdk-20
ENV JAVA_PKG=https://download.oracle.com/graalvm/21/latest/graalvm-jdk-21_linux-x64_bin.tar.gz \
JAVA_HOME=/usr/java/jdk-21
#RUN curl --output /tmp/jdk.tgz $JAVA_PKG
RUN wget -c $JAVA_PKG -O /tmp/jdk.tar.gz
RUN mkdir -p $JAVA_HOME
RUN tar -zxvf /tmp/jdk.tar.gz --directory $JAVA_HOME --strip-components 1
RUN /usr/java/jdk-20/bin/gu install native-image
#RUN /usr/java/jdk-20/bin/gu install native-image
ENV PATH=$JAVA_HOME/bin:$PATH
RUN java -version
RUN native-image --version
WORKDIR /root/hildr
COPY . .
#RUN ./gradlew -Pagent run --args="--network optimism-goerli --jwt-secret bf549f5188556ce0951048ef467ec93067bc4ea21acebe46ef675cd4e8e015ff --l1-rpc-url https://eth-goerli.g.alchemy.com/v2/4fUcO9-bSvCtGYwwibuWbz7ktjWwuoN3 --l2-rpc-url http://192.168.3.230:8545 --l2-engine-url http://192.168.3.230:8551 --rpc-port 9545 --sync-mode full"
#RUN ./gradlew metadataCopy --task run --dir src/main/resources/META-INF/native-image
#RUN ./gradlew buildJarForDocker
RUN ./gradlew clean nativeCompile -Pmusl
RUN #./gradlew :hildr-node:clean :hildr-node:nativeCompile -Pmusl
RUN ./gradlew :hildr-node:clean :hildr-node:buildBinary
#RUN cd /root/hildr/hildr-node/build/docker && \
#native-image -jar hildr-node.jar --no-fallback --enable-http --enable-https --enable-preview --add-modules jdk.incubator.concurrent -H:EnableURLProtocols=http,https --initialize-at-build-time=org.slf4j.LoggerFactory,ch.qos.logback.core.CoreConstants,ch.qos.logback.core.util.Loader,ch.qos.logback.core.util.StatusPrinter,ch.qos.logback.core.status.InfoStatus,ch.qos.logback.classic.Logger,ch.qos.logback.core.rolling.helper.FileNamePattern,ch.qos.logback.classic.Level,ch.qos.logback.core.status.StatusBase,io.opentelemetry.api.trace.ArrayBasedTraceStateBuilder,io.opentelemetry.context.LazyStorage,ch.qos.logback.core.util.FileSize,ch.qos.logback.core.rolling.helper.RollingCalendar,io.opentelemetry.api.internal.ImmutableSpanContext,io.opentelemetry.api.internal.OtelEncodingUtils,ch.qos.logback.classic.PatternLayout,io.opentelemetry.context.ThreadLocalContextStorage,io.opentelemetry.api.trace.PropagatedSpan,io.opentelemetry.context.ContextStorageWrappers,ch.qos.logback.core.rolling.helper.Compressor$1,io.opentelemetry.api.trace.ImmutableTraceFlags,ch.qos.logback.core.rolling.helper.RollingCalendar$1,ch.qos.logback.classic.model.ConfigurationModel,ch.qos.logback.core.model.processor.DefaultProcessor$1,ch.qos.logback.core.model.processor.ImplicitModelHandler$1,ch.qos.logback.core.subst.Token,ch.qos.logback.core.pattern.parser.Parser,ch.qos.logback.core.subst.Parser$1,ch.qos.logback.core.util.Duration,ch.qos.logback.core.model.processor.ChainedModelFilter$1,ch.qos.logback.classic.model.processor.ConfigurationModelHandler,ch.qos.logback.classic.model.processor.LogbackClassicDefaultNestedComponentRules,ch.qos.logback.core.subst.NodeToStringTransformer$1,ch.qos.logback.core.pattern.parser.TokenStream$1,ch.qos.logback.core.subst.Tokenizer$1 --initialize-at-run-time=io.netty.channel.AbstractChannel,io.netty.channel.socket.nio.SelectorProviderUtil,io.netty.util.concurrent.DefaultPromise,io.netty,org.slf4j.MDC,org.github.gestalt.config hildr-node

FROM ubuntu:latest
RUN apt-get update

WORKDIR /usr/local/bin
#COPY --from=builder /root/hildr/hildr-node/build/docker/hildr* .
COPY --from=builder /root/hildr/hildr-node/build/native/nativeCompile/hildr* .
COPY --from=builder /root/hildr/hildr-node/build/binary/hildr* .
#COPY --from=builder /root/hildr/hildr-node/build/native/nativeCompile/hildr* .

RUN chmod 0755 hildr-node && export PATH=/usr/local/bin:$PATH

Expand Down
4 changes: 2 additions & 2 deletions docker/jvm.dock
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM eclipse-temurin:19-jdk as builder
FROM ghcr.io/graalvm/graalvm-community:21 as builder

WORKDIR /root/hildr
COPY . .
RUN ./gradlew clean buildJarForDocker

FROM eclipse-temurin:19-jdk
FROM ghcr.io/graalvm/graalvm-community:21

WORKDIR /usr/local/bin
COPY --from=builder /root/hildr/hildr-node/build/docker/hildr-node.jar .
Expand Down
6 changes: 4 additions & 2 deletions docker/start-hildr-node-java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@ set -e

if [ $SYNC_MODE = "full" ]
then
exec java --enable-preview --add-modules jdk.incubator.concurrent \
exec java --enable-preview \
-cp $HILDR_JAR $HILDR_MAIN_CLASS \
--network $NETWORK \
--jwt-secret $JWT_SECRET \
--l1-rpc-url $L1_RPC_URL \
--l1-ws-rpc-url $L1_WS_RPC_URL \
--l2-rpc-url http://${EXECUTION_CLIENT}:8545 \
--l2-engine-url http://${EXECUTION_CLIENT}:8551 \
--rpc-port $RPC_PORT \
--sync-mode $SYNC_MODE
elif [ $SYNC_MODE = "checkpoint"]
then
exec java --enable-preview --add-modules jdk.incubator.concurrent \
exec java --enable-preview \
-cp $HILDR_JAR $HILDR_MAIN_CLASS \
--network $NETWORK \
--jwt-secret $JWT_SECRET \
--l1-rpc-url $L1_RPC_URL \
--l1-ws-rpc-url $L1_WS_RPC_URL \
--l2-rpc-url http://${EXECUTION_CLIENT}:8545 \
--l2-engine-url http://${EXECUTION_CLIENT}:8551 \
--rpc-port $RPC_PORT \
Expand Down
6 changes: 4 additions & 2 deletions docker/start-hildr-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ then
exec hildr-node \
--network $NETWORK \
--jwt-secret $JWT_SECRET \
--l1-rpc-url $L1_RPC_URL \
--l1-rpc-url $L1_WS_RPC_URL \
--l1-ws-rpc-url $L1_WS_RPC_URL \
--l2-rpc-url http://${EXECUTION_CLIENT}:8545 \
--l2-engine-url http://${EXECUTION_CLIENT}:8551 \
--rpc-port $RPC_PORT \
Expand All @@ -27,7 +28,8 @@ then
exec hildr-node \
--network $NETWORK \
--jwt-secret $JWT_SECRET \
--l1-rpc-url $L1_RPC_URL \
--l1-rpc-url $L1_WS_RPC_URL \
--l1-ws-rpc-url $L1_WS_RPC_URL \
--l2-rpc-url http://${EXECUTION_CLIENT}:8545 \
--l2-engine-url http://${EXECUTION_CLIENT}:8551 \
--rpc-port $RPC_PORT \
Expand Down
2 changes: 1 addition & 1 deletion docker/start-op-erigon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ exec erigon \
--authrpc.port=8551 \
--authrpc.vhosts="*" \
--authrpc.jwtsecret=/jwtsecret.txt \
--rollup.sequencerhttp="https://goerli.optimism.io" \
--rollup.sequencerhttp="https://goerli.optimism.io" \
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
79 changes: 39 additions & 40 deletions hildr-batcher/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
plugins {
id 'java'
id 'application'
id 'checkstyle'
id "jacoco"
id "com.diffplug.spotless" version "6.19.0"
id "com.diffplug.spotless" version "6.22.0"
id "net.ltgt.errorprone" version "3.1.0"
id 'org.graalvm.buildtools.native' version '0.9.22'
id 'org.graalvm.buildtools.native' version '0.9.28'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}

Expand Down Expand Up @@ -38,18 +37,18 @@ tasks.withType(JavaCompile).configureEach {
options.annotationProcessorPath = configurations.annotationProcessor
options.compilerArgs += "--enable-preview"
options.compilerArgs += "-Xlint:preview"
options.compilerArgs += ["--add-modules", "jdk.incubator.concurrent"]
// options.compilerArgs += ["--add-modules", "jdk.incubator.concurrent"]
options.compilerArgs += ["-Aproject=${project.group}/${project.name}"]
}

tasks.withType(JavaExec).configureEach {
jvmArgs += "--enable-preview"
jvmArgs += ["--add-modules", "jdk.incubator.concurrent"]
// jvmArgs += ["--add-modules", "jdk.incubator.concurrent"]
}

tasks.withType(Test).configureEach {
jvmArgs += "--enable-preview"
jvmArgs += ["--add-modules", "jdk.incubator.concurrent"]
// jvmArgs += ["--add-modules", "jdk.incubator.concurrent"]
}

dependencies {
Expand Down Expand Up @@ -124,7 +123,7 @@ dependencies {
// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(20)
languageVersion = JavaLanguageVersion.of(21)
}
}

Expand Down Expand Up @@ -158,17 +157,17 @@ jacocoTestCoverageVerification {
}
}

checkstyle {
toolVersion = '10.10.0'
// default checkstyle config -- specific to your team agreement
configFile = project(":").file("config/checkstyle/google_checks.xml")
// Google style (idiosyncratic to Google):
// configFile = project(":").file("config/checkstyle/google_checks.xml")
// SUN style (closest to modern Java styles) -- the basis for this project:
// configFile = project(":").file("config/checkstyle/sun_checks.xml")
// ignoreFailures = false
// maxWarnings = 0
}
//checkstyle {
// toolVersion = '10.10.0'
// // default checkstyle config -- specific to your team agreement
// configFile = project(":").file("config/checkstyle/google_checks.xml")
// // Google style (idiosyncratic to Google):
// // configFile = project(":").file("config/checkstyle/google_checks.xml")
// // SUN style (closest to modern Java styles) -- the basis for this project:
// // configFile = project(":").file("config/checkstyle/sun_checks.xml")
//// ignoreFailures = false
//// maxWarnings = 0
//}

spotless {
// optional: limit format enforcement to just the files changed by this feature branch
Expand All @@ -189,7 +188,7 @@ spotless {
// don't need to set target, it is inferred from java

// apply a specific flavor of google-java-format
googleJavaFormat('1.17.0')
palantirJavaFormat('2.38.0')
// fix formatting of type annotations
formatAnnotations()
// make sure every file has the following copyright header.
Expand All @@ -206,25 +205,25 @@ spotless {
}
}

checkstyleMain
.exclude('io/optimism/rpc/handler/TimeoutHandler.java')
.exclude('io/optimism/rpc/handler/JsonRpcExecutorHandler.java')
.exclude('io/optimism/rpc/handler/JsonRpcParseHandler.java')
.exclude('io/optimism/rpc/methods/JsonRpcMethod.java')
.exclude('io/optimism/rpc/methods/JsonRpcMethodsFactory.java')
.exclude('io/optimism/rpc/methods/JsonRpcProcessor.java')
.exclude('io/optimism/rpc/execution/LoggedJsonRpcProcessor.java')
.exclude('io/optimism/rpc/internal/JsonRpcRequest.java')
.exclude('io/optimism/rpc/internal/JsonRpcRequestContext.java')
.exclude('io/optimism/rpc/internal/JsonRpcRequestId.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcResponse.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcErrorResponse.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcError.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcResponseType.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcSuccessResponse.java')
.exclude('io/optimism/rpc/internal/response/JsonRpcNoResponse.java')
.exclude('io/optimism/rpc/execution/BaseJsonRpcProcessor.java')
.exclude('io/optimism/rpc/execution/JsonRpcProcessor.java')
//checkstyleMain
// .exclude('io/optimism/rpc/handler/TimeoutHandler.java')
// .exclude('io/optimism/rpc/handler/JsonRpcExecutorHandler.java')
// .exclude('io/optimism/rpc/handler/JsonRpcParseHandler.java')
// .exclude('io/optimism/rpc/methods/JsonRpcMethod.java')
// .exclude('io/optimism/rpc/methods/JsonRpcMethodsFactory.java')
// .exclude('io/optimism/rpc/methods/JsonRpcProcessor.java')
// .exclude('io/optimism/rpc/execution/LoggedJsonRpcProcessor.java')
// .exclude('io/optimism/rpc/internal/JsonRpcRequest.java')
// .exclude('io/optimism/rpc/internal/JsonRpcRequestContext.java')
// .exclude('io/optimism/rpc/internal/JsonRpcRequestId.java')
// .exclude('io/optimism/rpc/internal/response/JsonRpcResponse.java')
// .exclude('io/optimism/rpc/internal/response/JsonRpcErrorResponse.java')
// .exclude('io/optimism/rpc/internal/response/JsonRpcError.java')
// .exclude('io/optimism/rpc/internal/response/JsonRpcResponseType.java')
// .exclude('io/optimism/rpc/internal/response/JsonRpcSuccessResponse.java')
// .exclude('io/optimism/rpc/internal/response/JsonRpcNoResponse.java')
// .exclude('io/optimism/rpc/execution/BaseJsonRpcProcessor.java')
// .exclude('io/optimism/rpc/execution/JsonRpcProcessor.java')

tasks.named('test') {
// Use JUnit Platform for unit tests.
Expand Down Expand Up @@ -258,8 +257,8 @@ javadoc {
options.addBooleanOption('html5', true)
}
options.addBooleanOption('-enable-preview', true)
options.addStringOption('-release', '20')
options.addStringOption('-add-modules', 'jdk.incubator.concurrent')
options.addStringOption('-release', '21')
// options.addStringOption('-add-modules', 'jdk.incubator.concurrent')
}

jar {
Expand Down
Loading

0 comments on commit 7d45054

Please sign in to comment.