diff --git a/.github/workflows/client_host.yaml b/.github/workflows/client_host.yaml index 59300d878..c31b07895 100644 --- a/.github/workflows/client_host.yaml +++ b/.github/workflows/client_host.yaml @@ -8,9 +8,10 @@ env: CARGO_TERM_COLOR: always jobs: host-client-offline-runs: - name: ${{ matrix.name }} + name: ${{ matrix.target}} | ${{ matrix.name }} strategy: matrix: + target: ["native", "asterisc"] name: [ "OP Mainnet (Ecotone) - Block #122093770", @@ -27,8 +28,24 @@ jobs: - uses: Swatinem/rust-cache@v2 with: cache-on-failure: true - prefix-key: ${{ matrix.target }} - - name: Set environment + prefix-key: ${{ matrix.target }}-${{ matrix.name }} + - name: Clone `asterisc` repository + if: "!contains(matrix.target, 'native')" + run: | + git clone https://github.com/ethereum-optimism/asterisc.git + - name: Setup Go toolchain + if: "!contains(matrix.target, 'native')" + uses: actions/setup-go@v5 + with: + go-version: "1.21.6" + cache-dependency-path: | + asterisc/go.sum + - name: Build `asterisc` + if: "!contains(matrix.target, 'native')" + run: | + cd asterisc && git checkout v1.0.0 && make build-rvgo + mv ./rvgo/bin/asterisc /usr/local/bin/ + - name: Set run environment run: | if [[ ${{ contains(matrix.name, 122093770) }} == true ]]; then BLOCK_NUMBER=122093770 @@ -50,13 +67,13 @@ jobs: echo "WITNESS_TAR_NAME=fjord-op-sepolia-$BLOCK_NUMBER-witness.tar.zst" >> $GITHUB_ENV fi - name: Decompress witness data directory - working-directory: . run: | tar --zstd -xvf ./bin/client/testdata/$WITNESS_TAR_NAME -C . - name: Run host + client offline working-directory: ./bin/client run: | - just run-client-native-offline \ + mkdir -p ../../target + just run-client-${{ matrix.target }}-offline \ $BLOCK_NUMBER \ $L2_CLAIM \ $L2_OUTPUT_ROOT \ diff --git a/bin/client/justfile b/bin/client/justfile index 5f6166278..4611ccc3c 100644 --- a/bin/client/justfile +++ b/bin/client/justfile @@ -137,3 +137,48 @@ run-client-native-offline block_number l2_claim l2_output_root l2_head l1_head l --exec $CLIENT_BIN_PATH \ --data-dir ./data \ {{verbosity}} + +# Run the client program on asterisc with the host program detached, in offline mode. +run-client-asterisc-offline block_number l2_claim l2_output_root l2_head l1_head l2_chain_id verbosity: + #!/usr/bin/env bash + + HOST_BIN_PATH="./target/release/kona-host" + CLIENT_BIN_PATH="./target/riscv64gc-unknown-none-elf/release-client-lto/kona" + STATE_PATH="./state.json" + + L2_BLOCK_NUMBER={{block_number}} + L2_CLAIM={{l2_claim}} + L2_OUTPUT_ROOT={{l2_output_root}} + L2_HEAD={{l2_head}} + L1_HEAD={{l1_head}} + L2_CHAIN_ID={{l2_chain_id}} + + # Move to the workspace root + cd $(git rev-parse --show-toplevel) + + echo "Building client program for RISC-V target..." + just build-asterisc --bin kona --profile release-client-lto + + echo "Loading client program into Asterisc state format..." + asterisc load-elf --path=$CLIENT_BIN_PATH + + echo "Building host program for native target..." + cargo build --bin kona-host --release + + echo "Running asterisc" + asterisc run \ + --info-at '%10000000' \ + --proof-at never \ + --input $STATE_PATH \ + -- \ + $HOST_BIN_PATH \ + --l1-head $L1_HEAD \ + --l2-head $L2_HEAD \ + --l2-claim $L2_CLAIM \ + --l2-output-root $L2_OUTPUT_ROOT \ + --l2-block-number $L2_BLOCK_NUMBER \ + --l2-chain-id $L2_CHAIN_ID \ + --server \ + --data-dir ./data \ + --exec "" \ + {{verbosity}}