Skip to content

Commit

Permalink
feat:canyou upgrade fix
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Kai <[email protected]>
  • Loading branch information
GrapeBaBa committed Dec 15, 2023
1 parent 1aa3e2d commit 15572ad
Show file tree
Hide file tree
Showing 20 changed files with 10,596 additions and 7,890 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -203,27 +203,37 @@ jobs:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}

- name: Build and push Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/jvm.dock
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build and push graalvm native Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}-native
labels: ${{ steps.meta.outputs.labels }}-native


release:
name: 🚰 Release new version.
needs: [ native-build-osx, native-build-musl, native-build-linux, native-build-windows, push_image_to_github ]
Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This contains a simple docker setup for running hildr and op-geth.

Begin by copying `.env.default` to `.env`. You can set the network to sync to by changing the `NETWORK` value (supported options are optimism-goerli and base-goerli). Make sure to set the `L1_RPC_URL` value to a valid RPC URL for the L1 being used by the given network. If you are running in production, you may also want to set a secure `JWT_SECRET` value. You can create a new secret by running `openssl rand -hex 32`.

To run both hildr and op-geth together, run `docker compose up`. To run just op-geth without hildr for local development, run `COMPOSE_PROFILES=op-geth,metrics docker compose up`
To run both hildr and op-geth together, run `docker compose up`. To run just op-geth without hildr for local development, run `COMPOSE_PROFILES=hildr-node,op-geth,metrics docker compose up -d`

