Skip to content

Commit

Permalink
feat(levm): hive LEVM CI (#1567)
Browse files Browse the repository at this point in the history
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->
Publish results of running Hive tests with LEVM to slack channel 

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->

- We build the client image with LEVM, we run hive tests and then we
publish them
- Add to the Dockerfile the possibility to add build flags.
- Avoid panicking if setup wasn't completed successfully, as no tests
will run in that scenario.
  • Loading branch information
JereSalo authored Dec 27, 2024
1 parent 0393132 commit 958eb12
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .github/scripts/publish_levm_hive.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
curl -X POST $url \
-H 'Content-Type: application/json; charset=utf-8' \
--data @- <<EOF
$(jq -n --arg text "$(cat results.md)" '{
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": "LEVM Hive Coverage Report"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": $text
}
}
]
}')
EOF
99 changes: 99 additions & 0 deletions .github/workflows/daily_reports_testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Daily Reports Hive LEVM

on:
push:
branches: ["main"]
merge_group:
pull_request:
branches: ["**"]

# Uncomment this after testing
# on:
# schedule:
# # Every day at UTC midnight
# - cron: "0 0 * * 1,2,3,4,5"
# workflow_dispatch:

env:
RUST_VERSION: 1.81.0

jobs:
run-hive:
name: Hive
runs-on: ubuntu-latest

steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5

- name: Build Image with LEVM
run: cd crates/vm/levm && make build-image-levm

- name: Setup Hive
run: make setup-hive

- name: Run Hive RPC Simulation
run: cd hive && ./hive --sim ethereum/rpc-compat --client ethrex --sim.limit "*" --sim.parallelism 16
continue-on-error: true

- name: Run Hive Sync Simulation
run: cd hive && ./hive --sim ethereum/sync --client ethrex --sim.limit "*" --sim.parallelism 16
continue-on-error: true

- name: Run Hive Engine Simulation
run: cd hive && ./hive --sim ethereum/engine --client ethrex --sim.limit "*" --sim.parallelism 16
continue-on-error: true

- name: Run Hive P2P Simulation
run: cd hive && ./hive --sim devp2p --client ethrex --sim.limit "*" --sim.parallelism 16
continue-on-error: true

- name: Upload results
uses: actions/upload-artifact@v4
with:
name: testing_logs
path: hive/workspace/logs/*-*.json

hive-report:
name: Generate report and upload to summary and slack
needs: run-hive
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4

- name: Rustup toolchain install
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ env.RUST_VERSION }}

- name: Download all results
uses: actions/download-artifact@v4
with:
path: hive/workspace/logs
pattern: "*_logs"
merge-multiple: true

- name: Caching
uses: Swatinem/rust-cache@v2

- name: Generate the hive report
run: cargo run -p hive_report > results.md

- name: Post results in summary
run: |
echo "# LEVM Hive coverage report" >> $GITHUB_STEP_SUMMARY
cat results.md >> $GITHUB_STEP_SUMMARY
# - name: Post results to levm slack channel
# env:
# url: ${{ secrets.LEVM_SLACK_WEBHOOK }}
# run: sh .github/scripts/publish_levm_hive.sh

- name: Post results to test channel for debugging
env:
url: ${{ secrets.TEST_CHANNEL_SLACK }}
run: sh .github/scripts/publish_levm_hive.sh
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ levm_ef_tests_summary_slack.txt
levm_ef_tests_summary_github.txt
levm_ef_tests_summary.txt

results.md
loc_report.md
loc_report_slack.txt
loc_report_github.txt
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ COPY --from=planner /ethrex/recipe.json recipe.json
# Build dependencies only, these remained cached
RUN cargo chef cook --release --recipe-path recipe.json

# Optional build flags
ARG BUILD_FLAGS=""
COPY . .
RUN cargo build --release
RUN cargo build --release $BUILD_FLAGS

FROM ubuntu:24.04
WORKDIR /usr/local/bin
Expand Down
2 changes: 1 addition & 1 deletion cmd/ethrex/ethrex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ fn import_blocks(store: &Store, blocks: &Vec<Block>) {
}
if let Some(last_block) = blocks.last() {
let hash = last_block.hash();
apply_fork_choice(store, hash, hash, hash).unwrap();
let _ = apply_fork_choice(store, hash, hash, hash);
}
info!("Added {} blocks to blockchain", size);
}
1 change: 1 addition & 0 deletions crates/blockchain/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ path = "./blockchain.rs"

[features]
default = ["c-kzg"]
default-levm = ["default", "levm"]
libmdbx = [
"ethrex-core/libmdbx",
"ethrex-storage/default",
Expand Down
11 changes: 11 additions & 0 deletions crates/l2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ init-l1: ## 🚀 Initializes an L1 Lambda ethrex Client
--authrpc.port ${L1_AUTH_PORT} \
--datadir ${ethrex_L1_DEV_LIBMDBX}

init-l1-levm: ## 🚀 Initializes an L1 Lambda ethrex Client with LEVM
cargo run --release \
--manifest-path ../../Cargo.toml \
--bin ethrex \
--features dev,ethrex-blockchain/default-levm,ethrex-vm/default-levm -- \
--network ${L1_GENESIS_FILE_PATH} \
--http.port ${L1_PORT} \
--http.addr 0.0.0.0 \
--authrpc.port ${L1_AUTH_PORT} \
--datadir ${ethrex_L1_DEV_LIBMDBX}

down-local-l1: ## 🛑 Shuts down the L1 Lambda ethrex Client
docker compose -f ${ethrex_DEV_DOCKER_COMPOSE_PATH} down
docker compose -f docker-compose-l2.yaml down
Expand Down
1 change: 1 addition & 0 deletions crates/vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ path = "./vm.rs"

[features]
default = ["c-kzg", "blst"]
default-levm = ["default", "levm"]
l2 = []
c-kzg = ["revm/c-kzg"]
blst = ["revm/blst"]
Expand Down
8 changes: 8 additions & 0 deletions crates/vm/levm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,11 @@ build-revm-comparison:
--bin levm_factorial \
--bin revm_fibonacci \
--bin levm_fibonacci

###### Build Client with LEVM ######

FLAGS := "--features ethrex-blockchain/default-levm,ethrex-vm/default-levm"

build-image-levm: ## 🐳 Build the Docker image with LEVM features
cd ../../../ && \
docker build -t ethrex --build-arg BUILD_FLAGS=$(FLAGS) .

0 comments on commit 958eb12

Please sign in to comment.