Skip to content

Commit

Permalink
fix:fix release
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Kai <281165273grape@gmail.com>
  • Loading branch information
GrapeBaBa committed Dec 16, 2023
1 parent 426b489 commit 0b54872
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 23 deletions.
19 changes: 3 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
name: GraalVM Native Image

on:
push:
tags:
- '*'
paths-ignore:
- LICENSE
- '*.md'
release:
types: [created]

defaults:
run:
Expand All @@ -31,7 +27,6 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [ '22.3.2' ]
java-version: [ '21' ]
os: [ macos-latest ]

Expand All @@ -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'
Expand All @@ -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
Expand All @@ -78,7 +70,6 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [ '22.3.2' ]
java-version: [ '21' ]
os: [ windows-latest ]

Expand All @@ -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'
Expand All @@ -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
Expand All @@ -122,7 +112,6 @@ jobs:
strategy:
fail-fast: false
matrix:
version: [ '22.3.2' ]
java-version: [ '21' ]
os: [ ubuntu-latest ]

Expand All @@ -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'
Expand Down Expand Up @@ -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 }}
Expand Down
15 changes: 15 additions & 0 deletions hildr-node/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions hildr-node/src/main/java/io/optimism/cli/Cli.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
47 changes: 40 additions & 7 deletions hildr-node/src/main/java/io/optimism/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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");
}
Expand Down Expand Up @@ -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");
}
Expand Down
21 changes: 21 additions & 0 deletions hildr-node/src/test/java/io/optimism/config/ConfigTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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.
*/
Expand All @@ -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"
Expand Down

0 comments on commit 0b54872

Please sign in to comment.