Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix daily block run #891

Merged
merged 34 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ad611e0
Run on pull_request (tmp)
JulianGCalderon Oct 30, 2024
717a38a
Use paralelism
JulianGCalderon Oct 30, 2024
42157f9
Fix paths
JulianGCalderon Oct 30, 2024
01a8f4f
Remove old compare step
JulianGCalderon Oct 30, 2024
0a4db46
Fix paths
JulianGCalderon Oct 30, 2024
810efc2
Save output to env var
JulianGCalderon Oct 30, 2024
592268d
Add comments
JulianGCalderon Oct 30, 2024
dc24086
Create issue
JulianGCalderon Oct 30, 2024
5a63d75
Add workflow url
JulianGCalderon Oct 30, 2024
5c710f8
Mock for testing
JulianGCalderon Oct 30, 2024
8a05555
Print env vars
JulianGCalderon Oct 30, 2024
d2dbc04
Save output
JulianGCalderon Oct 30, 2024
3cbd75f
Mock issue
JulianGCalderon Oct 30, 2024
e8a95a6
Update template
JulianGCalderon Oct 30, 2024
454548e
Tee compare output
JulianGCalderon Oct 30, 2024
a834b15
Remove mock
JulianGCalderon Oct 30, 2024
7b33a54
Make run for testing
JulianGCalderon Oct 30, 2024
0e8f680
Improve template
JulianGCalderon Oct 30, 2024
45ce237
Increase range
JulianGCalderon Oct 30, 2024
544d0d7
Update script message
JulianGCalderon Oct 30, 2024
009d494
Update issue message
JulianGCalderon Oct 30, 2024
873de7e
Add always
JulianGCalderon Oct 31, 2024
547e5db
Change message
JulianGCalderon Oct 31, 2024
9acf996
Prevent upload error
JulianGCalderon Oct 31, 2024
7438dd6
Add comment
JulianGCalderon Oct 31, 2024
9439aa8
Add comment
JulianGCalderon Oct 31, 2024
ace356f
Add comments and continue-on-error
JulianGCalderon Oct 31, 2024
e8e6443
Rename dump
JulianGCalderon Oct 31, 2024
db92177
Comment blocks
JulianGCalderon Oct 31, 2024
4639de5
Increase size
JulianGCalderon Oct 31, 2024
0333df2
Don't run on PR
JulianGCalderon Oct 31, 2024
f1b61e9
Improve comme
JulianGCalderon Oct 31, 2024
2fcda0e
Merge branch 'main' into fix-daily
pefontana Nov 4, 2024
db2a04e
Remove todo!
JulianGCalderon Nov 4, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/daily_failure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "Daily Workflow Failure: Block Range {{ env.BLOCK_START }}-{{ env.BLOCK_END }}"
labels: bug
---

Comparing VM execution against Native in the given block range produced diffs:

- Commit: {{ env.COMMIT_SHA }}
- Block Start: {{ env.BLOCK_START }}
- Block End: {{ env.BLOCK_END }}
- Workflow URL: {{ env.WORKFLOW_URL }}

## Compare Output

The transaction were not compared in order. You should rerun the whole block to find the error root

```
{{ env.OUTPUT }}
```
90 changes: 85 additions & 5 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ on:
- cron: "0 0 * * *"

env:
RANGE_SIZE: 50
RANGE_SIZE: 25
SEQUENCER_REV: 1b1b95cae7ae07b9bc778443ca75ee18008a6bc8

jobs:
run-and-compare:
run:
runs-on: ubuntu-latest
timeout-minutes: 1440
env:
LLVM_SYS_191_PREFIX: /usr/lib/llvm-19/
MLIR_SYS_190_PREFIX: /usr/lib/llvm-19/
Expand All @@ -32,6 +31,9 @@ jobs:
- 747000
- 748000
- 749000
runner:
- native
- vm
fail-fast: false
defaults:
run:
Expand Down Expand Up @@ -79,17 +81,95 @@ jobs:
grep $GIT Cargo.toml

- name: Run with Native
if: ${{ matrix.runner == '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
if: ${{ matrix.runner == '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

# We always upload the dump, even if the job fails
- name: Upload dumps
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: dump-${{matrix.block}}-${{matrix.runner}}
path: starknet-replay/state_dumps/${{matrix.runner}}


compare:
needs: [run]
runs-on: ubuntu-latest
# We always run the compare job, to ensure that a single run job failing
# would not cancel the whole comparison.
if: ${{ always() }}
strategy:
matrix:
block:
- 740000
- 741000
- 742000
- 743000
- 744000
- 745000
- 746000
- 747000
- 748000
- 749000
fail-fast: false
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4

- name: Fetch Native dumps
uses: actions/download-artifact@v4
with:
name: dump-${{matrix.block}}-native
path: state_dumps/native
continue-on-error: true
- name: Fetch VM dumps
uses: actions/download-artifact@v4
with:
name: dump-${{matrix.block}}-vm
path: state_dumps/vm
continue-on-error: true

- name: Compare states
run: ../cairo_native/scripts/cmp_state_dumps.sh
run: |
./scripts/cmp_state_dumps.sh | tee output

- name: Prepare env vars
if: ${{ always() }}
run: |
# Save blocks to env var
BLOCK_START=${{ matrix.block }}
BLOCK_END=$(($BLOCK_START + $RANGE_SIZE - 1))
echo "BLOCK_END=$BLOCK_END" | tee -a $GITHUB_ENV
echo "BLOCK_START=$BLOCK_START" | tee -a $GITHUB_ENV

# Save workflow url
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
echo "WORKFLOW_URL=$REPO_URL/actions/runs/${{ github.run_id }}" | tee -a $GITHUB_ENV

# Save output
{
echo 'OUTPUT<<EOF'
cat output
echo EOF
} >> "$GITHUB_ENV"

- name: Create Issue
if: ${{ failure() }}
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_SHA: ${{ github.sha }}
with:
filename: .github/ISSUE_TEMPLATE/daily_failure.md
7 changes: 5 additions & 2 deletions scripts/cmp_state_dumps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ for vm_dump in state_dumps/vm/*/*.json; do
continue
fi

base=$(basename "$vm_dump")
tx_name=$(basename "$vm_dump")
tx=${tx_name//.*/}
block_name=$(basename "$(dirname "$vm_dump")")
block=${block_name//block/}

if ! cmp -s \
<(sed '/"reverted": /d' "$native_dump") \
<(sed '/"reverted": /d' "$vm_dump")
then
echo "diff: $base"
echo "Diff at block $block, tx $tx"
diffing=$((diffing+1))
else
matching=$((matching+1))
Expand Down
Loading