From 983319bdf8cadff1c02f4e37d57b837b09aabf98 Mon Sep 17 00:00:00 2001 From: Samuel Laferriere Date: Wed, 11 Dec 2024 15:41:04 -0500 Subject: [PATCH] tooling: make client justfile's commands take an optional rollup_config_path Needed to target a devnet which doesnt have a standard chain_id --- .gitignore | 3 +++ bin/client/justfile | 13 ++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 7df26869d..42cc707b3 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,6 @@ monorepo/ # Environment Variables .env + +# kona-host data-dir +data/ \ No newline at end of file diff --git a/bin/client/justfile b/bin/client/justfile index 7eb03331b..5bd260a29 100644 --- a/bin/client/justfile +++ b/bin/client/justfile @@ -63,14 +63,22 @@ run-client-asterisc block_number l1_rpc l1_beacon_rpc l2_rpc rollup_node_rpc ver {{verbosity}} # Run the client program natively with the host program attached. -run-client-native block_number l1_rpc l1_beacon_rpc l2_rpc rollup_node_rpc verbosity='': +run-client-native block_number l1_rpc l1_beacon_rpc l2_rpc rollup_node_rpc rollup_config_path='' verbosity='': #!/usr/bin/env bash + set -o errexit -o nounset -o pipefail L1_NODE_ADDRESS="{{l1_rpc}}" L1_BEACON_ADDRESS="{{l1_beacon_rpc}}" L2_NODE_ADDRESS="{{l2_rpc}}" OP_NODE_ADDRESS="{{rollup_node_rpc}}" + L2_CHAIN_ID=$(cast chain-id --rpc-url $L2_NODE_ADDRESS) + if [ -z "{{rollup_config_path}}" ]; then + CHAIN_ID_OR_ROLLUP_CONFIG_ARG="--l2-chain-id $L2_CHAIN_ID" + else + CHAIN_ID_OR_ROLLUP_CONFIG_ARG="--rollup-config-path $(realpath {{rollup_config_path}})" + fi + CLAIMED_L2_BLOCK_NUMBER={{block_number}} echo "Fetching configuration for block #$CLAIMED_L2_BLOCK_NUMBER..." @@ -82,7 +90,6 @@ run-client-native block_number l1_rpc l1_beacon_rpc l2_rpc rollup_node_rpc verbo AGREED_L2_HEAD_HASH=$(cast block --rpc-url $L2_NODE_ADDRESS $((CLAIMED_L2_BLOCK_NUMBER - 1)) --json | jq -r .hash) L1_ORIGIN_NUM=$(cast rpc --rpc-url $OP_NODE_ADDRESS "optimism_outputAtBlock" $(cast 2h $((CLAIMED_L2_BLOCK_NUMBER - 1))) | jq -r .blockRef.l1origin.number) L1_HEAD=$(cast block --rpc-url $L1_NODE_ADDRESS $((L1_ORIGIN_NUM + 30)) --json | jq -r .hash) - L2_CHAIN_ID=$(cast chain-id --rpc-url $L2_NODE_ADDRESS) # Move to the workspace root cd $(git rev-parse --show-toplevel) @@ -94,12 +101,12 @@ run-client-native block_number l1_rpc l1_beacon_rpc l2_rpc rollup_node_rpc verbo --claimed-l2-output-root $CLAIMED_L2_OUTPUT_ROOT \ --agreed-l2-output-root $AGREED_L2_OUTPUT_ROOT \ --claimed-l2-block-number $CLAIMED_L2_BLOCK_NUMBER \ - --l2-chain-id $L2_CHAIN_ID \ --l1-node-address $L1_NODE_ADDRESS \ --l1-beacon-address $L1_BEACON_ADDRESS \ --l2-node-address $L2_NODE_ADDRESS \ --native \ --data-dir ./data \ + $CHAIN_ID_OR_ROLLUP_CONFIG_ARG \ {{verbosity}} # Run the client program natively with the host program attached, in offline mode.