From 0b5487267904e557427d3d86974c3af2513cce93 Mon Sep 17 00:00:00 2001 From: Chen Kai <281165273grape@gmail.com> Date: Sat, 16 Dec 2023 18:21:02 +0800 Subject: [PATCH] fix:fix release Signed-off-by: Chen Kai <281165273grape@gmail.com> --- .github/workflows/release.yml | 19 ++------ hildr-node/build.gradle | 15 ++++++ .../src/main/java/io/optimism/cli/Cli.java | 1 + .../main/java/io/optimism/config/Config.java | 47 ++++++++++++++++--- .../java/io/optimism/config/ConfigTest.java | 21 +++++++++ 5 files changed, 80 insertions(+), 23 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 787bca71..8fadfbb2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,12 +1,8 @@ name: GraalVM Native Image on: - push: - tags: - - '*' - paths-ignore: - - LICENSE - - '*.md' + release: + types: [created] defaults: run: @@ -31,7 +27,6 @@ jobs: strategy: fail-fast: false matrix: - version: [ '22.3.2' ] java-version: [ '21' ] os: [ macos-latest ] @@ -47,7 +42,6 @@ jobs: - name: ☕ Setup GraalVM Build uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} github-token: ${{ secrets.GITHUB_TOKEN }} distribution: 'graalvm' @@ -58,8 +52,6 @@ jobs: - name: 🏗️ Native Image Build & Test id: native-build run: | - echo $JAVA_HOME - echo $GRAALVM_HOME ./gradlew buildBinary mv hildr-node/build/binary/hildr-node hildr-node/build/binary/hildr-node-osx ls -ltrh hildr-node/build/binary/hildr-node-osx @@ -78,7 +70,6 @@ jobs: strategy: fail-fast: false matrix: - version: [ '22.3.2' ] java-version: [ '21' ] os: [ windows-latest ] @@ -94,7 +85,6 @@ jobs: - name: ☕ Setup GraalVM Build uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} github-token: ${{ secrets.GITHUB_TOKEN }} distribution: 'graalvm' @@ -105,7 +95,7 @@ jobs: - name: 🏗️ Native Image Build & Test id: native-build run: | - ./gradlew buildBinary + ./gradlew buildBinaryOnWindows ls -ltrh hildr-node/build/binary/hildr-node.exe - name: 📤 Upload ${{ matrix.os }} native image @@ -122,7 +112,6 @@ jobs: strategy: fail-fast: false matrix: - version: [ '22.3.2' ] java-version: [ '21' ] os: [ ubuntu-latest ] @@ -138,7 +127,6 @@ jobs: - name: ☕ Setup GraalVM Build uses: graalvm/setup-graalvm@v1 with: - version: ${{ matrix.version }} java-version: ${{ matrix.java-version }} github-token: ${{ secrets.GITHUB_TOKEN }} distribution: 'graalvm' @@ -174,7 +162,6 @@ jobs: - name: ☕ Setup GraalVM Build uses: graalvm/setup-graalvm@v1 with: - version: '22.3.2' java-version: '21' distribution: 'graalvm' github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/hildr-node/build.gradle b/hildr-node/build.gradle index 2a1c2962..aff707a6 100644 --- a/hildr-node/build.gradle +++ b/hildr-node/build.gradle @@ -360,6 +360,21 @@ task buildBinary { println(out.toString()) } +task buildBinaryOnWindows{ + dependsOn copyJarToBinaryDir + def buildBinaryDir = "build/binary" + def out = new ByteArrayOutputStream() + doLast { + exec { + workingDir buildBinaryDir + executable "cmd" + args "/c", "native-image -jar ${project.name}.jar --no-fallback --enable-http --enable-https --enable-preview -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 ${project.name}" + standardOutput out + } + } + println(out.toString()) +} + task buildBinaryStaticNoG1GC { dependsOn copyJarToBinaryDir def buildBinaryDir = "build/binary" diff --git a/hildr-node/src/main/java/io/optimism/cli/Cli.java b/hildr-node/src/main/java/io/optimism/cli/Cli.java index 9a254f7d..0ff0971a 100644 --- a/hildr-node/src/main/java/io/optimism/cli/Cli.java +++ b/hildr-node/src/main/java/io/optimism/cli/Cli.java @@ -174,6 +174,7 @@ private Config toConfig() { case "optimism-sepolia" -> Config.ChainConfig.optimismSepolia(); case "base" -> Config.ChainConfig.base(); case "base-goerli" -> Config.ChainConfig.baseGoerli(); + case "base-sepolia" -> Config.ChainConfig.baseSepolia(); default -> { if (network.endsWith(".json")) { yield Config.ChainConfig.fromJson(network); diff --git a/hildr-node/src/main/java/io/optimism/config/Config.java b/hildr-node/src/main/java/io/optimism/config/Config.java index 49ee22d6..2c9cde67 100644 --- a/hildr-node/src/main/java/io/optimism/config/Config.java +++ b/hildr-node/src/main/java/io/optimism/config/Config.java @@ -267,7 +267,7 @@ public static ChainConfig optimism() { BigInteger.valueOf(3600L), BigInteger.valueOf(600L), BigInteger.ZERO, - BigInteger.valueOf(-1L), + BigInteger.valueOf(1704992401L), BigInteger.valueOf(2L), "0x4200000000000000000000000000000000000016"); } @@ -305,7 +305,7 @@ public static ChainConfig base() { BigInteger.valueOf(3600L), BigInteger.valueOf(600L), BigInteger.ZERO, - BigInteger.valueOf(-1L), + BigInteger.valueOf(1704992401L), BigInteger.valueOf(2L), "0x4200000000000000000000000000000000000016"); } @@ -408,18 +408,51 @@ public static ChainConfig baseGoerli() { new SystemConfig( "0x2d679b567db6187c0c8323fa982cfb88b74dbcc7", BigInteger.valueOf(25_000_000L), - BigInteger.valueOf(2100), - BigInteger.valueOf(1000000), + BigInteger.valueOf(2100L), + BigInteger.valueOf(1000000L), "0x32a4e99A72c11E9DD3dC159909a2D7BD86C1Bc51"), "0x8453100000000000000000000000000000000000", "0xe93c8cd0d409341205a592f8c4ac1a5fe5585cfa", "0xb15eea247ece011c68a614e4a77ad648ff495bc1", BigInteger.valueOf(100_000_000L), - BigInteger.valueOf(100L), + BigInteger.valueOf(300L), BigInteger.valueOf(3600L), BigInteger.valueOf(600L), BigInteger.valueOf(1683219600L), - BigInteger.valueOf(-1L), + BigInteger.valueOf(1699981200L), + BigInteger.valueOf(2L), + "0x4200000000000000000000000000000000000016"); + } + + public static ChainConfig baseSepolia() { + return new ChainConfig( + "base-sepolia", + BigInteger.valueOf(11155111L), + BigInteger.valueOf(84532L), + new Epoch( + BigInteger.valueOf(4370868L), + "0xcac9a83291d4dec146d6f7f69ab2304f23f5be87b1789119a0c5b1e4482444ed", + BigInteger.valueOf(1695768288L)), + new BlockInfo( + "0x0dcc9e089e30b90ddfc55be9a37dd15bc551aeee999d2e2b51414c54eaf934e4", + BigInteger.valueOf(0L), + Numeric.toHexString(new byte[32]), + BigInteger.valueOf(1695768288L)), + new SystemConfig( + "0x6cdebe940bc0f26850285caca097c11c33103e47", + BigInteger.valueOf(25_000_000L), + BigInteger.valueOf(2100L), + BigInteger.valueOf(1000000L), + "0xb830b99c95Ea32300039624Cb567d324D4b1D83C"), + "0xff00000000000000000000000000000000084532", + "0x49f53e41452C74589E85cA1677426Ba426459e85", + "0xf272670eb55e895584501d564AfEB048bEd26194", + BigInteger.valueOf(100_000_000L), + BigInteger.valueOf(300L), + BigInteger.valueOf(3600L), + BigInteger.valueOf(600L), + BigInteger.ZERO, + BigInteger.valueOf(1699981200L), BigInteger.valueOf(2L), "0x4200000000000000000000000000000000000016"); } @@ -472,7 +505,7 @@ public static ChainConfig fromExternal(ExternalChainConfig external) { external.seqWindowSize, external.maxSequencerDrift, external.regolithTime, - external.canyonTime, + external.canyonTime == null ? BigInteger.valueOf(-1L) : external.canyonTime, external.blockTime, "0x4200000000000000000000000000000000000016"); } diff --git a/hildr-node/src/test/java/io/optimism/config/ConfigTest.java b/hildr-node/src/test/java/io/optimism/config/ConfigTest.java index 5648c470..554afd57 100644 --- a/hildr-node/src/test/java/io/optimism/config/ConfigTest.java +++ b/hildr-node/src/test/java/io/optimism/config/ConfigTest.java @@ -102,12 +102,24 @@ void create() { assertEquals(BigInteger.valueOf(2L), config.chainConfig().blockTime()); } + /** + * Base goerli. + */ @Test void baseGoerli() { ChainConfig chainConfig = ChainConfig.baseGoerli(); assertEquals(chainConfig.regolithTime(), BigInteger.valueOf(1683219600L)); } + /** + * Base sepolia. + */ + @Test + void baseSepolia() { + ChainConfig chainConfig = ChainConfig.baseSepolia(); + assertEquals(chainConfig.canyonTime(), BigInteger.valueOf(1699981200L)); + } + /** * Base goerli. */ @@ -117,6 +129,12 @@ void optimismGoerli() { assertEquals(chainConfig.regolithTime(), new BigInteger("1679079600")); } + @Test + void optimismSepolia() { + ChainConfig chainConfig = ChainConfig.optimismSepolia(); + assertEquals(chainConfig.canyonTime(), BigInteger.valueOf(1699981200L)); + } + /** * Batch hash. */ @@ -132,6 +150,9 @@ void batchHash() { assertTrue(systemConfig.batcherHash().contains(Numeric.cleanHexPrefix(systemConfig.batchSender()))); } + /** + * Read external chain from json. + */ @Test void readExternalChainFromJson() { var devnetJson = "{\n"