Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Jan 14, 2025
1 parent 86eac15 commit ff4fee0
Show file tree
Hide file tree
Showing 2 changed files with 427 additions and 192 deletions.
163 changes: 88 additions & 75 deletions .github/workflows/starknet-blocks.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Starknet Blocks
name: Execute blocks

on:
pull_request:
Expand All @@ -20,117 +20,130 @@ jobs:
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: 6738a2ba8786118d38eb94b209949bcb8285cce0
# We need native to build the runtime
- name: Checkout Native
uses: actions/checkout@v4
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
with:
path: cairo_native
- name: Checkout Sequencer
uses: actions/checkout@v4
components: clippy
- uses: Swatinem/rust-cache@v2
with:
repository: lambdaclass/sequencer
path: sequencer
ref: ee977cc338f63f7bc34c01c21363b3a318bcac65
key: "ref-955512a96ab317c61d0b12ae230f33176b6005e4"

- 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
- name: Check and free hdd space left
if: ${{ matrix.runner == 'native' }}
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 microsoft-edge-stable google-chrome-stable firefox 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 deb repository
uses: myci-actions/add-deb-repo@11
with:
workspaces: "starknet-replay -> target"
cache-directories: "cairo_native"
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: Install LLVM
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

- name: Build Cairo Native Runtime Library
shell: bash
- name: Install Cairo Native deps
if: ${{ matrix.runner == 'native' }}
run: make deps
- name: Build Cairo Native project
if: ${{ matrix.runner == 'native' }}
run: cargo b --release
- name: Build runtime
run: |
cd ../cairo_native
make runtime
cargo update
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
- name: Checkout Starknet Replay
uses: actions/checkout@v4
with:
repository: lambdaclass/starknet-replay
ref: 83f804213a6e4b47c3ae9b2763d3bbccfcf959f9
path: replay

git diff
- name: Install Starknet Replay deps
run: make deps

- name: Patch sequencer dependencies
- name: Patch Cairo Native's version
if: ${{ matrix.runner == 'native' }}
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
cd replay
echo -e '[patch.crates-io]\ncairo-native = { path = ".." }' >> Cargo.toml
git diff
- name: Run with Native
- name: Run Blocks Native
if: ${{ matrix.runner == 'native' }}
run: |
cargo run --features state_dump block mainnet ${{ matrix.block }}
cd replay
cargo build --release --bin replay
cargo run --release --features state_dump block mainnet ${{ matrix.block }}
- name: Run with VM
- name: Run Blocks VM
if: ${{ matrix.runner == 'vm' }}
run: |
cargo run --features "state_dump,only_cairo_vm" block mainnet ${{ matrix.block }}
cd replay
cargo build --release --bin replay
cargo run --release --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}}
path: 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: Check and free hdd space left
if: ${{ matrix.runner == 'native' }}
run: |
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 microsoft-edge-stable google-chrome-stable firefox mono-devel
sudo apt-get autoremove -y
sudo apt-get clean
echo "Removing large directories"
# deleting 15GB
sudo rm -rf /usr/share/dotnet/
sudo rm -rf /usr/local/lib/android
- name: Fetch Native dumps
uses: actions/download-artifact@v4
with:
pattern: dump-*-native
name: dump-${{matrix.block}}-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
name: dump-${{matrix.block}}-vm
path: state_dumps/vm
merge-multiple: true
continue-on-error: true

- name: Compare states
run: |
./scripts/cmp_state_dumps.sh
- name: Check Diffs
run: ./scripts/diff-check.sh
Loading

0 comments on commit ff4fee0

Please sign in to comment.