diff --git a/.github/workflows/client_host.yaml b/.github/workflows/client_host.yaml index 59300d878..a87dd516e 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", @@ -28,7 +29,18 @@ jobs: with: cache-on-failure: true prefix-key: ${{ matrix.target }} - - name: Set environment + - name: Setup Go toolchain + if: "!contains(matrix.target, 'native')" + uses: actions/setup-go@v5 + with: + go-version: "1.21.6" + - name: Build & Install `asterisc` + if: "!contains(matrix.target, 'native')" + run: | + git clone https://github.com/ethereum-optimism/asterisc.git + cd asterisc && make build-rvgo + mv asterisc/bin/aserisc /usr/local/bin/ + - name: Set run environment run: | if [[ ${{ contains(matrix.name, 122093770) }} == true ]]; then BLOCK_NUMBER=122093770 @@ -56,7 +68,7 @@ jobs: - name: Run host + client offline working-directory: ./bin/client run: | - just run-client-native-offline \ + 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}}