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

feat(l1, levm): use levm as default #1682

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ help: ## 📚 Show help for each of the Makefile recipes
build: ## 🔨 Build the client
cargo build --workspace

build-revm: ## 🔨 Build the client with revm as EVM
cargo build --workspace --features revm --no-default-features

lint: ## 🧹 Linter check
cargo clippy --all-targets --all-features --workspace --exclude ethrex-prover -- -D warnings

Expand All @@ -25,11 +28,18 @@ clean: clean-vectors ## 🧹 Remove build artifacts

STAMP_FILE := .docker_build_stamp
$(STAMP_FILE): $(shell find crates cmd -type f -name '*.rs') Cargo.toml Dockerfile
docker build -t ethrex .
docker build -t ethrex --build-arg "BUILD_FLAGS=${--features levm}" .
touch $(STAMP_FILE)

STAMP_FILE_REVM := .docker_build_stamp_revm
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we wait for #1706 so that we don't have to create this extra code? After 1706 this PR should be trivial

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can. I'll reduce #1706 scope to just replacing the use of feature flags with the ethrex CLI flag so it can be delivered sooner.

$(STAMP_FILE_REVM): $(shell find crates cmd -type f -name '*.rs') Cargo.toml Dockerfile
docker build -t ethrex --build-arg "BUILD_FLAGS=--features revm" .
touch $(STAMP_FILE)

build-image: $(STAMP_FILE) ## 🐳 Build the Docker image

build-image-revm: $(STAMP_FILE_REVM)

run-image: build-image ## 🏃 Run the Docker image
docker run --rm -p 127.0.0.1:8545:8545 ethrex --http.addr 0.0.0.0

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ You now should be able to build the client:
```bash
make build
```
Disclaimer: We're using LEVM as the default EVM for Ethrex, if you wish to
build it with REVM support instead, you can use:
```bash
make build-revm
```
### Database
Currently, the database is `libmdbx`, it will be set up
when you start the client. The location of the db's files will depend on your OS:
Expand Down
3 changes: 2 additions & 1 deletion cmd/ethrex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ name = "ethrex"
path = "./ethrex.rs"

[features]
default = ["dep:ethrex-storage", "libmdbx"]
default = ["dep:ethrex-storage", "libmdbx", "levm"]
revm = [ "dep:ethrex-storage", "libmdbx" ]
dev = ["dep:ethrex-dev"]
metrics = ["ethrex-blockchain/metrics", "ethrex-l2/metrics"]
libmdbx = ["dep:libmdbx", "ethrex-storage/libmdbx"]
Expand Down
7 changes: 3 additions & 4 deletions cmd/ethrex/ethrex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,11 @@ fn import_blocks(store: &Store, blocks: &Vec<Block>) {
if let Some(last_block) = blocks.last() {
let hash = last_block.hash();
cfg_if::cfg_if! {
if #[cfg(feature = "levm")] {
// We are allowing this not to unwrap so that tests can run even if block execution results in the wrong root hash with LEVM.
let _ = apply_fork_choice(store, hash, hash, hash);
if #[cfg(feature = "revm")] {
apply_fork_choice(store, hash, hash, hash).unwrap();
}
else {
apply_fork_choice(store, hash, hash, hash).unwrap();
let _ = apply_fork_choice(store, hash, hash, hash);
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions crates/vm/levm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ build-revm-comparison:

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

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

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

run-hive-debug-levm: build-image-levm ## 🐝 Run Hive with LEVM in debug mode
$(MAKE) -C ../../../ setup-hive
Expand Down
Loading