Skip to content

perf(levm): improvements to precompiles #2928

perf(levm): improvements to precompiles

perf(levm): improvements to precompiles #2928

Workflow file for this run

name: LEVM
on:
push:
branches: ["main"]
pull_request:
branches: ["**"]
paths:
- "tooling/ef_tests/state/**"
- "crates/vm/levm/**"
- ".github/workflows/pr-main_levm.yaml"
- "tooling/ef_tests/state"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
pull-requests: write
jobs:
ef-test:
if: ${{ github.event_name != 'merge_group' }}
name: EF Tests Check
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Rust Environment
uses: ./.github/actions/setup-rust
- name: Download EF Tests
run: |
cd tooling/ef_tests/state
make download-evm-ef-tests
- name: Run tests
run: |
cd tooling/ef_tests/state
set -o pipefail
make run-evm-ef-tests-ci | tee test_result_pr.txt
- name: Show test summary -- full
run: |
cd tooling/ef_tests/state && awk '/Summary: /,0' test_result_pr.txt
- name: Show test summary -- short
run: |
bash .github/scripts/parse_test_result.sh tooling/ef_tests/state/test_result_pr.txt | tee tooling/ef_tests/state/test_result_pr_short.txt
echo "PR's test results:"
cat tooling/ef_tests/state/test_result_pr_short.txt
- name: Upload PR branch EF-test results.
uses: actions/upload-artifact@v4
with:
name: pr-ef-test-data
path: tooling/ef_tests/state/test_result_pr_short.txt
- name: Check EF-TESTS status is 100%
run: |
cd tooling/ef_tests/state
if [ "$(awk '/Summary:/ {print $(NF)}' test_result_pr_short.txt)" != "(100.00%)" ]; then
echo "Percentage is not 100%."
# exit 1 # uncomment when we expect 100% pass-rate
fi
ef-test-main:
if: ${{ github.event_name != 'merge_group' }}
name: EF Tests Check main
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Rust Environment
uses: ./.github/actions/setup-rust
- name: Download EF Tests
run: |
cd tooling/ef_tests/state
make download-evm-ef-tests
- name: Run tests
run: |
cd tooling/ef_tests/state
set -o pipefail
make run-evm-ef-tests-ci | tee test_result_main.txt
- name: Show test summary -- full
run: |
cd tooling/ef_tests/state && awk '/Summary: /,0' test_result_main.txt
- name: Show test summary -- short
run: |
bash .github/scripts/parse_test_result.sh tooling/ef_tests/state/test_result_main.txt | tee tooling/ef_tests/state/test_result_main_short.txt
echo "Main's test results:"
cat tooling/ef_tests/state/test_result_main_short.txt
- name: Upload main branch EF-test results.
uses: actions/upload-artifact@v4
with:
name: main-ef-test-data
path: tooling/ef_tests/state/test_result_main_short.txt
compare-ef-tests:
if: ${{ github.event_name != 'merge_group' }}
name: EF Tests Compare
needs: [ef-test-main, ef-test]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Download main branch ef tests
uses: actions/download-artifact@v4
with:
name: main-ef-test-data
path: tooling/ef_tests/state/
- name: Download PR branch ef tests
uses: actions/download-artifact@v4
with:
name: pr-ef-test-data
path: tooling/ef_tests/state/
# NOTE: diff will exit with a non 0 exit code when there are differences
- name: Compare files
id: branch_diffs
continue-on-error: true
run: |
cd tooling/ef_tests/state
diff test_result_main_short.txt test_result_pr_short.txt
- name: Compare results
if: ${{ steps.branch_diffs.outcome == 'failure' && github.event_name == 'pull_request' }}
run: |
bash .github/scripts/compare_ef_tests.sh tooling/ef_tests/state/test_result_main_short.txt tooling/ef_tests/state/test_result_pr_short.txt | tee tooling/ef_tests/state/ef_tests_comparison.md
- name: Find comment
continue-on-error: true
uses: peter-evans/find-comment@v3
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: "github-actions[bot]"
body-includes: "EF Tests Comparison"
# If we have a failure, means that there are EF-tests differences.
# If the condition is met, create or update the comment with the summary.
- name: Create comment
if: ${{ steps.branch_diffs.outcome == 'failure' && github.event_name == 'pull_request' }}
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body-path: tooling/ef_tests/state/ef_tests_comparison.md
edit-mode: replace
# If we don't have a failure, means that there are no differences in EF-tests.
# If comment-id != '', means that we've already created the comment.
# If both conditions are met, update the comment saying that all tests pass.
- name: Update comment
if: ${{ steps.branch_diffs.outcome != 'failure' && github.event_name == 'pull_request' && steps.fc.outputs.comment-id != '' }}
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body: |
# EF Tests Comparison
Same results between main branch and the current PR.
edit-mode: replace
# The purpose of this job is to add it as a required check in GitHub so that we don't have to add every individual job as a required check
all-tests:
# "Integration Test" is a required check, don't change the name
name: Integration Test
runs-on: ubuntu-latest
needs: [ef-test]
# Make sure this job runs even if the previous jobs failed or were skipped
if: ${{ always() && needs.ef-test.result != 'skipped' }}
steps:
- name: Check if any job failed
run: |
if [ "${{ needs.ef-test.result }}" != "success" ]; then
echo "Job EF Tests Check failed"
exit 1
fi
test:
# "Test" is a required check, don't change the name
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Rust Environment
uses: ./.github/actions/setup-rust
- name: Run tests
run: |
cd crates/vm/levm
make test
bench:
name: Benchmarks (LEVM vs REVM)
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Rust Environment
uses: ./.github/actions/setup-rust
- name: Install hyperfine
uses: taiki-e/install-action@v2
with:
tool: hyperfine@1.16
- name: Install solc
uses: pontem-network/get-solc@master
with:
version: v0.8.29
token: ${{ secrets.GITHUB_TOKEN || '' }}
- name: Run benchmarks
run: |
cd crates/vm/levm
make revm-comparison