diff --git a/.github/workflows/starknet-blocks.yml b/.github/workflows/starknet-blocks.yml index 0994fa44b..3084d1a54 100644 --- a/.github/workflows/starknet-blocks.yml +++ b/.github/workflows/starknet-blocks.yml @@ -8,7 +8,7 @@ on: types: [checks_requested] jobs: - native-vm-dump: + native-vm-blocks-dump: name: Check Dump Naitve vs VM runs-on: ubuntu-latest env: @@ -17,10 +17,16 @@ jobs: TABLEGEN_190_PREFIX: /usr/lib/llvm-19/ RPC_ENDPOINT_TESTNET: ${{ secrets.RPC_ENDPOINT_TESTNET }} RPC_ENDPOINT_MAINNET: ${{ secrets.RPC_ENDPOINT_MAINNET }} + strategy: + matrix: + strategy: [native, vm] + features: ["state-dump", "state-dump,only_cairo_vm"] + dump-path: ["state_dumps/native", "state_dumps/vm"] steps: - uses: actions/checkout@v4 - - name: check and free hdd space left + - name: Check and free hdd space left + if: ${{ matrix.dump == native }} run: | echo "Listing 20 largest packages" dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 20 @@ -45,19 +51,24 @@ jobs: - uses: Swatinem/rust-cache@v2 - name: add llvm deb repository + if: ${{ matrix.dump == native }} 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: Install LLVM + if: ${{ matrix.dump == native }} 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: Install Cairo Native deps + if: ${{ matrix.dump == native }} run: make deps - name: Build Cairo Native project + if: ${{ matrix.dump == native }} run: make build - name: Build runtime subproject + if: ${{ matrix.dump == native }} run: | make runtime-ci export CAIRO_NATIVE_RUNTIME_LIBRARY=libcairo_native_runtime.a @@ -66,13 +77,44 @@ jobs: uses: actions/checkout@v4 with: repository: lambdaclass/starknet-replay - ref: main + ref: e125989afa77022995b3989c1d64292755312a87 - name: Install Starknet Replay deps run: make deps - - name: Build Starknet Replay project - run: make build - name: Run Blocks run: | - cargo run block-range 807301 807301 mainnet + cargo run --features ${{matrix.features}} block-range 807301 807301 mainnet + + - name: Upload generated Dump + uses: actions/upload-artifact@v4 + with: + name: dump-{{matrix.dump}} + path: ${{matrix.dump-path}} + + compare-dump: + needs: native-vm-blocks-dump + runs-on: ubuntu-latest + + steps: + - name: Checkout Starknet Replay + uses: actions/checkout@v4 + with: + repository: lambdaclass/starknet-replay + ref: e125989afa77022995b3989c1d64292755312a87 + + - name: Fetch Native dumps + uses: actions/upload-artifact@v4 + with: + name: dump-native + path: state_dumps/native + + - name: Fetch VM dumps + uses: actions/upload-artifact@v4 + with: + name: dump-vm + path: state_dumps/vm + + - name: Check Diffs + run: | + if [./scripts/cmp_state_dumps.sh | grep Matching == ] diff --git a/scripts/diff-check.sh b/scripts/diff-check.sh new file mode 100755 index 000000000..829ba83b2 --- /dev/null +++ b/scripts/diff-check.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +diffing=0 + +for vm_dump in state_dumps/vm/*/*.json; do + [ -f "$vm_dump" ] || continue + + native_dump="${vm_dump//vm/native}" + + base=$(basename "$native_dump") + + if ! cmp -s \ + <(sed '/"reverted": /d' "$native_dump") \ + <(sed '/"reverted": /d' "$vm_dump") + then + diffing=1 + break + fi +done + +echo $diffing