Skip to content

Update starknet-blocks workflow #739

Update starknet-blocks workflow

Update starknet-blocks workflow #739

name: Starknet Blocks
on:
pull_request:
branches: [main]
merge_group:
types: [checks_requested]
jobs:
run-blocks:
name: Run Blocks
runs-on: ubuntu-latest
env:
MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
TABLEGEN_190_PREFIX: /usr/lib/llvm-19/
RPC_ENDPOINT_TESTNET: ${{ secrets.RPC_ENDPOINT_TESTNET }}
RPC_ENDPOINT_MAINNET: ${{ secrets.RPC_ENDPOINT_MAINNET }}
strategy:
matrix:
runner: [native, vm]
block: [742001, 769597, 779328, 801008, 803072]
fail-fast: false
defaults:
run:
shell: bash
working-directory: ./starknet-replay
steps:
# We checkout replay as it's the main repository for this workflow
- name: Checkout Replay
uses: actions/checkout@v4
with:
repository: lambdaclass/starknet-replay
path: starknet-replay
ref: 7c5013384c0ca79be962dda5210de35ade539ef8
# We need native to build the runtime
- name: Checkout Native
uses: actions/checkout@v4
with:
path: cairo_native
- name: Checkout Sequencer
uses: actions/checkout@v4
with:
repository: lambdaclass/sequencer
path: sequencer
ref: replay
- name: Cache RPC Calls
uses: actions/cache@v4
with:
path: starknet-replay/rpc_cache
key: cache-${{matrix.block}}-${{matrix.runner}}
# Install dependencies
- uses: ./cairo_native/.github/actions/install-linux-deps
- name: Setup rust env
uses: dtolnay/[email protected]
- name: Retreive cached dependecies
uses: Swatinem/rust-cache@v2
with:
workspaces: "starknet-replay -> target"
cache-directories: "cairo_native"
- name: Build Cairo Native Runtime Library
shell: bash
run: |
cd ../cairo_native
make runtime
echo "CAIRO_NATIVE_RUNTIME_LIBRARY=$(pwd)/libcairo_native_runtime.a" > $GITHUB_ENV
- name: Patch replay dependencies
run: |
# Updates sequencer dependency to local path
name='[[:alnum:]_-]+'
sequencer_url='"https:\/\/github.com\/lambdaclass\/sequencer\.git"'
rev='"[[:alnum:]]+"'
new_path='"..\/sequencer\/crates\/\1"'
sed -i'' -r "s/^($name) = \{ git = $sequencer_url, rev = $rev/\1 = { path = $new_path/" Cargo.toml
# Updates native dependency to local path
new_path='"..\/cairo_native"'
sed -i'' -r "s/^cairo-native = .*/cairo-native.path = $new_path/" Cargo.toml
git diff
- name: Patch sequencer dependencies
run: |
cd ../sequencer
# Updates native dependency to local path
new_path='"..\/cairo_native"'
sed -i'' -r "s/^cairo-native = .*/cairo-native.path = $new_path/" Cargo.toml
# Update native submodule
git rm crates/blockifier/cairo_native
ln -s ../../../cairo_native/ crates/blockifier/cairo_native
git diff
- name: Run with Native
if: ${{ matrix.runner == 'native' }}
run: |
cargo run --features state_dump block mainnet ${{ matrix.block }}
- name: Run with VM
if: ${{ matrix.runner == 'vm' }}
run: |
cargo run --features "state_dump,only_cairo_vm" block mainnet ${{ matrix.block }}
- name: Upload dumps
uses: actions/upload-artifact@v4
with:
name: dump-${{matrix.block}}-${{matrix.runner}}
path: starknet-replay/state_dumps/${{matrix.runner}}
compare-dumps:
name: Compare Dumps
needs: [run-blocks]
runs-on: ubuntu-latest
strategy:
matrix:
block: [742001, 769597, 779328, 801008, 803072]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Fetch Native dumps
uses: actions/download-artifact@v4
with:
pattern: dump-*-native
path: state_dumps/native
merge-multiple: true
continue-on-error: true
- name: Fetch VM dumps
uses: actions/download-artifact@v4
with:
pattern: dump-*-vm
path: state_dumps/vm
merge-multiple: true
continue-on-error: true
- name: Compare states
run: |
./scripts/cmp_state_dumps.sh