## Troubleshooting
If you are getting `permission denied` errors when attempting to run `docker-compose`, try `sudo docker compose` instead. This is often required when running docker depending on how it was installed.
6 changes: 3 additions & 3 deletions hildr-node/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ plugins {
id 'application'
// id "checkstyle"
id "jacoco"
id "com.diffplug.spotless" version "6.22.0"
id "com.diffplug.spotless" version "6.23.3"
id "net.ltgt.errorprone" version "3.1.0"
id 'org.graalvm.buildtools.native' version '0.9.28'
id 'com.github.johnrengelman.shadow' version '8.1.1'
Expand All @@ -23,7 +23,7 @@ plugins {
}

group 'me.grapebaba'
version '0.2.1'
version '0.2.2'

repositories {
// Use Maven Central for resolving dependencies.
Expand Down Expand Up @@ -74,7 +74,7 @@ dependencies {
implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.2")
implementation("com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2")

implementation('org.web3j:core:4.9.8') {
implementation('org.web3j:core:4.10.3') {
exclude group: 'org.bouncycastle', module: 'bcprov-jdk15on'
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
exclude group: 'com.squareup.okhttp3', module: 'logging-interceptor'
Expand Down
157 changes: 90 additions & 67 deletions hildr-node/src/main/java/io/optimism/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@
/**
* The type Config.
*
* @param l1RpcUrl L1 chain rpc url.
* @param l1WsRpcUrl L1 chain websocket rpc url.
* @param l2RpcUrl L2 chain rpc url.
* @param l2EngineUrl L2 engine API url.
* @param jwtSecret L2 engine API jwt secret.
* @param chainConfig The chain config.
* @param rpcPort The rpc port.
* @param devnet The flag of devnet.
* @param l1RpcUrl L1 chain rpc url.
* @param l1WsRpcUrl L1 chain websocket rpc url.
* @param l2RpcUrl L2 chain rpc url.
* @param l2EngineUrl L2 engine API url.
* @param jwtSecret L2 engine API jwt secret.
* @param chainConfig The chain config.
* @param rpcPort The rpc port.
* @param devnet The flag of devnet.
* @param checkpointSyncUrl The checkpoint sync url.
* @author grapebaba
* @since 0.1.0
Expand All @@ -72,8 +72,8 @@ public record Config(
/**
* Create Config.
*
* @param configPath the config path
* @param cliConfig the cli config
* @param configPath the config path
* @param cliConfig the cli config
* @param chainConfig the chain config
* @return the config
*/
Expand All @@ -85,15 +85,7 @@ public static Config create(Path configPath, CliConfig cliConfig, ChainConfig ch
TomlLoader tomlLoader = new TomlLoader();
PropertyLoader propertyLoader = new PropertyLoader();

Map<String, String> defaultProvider = new HashMap<>();
defaultProvider.put("config.l2RpcUrl", "http://127.0.0.1:8545");
defaultProvider.put("config.l2EngineUrl", "http://127.0.0.1:8551");
defaultProvider.put("config.l1RpcUrl", "");
defaultProvider.put("config.l1WsRpcUrl", "");
defaultProvider.put("config.jwtSecret", "");
defaultProvider.put("config.checkpointSyncUrl", "");
defaultProvider.put("config.rpcPort", "9545");
MapConfigSource defaultProviderConfigSource = new MapConfigSource(defaultProvider);
MapConfigSource defaultProviderConfigSource = getMapConfigSource();

Map<String, String> chainProvider = chainConfig.toConfigMap();
MapConfigSource chainConfigSource = new MapConfigSource(chainProvider);
Expand Down Expand Up @@ -133,17 +125,29 @@ public static Config create(Path configPath, CliConfig cliConfig, ChainConfig ch
}
}

private static MapConfigSource getMapConfigSource() {
Map<String, String> defaultProvider = new HashMap<>();
defaultProvider.put("config.l2RpcUrl", "http://127.0.0.1:8545");
defaultProvider.put("config.l2EngineUrl", "http://127.0.0.1:8551");
defaultProvider.put("config.l1RpcUrl", "");
defaultProvider.put("config.l1WsRpcUrl", "");
defaultProvider.put("config.jwtSecret", "");
defaultProvider.put("config.checkpointSyncUrl", "");
defaultProvider.put("config.rpcPort", "9545");
return new MapConfigSource(defaultProvider);
}

/**
* The type Cli config.
*
* @param l1RpcUrl L1 chain rpc url.
* @param l1WsRpcUrl L1 chain websocket rpc url.
* @param l2RpcUrl L2 chain rpc url.
* @param l2EngineUrl L2 engine API url.
* @param jwtSecret L2 engine API jwt secret.
* @param l1RpcUrl L1 chain rpc url.
* @param l1WsRpcUrl L1 chain websocket rpc url.
* @param l2RpcUrl L2 chain rpc url.
* @param l2EngineUrl L2 engine API url.
* @param jwtSecret L2 engine API jwt secret.
* @param checkpointSyncUrl The checkpoint sync url.
* @param rpcPort The rpc port.
* @param devnet The devnet flag.
* @param rpcPort The rpc port.
* @param devnet The devnet flag.
*/
public record CliConfig(
String l1RpcUrl,
Expand Down Expand Up @@ -191,22 +195,23 @@ public Map<String, String> toConfigMap() {
/**
* The type ChainConfig.
*
* @param network The network name.
* @param l1StartEpoch The L1 block referenced by the L2 chainConfig.
* @param l2Genesis The L2 genesis block info.
* @param systemConfig The initial system config value.
* @param batchInbox The batch inbox address.
* @param depositContract The deposit contract address.
* @param network The network name.
* @param l1StartEpoch The L1 block referenced by the L2 chainConfig.
* @param l2Genesis The L2 genesis block info.
* @param systemConfig The initial system config value.
* @param batchInbox The batch inbox address.
* @param depositContract The deposit contract address.
* @param systemConfigContract The L1 system config contract.
* @param maxChannelSize The maximum byte size of all pending channels.
* @param channelTimeout The max timeout for a channel (as measured by the frame L1 block number).
* @param seqWindowSize Number of L1 blocks in a sequence window.
* @param maxSeqDrift Maximum timestamp drift.
* @param regolithTime Timestamp of the regolith hardfork.
* @param blockTime Network blocktime.
* @param l2Tol1MessagePasser L2 To L1 Message passer address.
* @param l1ChainId The L1 chain id.
* @param l2ChainId The L2 chain id.
* @param maxChannelSize The maximum byte size of all pending channels.
* @param channelTimeout The max timeout for a channel (as measured by the frame L1 block number).
* @param seqWindowSize Number of L1 blocks in a sequence window.
* @param maxSeqDrift Maximum timestamp drift.
* @param regolithTime Timestamp of the regolith hardfork.
* @param canyonTime Timestamp of the canyon hardfork.
* @param blockTime Network blocktime.
* @param l2Tol1MessagePasser L2 To L1 Message passer address.
* @param l1ChainId The L1 chain id.
* @param l2ChainId The L2 chain id.
* @author grapebaba
* @since 0.1.0
*/
Expand All @@ -225,6 +230,7 @@ public record ChainConfig(
BigInteger seqWindowSize,
BigInteger maxSeqDrift,
BigInteger regolithTime,
BigInteger canyonTime,
BigInteger blockTime,
String l2Tol1MessagePasser) {

Expand Down Expand Up @@ -261,6 +267,7 @@ public static ChainConfig optimism() {
BigInteger.valueOf(3600L),
BigInteger.valueOf(600L),
BigInteger.ZERO,
BigInteger.valueOf(-1L),
BigInteger.valueOf(2L),
"0x4200000000000000000000000000000000000016");
}
Expand Down Expand Up @@ -298,6 +305,7 @@ public static ChainConfig base() {
BigInteger.valueOf(3600L),
BigInteger.valueOf(600L),
BigInteger.ZERO,
BigInteger.valueOf(-1L),
BigInteger.valueOf(2L),
"0x4200000000000000000000000000000000000016");
}
Expand Down Expand Up @@ -335,6 +343,7 @@ public static ChainConfig optimismGoerli() {
BigInteger.valueOf(3600L),
BigInteger.valueOf(600L),
BigInteger.valueOf(1679079600L),
BigInteger.valueOf(1699981200L),
BigInteger.valueOf(2L),
"0xEF2ec5A5465f075E010BE70966a8667c94BCe15a");
}
Expand Down Expand Up @@ -372,6 +381,7 @@ public static ChainConfig optimismSepolia() {
BigInteger.valueOf(3600L),
BigInteger.valueOf(600L),
BigInteger.ZERO,
BigInteger.valueOf(1699981200L),
BigInteger.valueOf(2L),
"0x4200000000000000000000000000000000000016");
}
Expand Down Expand Up @@ -409,6 +419,7 @@ public static ChainConfig baseGoerli() {
BigInteger.valueOf(3600L),
BigInteger.valueOf(600L),
BigInteger.valueOf(1683219600L),
BigInteger.valueOf(-1L),
BigInteger.valueOf(2L),
"0x4200000000000000000000000000000000000016");
}
Expand Down Expand Up @@ -461,6 +472,7 @@ public static ChainConfig fromExternal(ExternalChainConfig external) {
external.seqWindowSize,
external.maxSequencerDrift,
external.regolithTime,
external.canyonTime,
external.blockTime,
"0x4200000000000000000000000000000000000016");
}
Expand Down Expand Up @@ -509,6 +521,7 @@ public Map<String, String> toConfigMap() {
entry("config.chainConfig.seqWindowSize", this.seqWindowSize.toString()),
entry("config.chainConfig.maxSeqDrift", this.maxSeqDrift.toString()),
entry("config.chainConfig.regolithTime", this.regolithTime.toString()),
entry("config.chainConfig.canyonTime", this.canyonTime.toString()),
entry("config.chainConfig.blockTime", this.blockTime.toString()),
entry("config.chainConfig.l2Tol1MessagePasser", this.l2Tol1MessagePasser));
}
Expand All @@ -521,13 +534,21 @@ public Map<String, String> toConfigMap() {
* @since 0.1.0
*/
public enum SyncMode {
/** Fast sync mode. */
/**
* Fast sync mode.
*/
Fast,
/** Challenge sync mode. */
/**
* Challenge sync mode.
*/
Challenge,
/** Full sync mode. */
/**
* Full sync mode.
*/
Full,
/** Checkpoint sync mode. */
/**
* Checkpoint sync mode.
*/
Checkpoint;

/**
Expand All @@ -552,7 +573,7 @@ public static SyncMode from(String value) {
*
* @param attributesDepositor attributes depositor.
* @param attributesPreDeploy attributes preDeploy.
* @param feeVault fee vault.
* @param feeVault fee vault.
* @author grapebaba
* @since 0.1.0
*/
Expand All @@ -574,10 +595,10 @@ public static SystemAccounts defaultSystemAccounts() {
/**
* The type SystemConfig.
*
* @param batchSender batch sender address.
* @param gasLimit gas limit.
* @param l1FeeOverhead L1 fee overhead.
* @param l1FeeScalar L1 fee scalar.
* @param batchSender batch sender address.
* @param gasLimit gas limit.
* @param l1FeeOverhead L1 fee overhead.
* @param l1FeeScalar L1 fee scalar.
* @param unsafeBlockSigner unsafe block signer address.
* @author grapebaba
* @since 0.1.0
Expand Down Expand Up @@ -605,17 +626,18 @@ public String batcherHash() {
* <p>This is used to parse external chain configs from JSON. This interface corresponds to the
* default output of the `op-node`
*
* @param genesis external genesis info
* @param blockTime block time
* @param maxSequencerDrift max sequencer drift
* @param seqWindowSize seq window size
* @param channelTimeout channel timeout
* @param l1ChainId l1 chain id
* @param l2ChainId l2 chain id
* @param regolithTime regolith time
* @param batchInboxAddress batch inbox address
* @param genesis external genesis info
* @param blockTime block time
* @param maxSequencerDrift max sequencer drift
* @param seqWindowSize seq window size
* @param channelTimeout channel timeout
* @param l1ChainId l1 chain id
* @param l2ChainId l2 chain id
* @param regolithTime regolith time
* @param canyonTime canyon time
* @param batchInboxAddress batch inbox address
* @param depositContractAddress deposit contract address
* @param l1SystemConfigAddress l1 system config address
* @param l1SystemConfigAddress l1 system config address
*/
@JsonSerialize
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
Expand All @@ -628,16 +650,17 @@ public record ExternalChainConfig(
BigInteger l1ChainId,
BigInteger l2ChainId,
BigInteger regolithTime,
BigInteger canyonTime,
String batchInboxAddress,
String depositContractAddress,
String l1SystemConfigAddress) {}

/**
* External Genesis Info.
*
* @param l1 L1 chain genesis info
* @param l2 L2 chain genesis info
* @param l2Time L2 time
* @param l1 L1 chain genesis info
* @param l2 L2 chain genesis info
* @param l2Time L2 time
* @param systemConfig system config
*/
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class)
Expand All @@ -648,17 +671,17 @@ public record ExternalGenesisInfo(
* system config info.
*
* @param batcherAddr batcher address
* @param overhead overhead
* @param scalar scalar
* @param gasLimit gas limit
* @param overhead overhead
* @param scalar scalar
* @param gasLimit gas limit
*/
@JsonNaming(PropertyNamingStrategies.LowerCamelCaseStrategy.class)
public record SystemConfigInfo(String batcherAddr, String overhead, String scalar, BigInteger gasLimit) {}

/**
* chain genesis info.
*
* @param hash chain hash
* @param hash chain hash
* @param number chain number
*/
public record ChainGenesisInfo(String hash, BigInteger number) {}
Expand Down
Loading

0 comments on commit 15572ad

Please sign in to comment.