From 5ba9b6fc3caa09af48b66df6ab0ad2c7484d4a47 Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Mon, 10 Mar 2025 11:48:46 +0100 Subject: [PATCH 1/8] Update CI --- .github/workflows/bench.yml | 6 +- .github/workflows/cairo_1_programs.yml | 4 +- .github/workflows/fresh_run.yml | 8 +- .github/workflows/fuzzer.yml | 18 ++-- .github/workflows/hint_accountant.yml | 6 +- .../workflows/hyper_threading_benchmarks.yml | 8 +- .github/workflows/hyperfine.yml | 30 +++--- .github/workflows/iai_main.yml | 4 +- .github/workflows/iai_pr.yml | 8 +- .github/workflows/publish.yml | 4 +- .github/workflows/rust.yml | 100 +++++++++--------- .github/workflows/test_install.yml | 12 +-- 12 files changed, 104 insertions(+), 104 deletions(-) diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml index 3536d4075b..ac6bb2160d 100644 --- a/.github/workflows/bench.yml +++ b/.github/workflows/bench.yml @@ -1,4 +1,4 @@ -name: benchmark +name: benchmark on: push: @@ -12,13 +12,13 @@ permissions: jobs: build: - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - name: Install Rust uses: dtolnay/rust-toolchain@1.85.0 with: components: rustfmt, clippy - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Python3 Build uses: actions/setup-python@v4 with: diff --git a/.github/workflows/cairo_1_programs.yml b/.github/workflows/cairo_1_programs.yml index c28b3dc66b..4769a3694e 100644 --- a/.github/workflows/cairo_1_programs.yml +++ b/.github/workflows/cairo_1_programs.yml @@ -9,14 +9,14 @@ on: jobs: run: name: Execute programs - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@1.85.0 - name: Set up Cargo cache uses: Swatinem/rust-cache@v2 - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: install corelib run: cd cairo1-run/ && make deps - name: Run tests diff --git a/.github/workflows/fresh_run.yml b/.github/workflows/fresh_run.yml index 6edde23d5d..6950dc3a89 100644 --- a/.github/workflows/fresh_run.yml +++ b/.github/workflows/fresh_run.yml @@ -14,11 +14,11 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-22.04 + - os: ubuntu-24.04 deps_suffix: '' os_name: ubuntu-22.04 - os: macos-latest - deps_suffix: '-macos' + deps_suffix: '-macos' os_name: macos runs-on: ${{ matrix.os_name }} name: "Make deps, build & test on fresh ${{ matrix.os_name }} system" @@ -35,7 +35,7 @@ jobs: sudo rm -rf "$AGENT_TOOLSDIRECTORY" - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@1.85.0 @@ -68,7 +68,7 @@ jobs: FAILED_TARGET=deps${{ matrix.deps_suffix }} elif [ ${{ steps.build.outcome }} = failure ]; then FAILED_TARGET=build - else + else FAILED_TARGET=test fi echo "FAILED_TARGET=$FAILED_TARGET" >> $GITHUB_ENV diff --git a/.github/workflows/fuzzer.yml b/.github/workflows/fuzzer.yml index aabe4a54cf..edbecbea8d 100644 --- a/.github/workflows/fuzzer.yml +++ b/.github/workflows/fuzzer.yml @@ -9,7 +9,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} @@ -22,7 +22,7 @@ jobs: path: fuzzer/hfuzz_workspace/fuzz_json/input key: ${{ runner.os }}-inputs - + - name: Install dependencies run: | sudo apt-get update @@ -38,12 +38,12 @@ jobs: run: cargo install honggfuzz # If has cached inputs starts with them or else starts from 0 - - name: Initializing fuzzer with previous inputs + - name: Initializing fuzzer with previous inputs run: | cd fuzzer HFUZZ_RUN_ARGS="--dict=json.dict --run_time 10800 --timeout 60" cargo hfuzz run fuzz_json - # run the fuzzer with minimize to reduce inputs + # run the fuzzer with minimize to reduce inputs - name: Initializing fuzzer with minimize run: | cd fuzzer @@ -55,20 +55,20 @@ jobs: file_pattern: '*/hfuzz_workspace/fuzzer/fuzz_json/HONGGFUZZ* */hfuzz_workspace/fuzzer/fuzz_json/*.fuzz' # Checkout current and last commit for the diff - - name: Checkout commits - uses: actions/checkout@v3 + - name: Checkout commits + uses: actions/checkout@v4 with: fetch-depth: 2 # Check if any new crashes were added - name: Check diff id: check_file_changed - run: echo "report=$(git diff --name-only HEAD^ HEAD -- fuzzer/hfuzz_workspace/fuzz_json/*.fuzz)" >> $GITHUB_OUTPUT + run: echo "report=$(git diff --name-only HEAD^ HEAD -- fuzzer/hfuzz_workspace/fuzz_json/*.fuzz)" >> $GITHUB_OUTPUT # If a new crash was found, create an issue - - name: Create issue + - name: Create issue uses: JasonEtco/create-an-issue@v2 - if: ${{ steps.check_file_changed.outputs.report != '' }} + if: ${{ steps.check_file_changed.outputs.report != '' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CRASH_REPORT: ${{ steps.check_file_changed.outputs.report }} diff --git a/.github/workflows/hint_accountant.yml b/.github/workflows/hint_accountant.yml index 6b6baae674..998413f959 100644 --- a/.github/workflows/hint_accountant.yml +++ b/.github/workflows/hint_accountant.yml @@ -9,14 +9,14 @@ env: jobs: run: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@1.85.0 - name: Set up Cargo cache uses: Swatinem/rust-cache@v2 - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check Build run: cargo build -p hint_accountant - name: Clone cairo-lang repo @@ -24,7 +24,7 @@ jobs: - name: Run the hint accounting script run: cargo r -p hint_accountant | tee comment.md - name: Update comment in tracking issue - uses: peter-evans/create-or-update-comment@v3 + uses: peter-evans/create-or-update-comment@v4 with: issue-number: 1031 comment-id: 1518234161 diff --git a/.github/workflows/hyper_threading_benchmarks.yml b/.github/workflows/hyper_threading_benchmarks.yml index b073e84728..1ee5b3051c 100644 --- a/.github/workflows/hyper_threading_benchmarks.yml +++ b/.github/workflows/hyper_threading_benchmarks.yml @@ -10,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout PR - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} @@ -35,7 +35,7 @@ jobs: cargo build --release -p hyper_threading cp target/release/hyper_threading ${{ github.workspace }}/hyper_threading_pr cp ./examples/hyper_threading/hyper-threading-workflow.sh ${{ github.workspace }}/hyper-threading-workflow.sh - + - name: Upload PR Binary uses: actions/upload-artifact@v4 with: @@ -50,7 +50,7 @@ jobs: - name: Checkout Main Branch - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: ref: 'main' @@ -71,7 +71,7 @@ jobs: name: hyper_threading_workflow_script path: ${{ github.workspace }}/ - - name: Compile programs + - name: Compile programs run: make cairo_bench_programs - name: Run Benchmarks diff --git a/.github/workflows/hyperfine.yml b/.github/workflows/hyperfine.yml index ab0ff767e1..19ff4c5fa8 100644 --- a/.github/workflows/hyperfine.yml +++ b/.github/workflows/hyperfine.yml @@ -17,18 +17,18 @@ jobs: matrix: branch: [ base, head ] name: Build Cairo programs for ${{ matrix.branch }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 outputs: benchmark-hashes-base: ${{ steps.export-hashes.outputs.benchmark-hashes-base }} benchmark-hashes-head: ${{ steps.export-hashes.outputs.benchmark-hashes-head }} steps: - name: Checkout base commit - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request[matrix.branch].sha }} - name: Fetch from cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache with: path: ${{ matrix.branch }}_programs/*.json @@ -63,10 +63,10 @@ jobs: matrix: branch: [ base, head ] name: Build cairo-vm-cli for ${{ matrix.branch }} - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Populate cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache with: path: bin/cairo-vm-cli-${{ matrix.branch }} @@ -78,7 +78,7 @@ jobs: - name: Checkout if: ${{ steps.cache.outputs.cache-hit != 'true' }} - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request[matrix.branch].sha }} @@ -100,33 +100,33 @@ jobs: program_state: [ modified, unmodified ] name: Run benchmarks for ${{ matrix.program_state }} programs needs: [ build-programs, build-binaries ] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Install Hyperfine uses: taiki-e/install-action@v2 with: - tool: hyperfine@1.16 + tool: hyperfine@1.19 - name: Fetch base binary - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: bin/cairo-vm-cli-base key: binary-${{ github.event.pull_request.base.sha }} - name: Fetch HEAD binary - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: bin/cairo-vm-cli-head key: binary-${{ github.event.pull_request.head.sha }} - name: Fetch base programs - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: base_programs/*.json key: benchmarks-base-${{ needs.build-programs.outputs.benchmark-hashes-base }} - name: Fetch head programs - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: head_programs/*.json key: benchmarks-head-${{ needs.build-programs.outputs.benchmark-hashes-head }} @@ -175,7 +175,7 @@ jobs: - name: Find comment if: ${{ steps.run-benchmarks.outputs.benchmark_count != 0 }} - uses: peter-evans/find-comment@v2 + uses: peter-evans/find-comment@v3 id: fc with: issue-number: ${{ github.event.pull_request.number }} @@ -184,14 +184,14 @@ jobs: - name: Create comment if: steps.fc.outputs.comment-id == '' && steps.run-benchmarks.outputs.benchmark_count != 0 - uses: peter-evans/create-or-update-comment@v3 + uses: peter-evans/create-or-update-comment@v4 with: issue-number: ${{ github.event.pull_request.number }} body-path: comment_body.md - name: Update comment if: steps.fc.outputs.comment-id != '' && steps.run-benchmarks.outputs.benchmark_count != 0 - uses: peter-evans/create-or-update-comment@v3 + uses: peter-evans/create-or-update-comment@v4 with: comment-id: ${{ steps.fc.outputs.comment-id }} body-path: comment_body.md diff --git a/.github/workflows/iai_main.yml b/.github/workflows/iai_main.yml index 96a073d48e..55d08f02a7 100644 --- a/.github/workflows/iai_main.yml +++ b/.github/workflows/iai_main.yml @@ -6,10 +6,10 @@ on: jobs: cache-iai-results: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@1.85.0 - name: Set up cargo cache diff --git a/.github/workflows/iai_pr.yml b/.github/workflows/iai_pr.yml index 074c9f887d..ac079af480 100644 --- a/.github/workflows/iai_pr.yml +++ b/.github/workflows/iai_pr.yml @@ -6,10 +6,10 @@ on: jobs: fetch-iai-results: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.base.sha }} - name: Initialize IAI cache for ${{ github.event.pull_request.base.sha }} @@ -46,10 +46,10 @@ jobs: run-iai-benchmark: needs: fetch-iai-results - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Rust uses: dtolnay/rust-toolchain@1.85.0 - name: Set up cargo cache diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9fd4ff2f69..64dc8a99c7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,7 +2,7 @@ name: publish on: push: - tags: + tags: - '*' jobs: @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install stable toolchain uses: dtolnay/rust-toolchain@1.85.0 - name: Publish crate cairo-vm diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3d48ce4770..08bec23afb 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -25,9 +25,9 @@ jobs: # We need to use the same files across all jobs or else hashing will fail upload_proof_programs_symlinks: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Create proof_programs symlinks @@ -36,7 +36,7 @@ jobs: with: name: proof_programs path: cairo_programs/proof_programs/*.cairo - + build-programs: needs: upload_proof_programs_symlinks strategy: @@ -50,10 +50,10 @@ jobs: cairo_2_test_contracts, ] name: Build Cairo programs - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -63,7 +63,7 @@ jobs: path: cairo_programs/proof_programs/ - name: Fetch from cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: cache-programs with: path: ${{ env.CAIRO_PROGRAMS_PATH }} @@ -107,12 +107,12 @@ jobs: # TODO: remove this cache once the workflow finishes merge-caches: name: Merge Cairo programs cache - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 needs: build-programs steps: - name: Checkout - uses: actions/checkout@v3 - + uses: actions/checkout@v4 + - uses: actions/download-artifact@master with: name: proof_programs @@ -164,7 +164,7 @@ jobs: lint: needs: build-programs name: Run Lints - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Install Rust uses: dtolnay/rust-toolchain@1.85.0 @@ -173,7 +173,7 @@ jobs: - name: Set up cargo cache uses: Swatinem/rust-cache@v2 - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/download-artifact@master with: @@ -204,7 +204,7 @@ jobs: fail-fast: false matrix: crate: ["vm", "cairo-vm-cli", "cairo1-run"] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Install Rust uses: dtolnay/rust-toolchain@1.85.0 @@ -222,7 +222,7 @@ jobs: tool: cargo-all-features - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/download-artifact@master with: @@ -250,7 +250,7 @@ jobs: fail-fast: false matrix: chunk: [1, 2, 3, 4, 5, 6] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Install Rust uses: dtolnay/rust-toolchain@1.85.0 @@ -268,7 +268,7 @@ jobs: tool: cargo-all-features - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download proof programs symlinks uses: actions/download-artifact@master @@ -290,7 +290,7 @@ jobs: smoke-no-std: needs: merge-caches name: Make sure all builds work (no_std) - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Install Rust uses: dtolnay/rust-toolchain@1.85.0 @@ -303,7 +303,7 @@ jobs: cache-on-failure: true - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download proof programs symlinks uses: actions/download-artifact@master @@ -332,7 +332,7 @@ jobs: special_features: ["", "extensive_hints", "mod_builtin", "cairo-0-secp-hints", "cairo-0-data-availability-hints"] target: [ test#1, test#2, test#3, test#4, test-no_std#1, test-no_std#2, test-no_std#3, test-no_std#4, test-wasm ] name: Run tests - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Install Rust uses: dtolnay/rust-toolchain@1.85.0 @@ -341,7 +341,7 @@ jobs: - name: Set up cargo cache uses: Swatinem/rust-cache@v2 - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/download-artifact@master with: @@ -398,14 +398,14 @@ jobs: build-release: name: Build release binary for comparisons - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Install Rust uses: dtolnay/rust-toolchain@1.85.0 - name: Set up cargo cache uses: Swatinem/rust-cache@v2 - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build run: cargo b --release -p cairo-vm-cli # We don't read from cache because it should always miss @@ -427,10 +427,10 @@ jobs: nprocs: 2 name: Compute memory and execution traces with cairo-lang needs: build-programs - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -440,7 +440,7 @@ jobs: path: cairo_programs/proof_programs/ - name: Check cache - uses: actions/cache@v3 + uses: actions/cache@v4 id: trace-cache with: path: | @@ -500,10 +500,10 @@ jobs: extra-args: '--proof_mode --air_public_input {program}.rs.air_public_input --air_private_input {program}.rs.air_private_input ' name: Compute memory and execution traces with cairo-vm needs: [ build-programs, build-release ] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Fetch release binary uses: actions/cache/restore@v3 @@ -546,10 +546,10 @@ jobs: upload-coverage: name: Upload coverage results to codecov.io needs: tests - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Fetch results for tests with stdlib (part. 1) uses: actions/cache/restore@v3 @@ -657,10 +657,10 @@ jobs: program-target: [ cairo_proof_programs, cairo_test_programs ] name: Compare memory and execution traces from cairo-lang and cairo-vm needs: [ run-cairo-reference, run-cairo-release ] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - uses: actions/download-artifact@master with: @@ -694,7 +694,7 @@ jobs: - name: Run comparison script run: | if [ ${{ matrix.program-target }} = cairo_proof_programs ]; then - PROOF=proof_mode + PROOF=proof_mode AIR_PUBLIC_INPUT=air_public_input AIR_PRIVATE_INPUT=air_private_input else @@ -704,10 +704,10 @@ jobs: wasm-demo: name: Build the wasm demo - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -716,9 +716,9 @@ jobs: with: python-version: '3.9' cache: 'pip' - + - name: Install cairo-lang and deps - run: | + run: | pip install -r requirements.txt npm install -g wasm-pack @@ -727,24 +727,24 @@ jobs: cairo-compile cairo_programs/array_sum.cairo --no_debug_info --output cairo_programs/array_sum.json cd examples/wasm-demo wasm-pack build --target=web - + compare-factorial-outputs-all-layouts: name: Compare factorial outputs for all layouts needs: [ build-programs, build-release ] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Python3 Build uses: actions/setup-python@v4 with: python-version: '3.9' cache: 'pip' - + - name: Install cairo-lang and deps run: pip install -r requirements.txt - + - name: Fetch release binary uses: actions/cache/restore@v3 with: @@ -756,24 +756,24 @@ jobs: with: name: proof_programs path: cairo_programs/proof_programs/ - + - name: Fetch programs uses: actions/cache/restore@v3 with: path: ${{ env.CAIRO_PROGRAMS_PATH }} key: cairo_proof_programs-cache-${{ hashFiles('cairo_programs/**/*.cairo', 'examples/wasm-demo/src/array_sum.cairo') }} fail-on-cache-miss: true - + - name: Run script run: ./vm/src/tests/compare_factorial_outputs_all_layouts.sh compare-outputs-dynamic-layouts: name: Compare outputs with dynamic layouts needs: [ build-programs, build-release, run-cairo-release ] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Python3 Build uses: actions/setup-python@v4 @@ -821,27 +821,27 @@ jobs: compare-run-from-cairo-pie-all-outputs: name: Compare all outputs from running Cairo PIEs needs: [ build-programs, build-release, run-cairo-release ] - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Python3 Build uses: actions/setup-python@v4 with: python-version: '3.9' cache: 'pip' - + - name: Install cairo-lang and deps run: pip install -r requirements.txt - + - name: Fetch release binary uses: actions/cache/restore@v3 with: key: cli-bin-rel-${{ github.sha }} path: target/release/cairo-vm-cli fail-on-cache-miss: true - + - name: Fetch traces for cairo-vm uses: actions/cache/restore@v3 with: @@ -853,6 +853,6 @@ jobs: cairo_programs/**/*.pie.zip key: cairo_test_programs-release-trace-cache-${{ github.sha }} fail-on-cache-miss: true - + - name: Run comparison run: ./vm/src/tests/compare_all_pie_outputs.sh diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 7f56294398..5494d389c4 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -12,10 +12,10 @@ jobs: name: "Install on ${{ matrix.os }}" strategy: matrix: - os: [ubuntu-22.04, macos-13] + os: [ubuntu-24.04, macos-13] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Cargo cache uses: Swatinem/rust-cache@v2 @@ -39,7 +39,7 @@ jobs: install_debian: name: "Install on debian-11" - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 container: image: debian:11 defaults: @@ -47,11 +47,11 @@ jobs: shell: bash {0} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # we don't use swatinem because rustc isn't installed yet - name: Cache Rust dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/ @@ -70,7 +70,7 @@ jobs: # NOTE: we don't use install-python because lsb_release isn't installed - name: Cache Python dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cache/pip/wheels From 36e3fa22839cbcb6d19951c43a1efce29ec7ed7b Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Mon, 10 Mar 2025 11:49:25 +0100 Subject: [PATCH 2/8] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fd4f2300e..8144890339 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ * chore: update Rust required version to 1.85.0 [#1990](https://github.com/lambdaclass/cairo-vm/pull/1990) +- ci: Update CI [#1991](https://github.com/lambdaclass/cairo-vm/pull/1991) + #### [2.0.0] - 2025-02-26 * fix: Check overflow in cairo pie address calculation [#1945](https://github.com/lambdaclass/cairo-vm/pull/1945) From ea3091e0f520253bc47e01dc0a43658c120488aa Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Mon, 10 Mar 2025 11:55:37 +0100 Subject: [PATCH 3/8] fix --- .github/workflows/fresh_run.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fresh_run.yml b/.github/workflows/fresh_run.yml index 6950dc3a89..1569c0ca55 100644 --- a/.github/workflows/fresh_run.yml +++ b/.github/workflows/fresh_run.yml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: include: - - os: ubuntu-24.04 + - os: ubuntu-22.04 deps_suffix: '' os_name: ubuntu-22.04 - os: macos-latest From 704af8a0433588d007e39084d32503a28017ae6e Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Mon, 10 Mar 2025 11:52:56 +0100 Subject: [PATCH 4/8] Update iai-callgrind from 0.3.1 to 0.14.0 --- .github/workflows/iai_main.yml | 2 +- .github/workflows/iai_pr.yml | 4 +- Cargo.lock | 93 +++++++++++++++++++++++++++++++--- Makefile | 2 +- vm/Cargo.toml | 2 +- 5 files changed, 92 insertions(+), 11 deletions(-) diff --git a/.github/workflows/iai_main.yml b/.github/workflows/iai_main.yml index 55d08f02a7..9f58decd98 100644 --- a/.github/workflows/iai_main.yml +++ b/.github/workflows/iai_main.yml @@ -23,7 +23,7 @@ jobs: pip install -r requirements.txt sudo apt update sudo apt install -y valgrind - cargo install --version 0.3.1 iai-callgrind-runner + cargo install --version 0.14.0 iai-callgrind-runner - name: Run iai benchmarks run: make iai-benchmark-action diff --git a/.github/workflows/iai_pr.yml b/.github/workflows/iai_pr.yml index ac079af480..c991e98ee5 100644 --- a/.github/workflows/iai_pr.yml +++ b/.github/workflows/iai_pr.yml @@ -38,7 +38,7 @@ jobs: pip install -r requirements.txt sudo apt update sudo apt install -y valgrind - cargo install --version 0.3.1 iai-callgrind-runner + cargo install --version 0.14.0 iai-callgrind-runner - name: Run iai benchmarks if: ${{ steps.cache-iai-results.outputs.cache-hit != 'true' }} @@ -63,7 +63,7 @@ jobs: pip install -r requirements.txt sudo apt update sudo apt install -y valgrind - cargo install --version 0.3.1 iai-callgrind-runner + cargo install --version 0.14.0 iai-callgrind-runner - name: Restore cache for ${{ github.event.pull_request.base.sha }} uses: actions/cache/restore@v3 diff --git a/Cargo.lock b/Cargo.lock index bed400cf5d..7a7c402851 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -318,6 +318,15 @@ version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bincode" version = "2.0.0-rc.3" @@ -921,7 +930,7 @@ dependencies = [ "ark-ff", "ark-std", "assert_matches", - "bincode", + "bincode 2.0.0-rc.3", "bitvec", "cairo-lang-casm", "cairo-lang-starknet", @@ -963,7 +972,7 @@ name = "cairo-vm-cli" version = "2.0.0" dependencies = [ "assert_matches", - "bincode", + "bincode 2.0.0-rc.3", "cairo-vm", "cairo-vm-tracer", "clap", @@ -997,7 +1006,7 @@ name = "cairo1-run" version = "2.0.0" dependencies = [ "assert_matches", - "bincode", + "bincode 2.0.0-rc.3", "cairo-lang-casm", "cairo-lang-compiler", "cairo-lang-sierra", @@ -1297,6 +1306,26 @@ dependencies = [ "syn 2.0.98", ] +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.98", +] + [[package]] name = "diff" version = "0.1.13" @@ -1766,9 +1795,39 @@ dependencies = [ [[package]] name = "iai-callgrind" -version = "0.3.1" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22275f8051874cd2f05b2aa1e0098d5cbec34df30ff92f1a1e2686a4cefed870" +dependencies = [ + "bincode 1.3.3", + "derive_more", + "iai-callgrind-macros", + "iai-callgrind-runner", +] + +[[package]] +name = "iai-callgrind-macros" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76579762a383d5da364779d780704f93898c620703c27087b766700a87e5a8c2" +checksum = "e8e6677dc52bd798b988e62ffd6831bf7eb46e4348cb1c74c1164954ebd0e5a1" +dependencies = [ + "derive_more", + "proc-macro-error2", + "proc-macro2", + "quote", + "serde", + "serde_json", + "syn 2.0.98", +] + +[[package]] +name = "iai-callgrind-runner" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a02dd95fe4949513b45a328b5b18f527ee02e96f3428b48090aa7cf9043ab0b8" +dependencies = [ + "serde", +] [[package]] name = "id-arena" @@ -2488,6 +2547,28 @@ dependencies = [ "toml_edit", ] +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.98", +] + [[package]] name = "proc-macro2" version = "1.0.93" diff --git a/Makefile b/Makefile index 61e4df1722..cf4986999f 100644 --- a/Makefile +++ b/Makefile @@ -212,7 +212,7 @@ build-cairo-2-compiler: fi cargo-deps: - cargo install --version 0.3.1 iai-callgrind-runner + cargo install --version 0.14.0 iai-callgrind-runner cargo install --version 1.1.0 cargo-criterion cargo install --version 0.6.1 flamegraph --locked cargo install --version 1.14.0 hyperfine diff --git a/vm/Cargo.toml b/vm/Cargo.toml index 0fc15c5f4b..26676452ea 100644 --- a/vm/Cargo.toml +++ b/vm/Cargo.toml @@ -96,7 +96,7 @@ wasm-bindgen-test = "0.3.34" getrandom = { version = "0.2", features = ["js"]} [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] -iai-callgrind = "0.3.1" +iai-callgrind = "0.14.0" criterion = { version = "0.5.1", features = ["html_reports"] } proptest = "1.0.0" mimalloc.workspace = true From add217d04eec600e9dff160e18cce94e7dce2cad Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Mon, 10 Mar 2025 11:53:58 +0100 Subject: [PATCH 5/8] changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8144890339..0eb6917c78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ - ci: Update CI [#1991](https://github.com/lambdaclass/cairo-vm/pull/1991) +- chore: Update iai-callgrind [#1992](https://github.com/lambdaclass/cairo-vm/pull/1992) + #### [2.0.0] - 2025-02-26 * fix: Check overflow in cairo pie address calculation [#1945](https://github.com/lambdaclass/cairo-vm/pull/1945) From 21a2a504906c127b8cf1669dc775847ddf56f867 Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Mon, 10 Mar 2025 12:03:45 +0100 Subject: [PATCH 6/8] update hyperfine --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 61e4df1722..a21d19f100 100644 --- a/Makefile +++ b/Makefile @@ -215,7 +215,7 @@ cargo-deps: cargo install --version 0.3.1 iai-callgrind-runner cargo install --version 1.1.0 cargo-criterion cargo install --version 0.6.1 flamegraph --locked - cargo install --version 1.14.0 hyperfine + cargo install --version 1.19.0 hyperfine cargo install --version 0.9.49 cargo-nextest --locked cargo install --version 0.5.9 cargo-llvm-cov cargo install --version 0.12.1 wasm-pack --locked From b39e89d08cb86379f009601090e5067e34d3150c Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Mon, 10 Mar 2025 12:04:37 +0100 Subject: [PATCH 7/8] fix --- .github/workflows/test_install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index 5494d389c4..385cf8845d 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -12,7 +12,7 @@ jobs: name: "Install on ${{ matrix.os }}" strategy: matrix: - os: [ubuntu-24.04, macos-13] + os: [ubuntu-22.04, macos-13] runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 From 4aa0653d479b71a19180e8a2d45d54a59b496279 Mon Sep 17 00:00:00 2001 From: Edgar Luque Date: Mon, 10 Mar 2025 12:15:24 +0100 Subject: [PATCH 8/8] fixes --- bench/iai_benchmark.rs | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/bench/iai_benchmark.rs b/bench/iai_benchmark.rs index 1b7a4c67a3..514cc8835a 100644 --- a/bench/iai_benchmark.rs +++ b/bench/iai_benchmark.rs @@ -1,4 +1,6 @@ use core::hint::black_box; +use iai_callgrind::library_benchmark; +use iai_callgrind::library_benchmark_group; use iai_callgrind::main; use cairo_vm::{ @@ -6,12 +8,13 @@ use cairo_vm::{ vm::runners::cairo_runner::CairoRunner, }; +use iai_callgrind::LibraryBenchmarkConfig; use mimalloc::MiMalloc; #[global_allocator] static ALLOC: MiMalloc = MiMalloc; -#[inline(never)] +#[library_benchmark] fn parse_program() { //Picked the biggest one at the time of writing let program = include_bytes!("../cairo_programs/benchmarks/keccak_integration_benchmark.json"); @@ -28,7 +31,7 @@ fn parse_program_helper() -> Program { Program::from_bytes(program.as_slice(), Some("main")).unwrap() } -#[inline(never)] +#[library_benchmark] fn build_runner() { let program = parse_program_helper(); let runner = CairoRunner::new( @@ -60,13 +63,22 @@ fn build_runner_helper() -> CairoRunner { .unwrap() } -#[inline(never)] +#[library_benchmark] fn load_program_data() { let mut runner = build_runner_helper(); _ = black_box(runner.initialize(false).unwrap()); } +library_benchmark_group!( + name = cairo_vm_group; + benchmarks = + parse_program, + build_runner, + load_program_data +); + main!( - callgrind_args = "toggle-collect=helper::*,core::mem::drop"; - functions = parse_program, build_runner, load_program_data + config = LibraryBenchmarkConfig::default() + .callgrind_args(["toggle-collect=helper::*,core::mem::drop"]); + library_benchmark_groups = cairo_vm_group );