From 00399d2774a281ad3a23f4f0d28c0d8ad1ef9f53 Mon Sep 17 00:00:00 2001 From: thinkAfCod Date: Sun, 26 Nov 2023 19:18:44 +0800 Subject: [PATCH 1/2] fix: devnet --- docker/docker-compose.yml | 21 +++++++++++++++++-- docker/start-hildr-node-java.sh | 13 ++++++++++++ .../main/java/io/optimism/driver/Driver.java | 6 +++++- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 467c0756..0eeb82bf 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -33,7 +33,7 @@ services: <<: *logging op-geth: - image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101105.2 + image: us-docker.pkg.dev/oplabs-tools-artifacts/images/op-geth:v1.101304.1 container_name: op-geth profiles: - op-geth @@ -49,7 +49,7 @@ services: volumes: - ./:/scripts - data:/data - - ${OP_GENESIS_JSON_FILEPATH:-.}:/genesis-l2.json + - ${OP_GENESIS_JSON_FILEPATH:-.}:/genesis-l2-attached.json <<: *logging op-erigon: @@ -71,6 +71,23 @@ services: - data:/data <<: *logging + op-challenger: + image: merklefruit/op-challenger:latest + container_name: op-challenger + profiles: + - challenger + restart: unless-stopped + stop_grace_period: 3m + entrypoint: /scripts/start-op-challenger.sh + env_file: + - .env + ports: + - 9201:9201 + volumes: + - ./:/scripts + - data:/data + <<: *logging + prometheus: image: prom/prometheus:latest container_name: prometheus diff --git a/docker/start-hildr-node-java.sh b/docker/start-hildr-node-java.sh index 25d4b88c..d671ae63 100755 --- a/docker/start-hildr-node-java.sh +++ b/docker/start-hildr-node-java.sh @@ -1,6 +1,17 @@ #!/bin/sh set -e +DEVNET="" + +if [ $NETWORK = "custom" ] || [ $NETWORK = "devnet" ] +then + NETWORK="./rollup.json" + if [ "$NETWORK" = "devnet" ] + then + DEVNET="--devnet" + fi +fi + if [ $SYNC_MODE = "full" ] then exec java --enable-preview \ @@ -12,6 +23,7 @@ then --l2-rpc-url http://${EXECUTION_CLIENT}:8545 \ --l2-engine-url http://${EXECUTION_CLIENT}:8551 \ --rpc-port $RPC_PORT \ + $DEVNET \ --sync-mode $SYNC_MODE elif [ $SYNC_MODE = "checkpoint"] then @@ -24,6 +36,7 @@ then --l2-rpc-url http://${EXECUTION_CLIENT}:8545 \ --l2-engine-url http://${EXECUTION_CLIENT}:8551 \ --rpc-port $RPC_PORT \ + $DEVNET \ --sync-mode $SYNC_MODE \ --checkpoint-sync-url $CHECKPOINT_SYNC_URL \ --checkpoint-hash $CHECKPOINT_HASH diff --git a/hildr-node/src/main/java/io/optimism/driver/Driver.java b/hildr-node/src/main/java/io/optimism/driver/Driver.java index 44fdfeb2..204af207 100644 --- a/hildr-node/src/main/java/io/optimism/driver/Driver.java +++ b/hildr-node/src/main/java/io/optimism/driver/Driver.java @@ -18,6 +18,7 @@ import static java.lang.Thread.sleep; import static org.web3j.protocol.core.DefaultBlockParameterName.FINALIZED; +import static org.web3j.protocol.core.DefaultBlockParameterName.LATEST; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; @@ -69,6 +70,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.web3j.protocol.Web3j; +import org.web3j.protocol.core.DefaultBlockParameter; +import org.web3j.protocol.core.DefaultBlockParameterName; import org.web3j.protocol.core.methods.response.EthBlock; import org.web3j.utils.Numeric; @@ -182,8 +185,9 @@ public static Driver from(Config config, CountDownLatch latch) EthBlock finalizedBlock; try (var scope = new StructuredTaskScope.ShutdownOnFailure()) { + var parameter = config.devnet() != null && config.devnet() ? LATEST : FINALIZED; StructuredTaskScope.Subtask finalizedBlockFuture = scope.fork(TracerTaskWrapper.wrap( - () -> provider.ethGetBlockByNumber(FINALIZED, true).send())); + () -> provider.ethGetBlockByNumber(parameter, true).send())); scope.join(); scope.throwIfFailed(); From 49a043254a59eee11b1ab2417a218097bb3e406e Mon Sep 17 00:00:00 2001 From: thinkAfCod Date: Sun, 26 Nov 2023 19:20:13 +0800 Subject: [PATCH 2/2] fix: spotless --- hildr-node/src/main/java/io/optimism/driver/Driver.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/hildr-node/src/main/java/io/optimism/driver/Driver.java b/hildr-node/src/main/java/io/optimism/driver/Driver.java index 204af207..0d65a535 100644 --- a/hildr-node/src/main/java/io/optimism/driver/Driver.java +++ b/hildr-node/src/main/java/io/optimism/driver/Driver.java @@ -70,8 +70,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.web3j.protocol.Web3j; -import org.web3j.protocol.core.DefaultBlockParameter; -import org.web3j.protocol.core.DefaultBlockParameterName; import org.web3j.protocol.core.methods.response.EthBlock; import org.web3j.utils.Numeric;