-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add install linux deps action * Add daily workflow * Remove fail-fast from workflow * Remove cargo update * Update comment * Patch sequencer also * Fix patch * Remove match message * Increase range size * Fix patch (remove sequencer) * Have native in another directory * Path sequencer * Fix path * Rename comment * Add continue on error * Prepare for merge
- Loading branch information
1 parent
ab47832
commit e9f52b5
Showing
3 changed files
with
179 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: 'Install Linux Dependencies' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Free HDD space | ||
shell: bash | ||
run: | | ||
echo "Listing 20 largest packages" | ||
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20 | ||
df -h | ||
sudo apt-get update | ||
sudo apt-get remove -y '^llvm-.*' | ||
sudo apt-get remove -y 'php.*' | ||
sudo apt-get remove -y '^dotnet-.*' | ||
sudo apt-get remove -y '^temurin-.*' | ||
sudo apt-get remove -y azure-cli google-cloud-cli microsoft-edge-stable google-chrome-stable firefox powershell mono-devel | ||
sudo apt-get autoremove -y | ||
sudo apt-get clean | ||
df -h | ||
echo "Removing large directories" | ||
# deleting 15GB | ||
sudo rm -rf /usr/share/dotnet/ | ||
sudo rm -rf /usr/local/lib/android | ||
df -h | ||
- name: Add LLVM Debian repository | ||
uses: myci-actions/add-deb-repo@11 | ||
with: | ||
repo: deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main | ||
repo-name: llvm-repo | ||
keys-asc: https://apt.llvm.org/llvm-snapshot.gpg.key | ||
- name: Update and upgrade APT | ||
shell: bash | ||
run: sudo apt-get update && sudo apt-get upgrade -y | ||
- name: Install LLVM | ||
shell: bash | ||
run: sudo apt-get install llvm-19 llvm-19-dev llvm-19-runtime clang-19 clang-tools-19 lld-19 libpolly-19-dev libmlir-19-dev mlir-19-tools |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Daily Block Run | ||
|
||
on: | ||
schedule: | ||
# At the end of every day | ||
- cron: "0 0 * * *" | ||
|
||
env: | ||
RANGE_SIZE: 50 | ||
SEQUENCER_REV: 1b1b95cae7ae07b9bc778443ca75ee18008a6bc8 | ||
|
||
jobs: | ||
run-and-compare: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 1440 | ||
env: | ||
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/ | ||
MLIR_SYS_190_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: | ||
block: | ||
- 740000 | ||
- 741000 | ||
- 742000 | ||
- 743000 | ||
- 744000 | ||
- 745000 | ||
- 746000 | ||
- 747000 | ||
- 748000 | ||
- 749000 | ||
fail-fast: false | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ./starknet-replay | ||
|
||
steps: | ||
# We checkout replay first, as it's the main repository for this workflow | ||
- name: Checkout Replay | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: lambdaclass/starknet-replay | ||
path: starknet-replay | ||
# We need native for building the runtime | ||
- name: Checkout Native | ||
uses: actions/checkout@v4 | ||
with: | ||
path: cairo_native | ||
|
||
# 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 | ||
- 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 dependencies | ||
run: | | ||
# Patches native dependency to local path, to use current cairo native version | ||
DEPENDENCY="cairo-native" | ||
NEW_PATH="../cairo_native" | ||
sed -Ei "s#^($DEPENDENCY *=).*#\1 { path = '$NEW_PATH' }#" Cargo.toml | ||
grep $DEPENDENCY Cargo.toml | ||
# Patches sequencer dependency to specified rev | ||
GIT="https://github.com/lambdaclass/sequencer" | ||
NEW_REV="$SEQUENCER_REV" | ||
sed -Ei "s#(\"$GIT\" *, *rev *= *\").?*(\".*)#\1$NEW_REV\2#" Cargo.toml | ||
grep $GIT Cargo.toml | ||
- name: Run with Native | ||
run: | | ||
BLOCK_START=${{ matrix.block }} | ||
BLOCK_END=$(($BLOCK_START + $RANGE_SIZE - 1)) | ||
cargo run --release --features state_dump block-range $BLOCK_START $BLOCK_END mainnet | ||
continue-on-error: true | ||
- name: Run with VM | ||
run: | | ||
BLOCK_START=${{ matrix.block }} | ||
BLOCK_END=$(($BLOCK_START + $RANGE_SIZE - 1)) | ||
cargo run --release --features state_dump,only_cairo_vm block-range $BLOCK_START $BLOCK_END mainnet | ||
continue-on-error: true | ||
|
||
- name: Compare states | ||
run: ../cairo_native/scripts/cmp_state_dumps.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Compares state dump files between two directories: 'state_dumps/vm' and 'state_dumps/native'. | ||
# It iterates over all JSON files in the 'state_dumps/vm' directory and checks if the corresponding | ||
# file exists in 'state_dumps/native'. | ||
# If the corresponding file does not exist, it skips the comparison and counts the missing files. | ||
# For existing pairs, it compares the contents, ignoring the lines containing the "reverted" field, because of error message diference in Native and VM. | ||
# It counts and displays the number of matching, differing, and missing state dumps. | ||
|
||
matching=0 | ||
diffing=0 | ||
missing=0 | ||
|
||
# Iterate over state_dumps/vm dumps | ||
for vm_dump in state_dumps/vm/*/*.json; do | ||
[ -f "$vm_dump" ] || continue | ||
|
||
native_dump="${vm_dump//vm/native}" | ||
|
||
# Check if the corresponding native_dump file exists, if not, skip | ||
if [ ! -f "$native_dump" ]; then | ||
echo "Missing: $native_dump (file not found)" | ||
missing=$((missing+1)) | ||
continue | ||
fi | ||
|
||
base=$(basename "$vm_dump") | ||
|
||
if ! cmp -s \ | ||
<(sed '/"reverted": /d' "$native_dump") \ | ||
<(sed '/"reverted": /d' "$vm_dump") | ||
then | ||
echo "diff: $base" | ||
diffing=$((diffing+1)) | ||
else | ||
matching=$((matching+1)) | ||
fi | ||
done | ||
|
||
echo | ||
echo "Finished comparison" | ||
echo "- Matching: $matching" | ||
echo "- Diffing: $diffing" | ||
echo "- Missing: $missing" | ||
|
||
if ! [[ $diffing -eq 0 && $missing -eq 0 ]] ; then | ||
exit 1 | ||
fi |