Skip to content

Commit

Permalink
run asterisc too
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Jul 1, 2024
1 parent 7c1486f commit 3d5b68f
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 5 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/client_host.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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
Expand All @@ -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 \
Expand Down
45 changes: 45 additions & 0 deletions bin/client/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}}

0 comments on commit 3d5b68f

Please sign in to comment.