From aefb1307cf511627eb8929e34a13c384d22afc2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Rodr=C3=ADguez=20Chatruc?= <49622509+jrchatruc@users.noreply.github.com> Date: Wed, 20 Nov 2024 13:40:12 -0300 Subject: [PATCH] chore(core): change ethereum_rust to ethrex in code (#1215) **Motivation** **Description** --- .github/workflows/ci.yaml | 2 +- .github/workflows/hive_and_assertoor.yaml | 18 ++--- .github/workflows/l2_prover_ci.yaml | 4 +- .gitignore | 2 +- Cargo.toml | 30 ++++---- Dockerfile | 9 +-- Makefile | 24 +++--- README.md | 70 +++++++++--------- .../{ethereum_rust => ethrex}/Cargo.toml | 10 +-- .../{ethereum_rust => ethrex}/ef_tests.rs | 0 .../{ethereum_rust => ethrex}/network.rs | 2 +- .../{ethereum_rust => ethrex}/test_runner.rs | 8 +- .../{ethereum_rust => ethrex}/tests/cancun.rs | 2 +- .../tests/shanghai.rs | 2 +- .../{ethereum_rust => ethrex}/types.rs | 38 +++++----- cmd/ef_tests/levm/Cargo.toml | 12 +-- cmd/ef_tests/levm/deserialize.rs | 2 +- cmd/ef_tests/levm/runner.rs | 8 +- cmd/ef_tests/levm/types.rs | 2 +- cmd/ef_tests/levm/utils.rs | 6 +- cmd/{ethereum_rust => ethrex}/Cargo.toml | 30 ++++---- cmd/{ethereum_rust => ethrex}/cli.rs | 4 +- cmd/{ethereum_rust => ethrex}/decode.rs | 6 +- .../ethereum_rust.rs => ethrex/ethrex.rs} | 32 ++++---- .../Cargo.toml | 14 ++-- cmd/{ethereum_rust_l2 => ethrex_l2}/README.md | 14 ++-- .../assets/config_create.cast.gif | Bin .../assets/config_delete.cast.gif | Bin .../assets/config_edit.cast.gif | Bin .../assets/config_set.cast.gif | Bin .../assets/stack_init.cast.gif | Bin .../assets/stack_restart.cast.gif | Bin .../src/cli.rs | 24 +++--- .../src/commands/autocomplete.rs | 23 +++--- .../src/commands/config.rs | 0 .../src/commands/mod.rs | 0 .../src/commands/stack.rs | 34 ++++----- .../src/commands/test.rs | 10 +-- .../src/commands/utils.rs | 0 .../src/commands/wallet.rs | 12 +-- .../src/config.rs | 10 +-- .../src/lib.rs | 0 .../src/main.rs | 2 +- .../src/utils/config/default_values.rs | 0 .../src/utils/config/mod.rs | 36 ++++----- .../src/utils/messages.rs | 2 +- .../src/utils/mod.rs | 0 crates/blockchain/Cargo.toml | 20 ++--- crates/blockchain/blockchain.rs | 12 +-- crates/blockchain/dev/Cargo.toml | 4 +- crates/blockchain/dev/Dockerfile | 8 +- crates/blockchain/dev/block_producer.rs | 2 +- crates/blockchain/dev/docker-compose-dev.yaml | 6 +- .../blockchain/dev/utils/engine_client/mod.rs | 4 +- crates/blockchain/error.rs | 6 +- crates/blockchain/fork_choice.rs | 4 +- crates/blockchain/mempool.rs | 14 ++-- crates/blockchain/payload.rs | 10 +-- crates/blockchain/smoke_test.rs | 4 +- crates/common/Cargo.toml | 8 +- crates/common/rlp/Cargo.toml | 2 +- crates/common/rlp/structs.rs | 10 +-- crates/common/types/account.rs | 4 +- crates/common/types/blobs_bundle.rs | 2 +- crates/common/types/block.rs | 6 +- crates/common/types/fork_id.rs | 2 +- crates/common/types/genesis.rs | 4 +- crates/common/types/receipt.rs | 4 +- crates/common/types/transaction.rs | 2 +- crates/l2/Cargo.toml | 18 ++--- crates/l2/Dockerfile | 8 +- crates/l2/Makefile | 48 ++++++------ crates/l2/contracts/Cargo.toml | 8 +- crates/l2/contracts/Dockerfile | 12 +-- crates/l2/contracts/deployer.rs | 6 +- crates/l2/docker-compose-l2.yaml | 14 ++-- crates/l2/docs/README.md | 2 +- crates/l2/docs/overview.md | 8 +- crates/l2/docs/prover.md | 6 +- crates/l2/proposer/errors.rs | 8 +- crates/l2/proposer/l1_committer.rs | 10 +-- crates/l2/proposer/l1_watcher.rs | 10 +-- crates/l2/proposer/mod.rs | 6 +- crates/l2/proposer/prover_server.rs | 6 +- crates/l2/prover/Cargo.toml | 24 +++--- crates/l2/prover/src/lib.rs | 2 +- crates/l2/prover/src/main.rs | 4 +- crates/l2/prover/src/prover.rs | 8 +- crates/l2/prover/src/prover_client.rs | 2 +- crates/l2/prover/tests/perf_zkvm.rs | 18 ++--- crates/l2/prover/zkvm/interface/Cargo.toml | 2 +- .../l2/prover/zkvm/interface/guest/Cargo.toml | 8 +- .../prover/zkvm/interface/guest/src/main.rs | 8 +- crates/l2/sdk/Cargo.toml | 10 +-- crates/l2/sdk/src/sdk.rs | 8 +- crates/l2/tests/tests.rs | 18 ++--- crates/l2/utils/eth_client/errors.rs | 2 +- crates/l2/utils/eth_client/eth_sender.rs | 6 +- crates/l2/utils/eth_client/mod.rs | 24 +++--- crates/l2/utils/test_data_io.rs | 14 ++-- crates/networking/p2p/Cargo.toml | 8 +- crates/networking/p2p/README.md | 14 ++-- crates/networking/p2p/bootnode.rs | 4 +- crates/networking/p2p/discv4.rs | 6 +- crates/networking/p2p/kademlia.rs | 2 +- crates/networking/p2p/net.rs | 8 +- crates/networking/p2p/rlpx/connection.rs | 8 +- crates/networking/p2p/rlpx/error.rs | 4 +- crates/networking/p2p/rlpx/eth/backend.rs | 4 +- crates/networking/p2p/rlpx/eth/blocks.rs | 8 +- crates/networking/p2p/rlpx/eth/receipts.rs | 6 +- crates/networking/p2p/rlpx/eth/status.rs | 4 +- .../networking/p2p/rlpx/eth/transactions.rs | 6 +- crates/networking/p2p/rlpx/frame.rs | 4 +- crates/networking/p2p/rlpx/handshake.rs | 6 +- crates/networking/p2p/rlpx/message.rs | 4 +- crates/networking/p2p/rlpx/p2p.rs | 4 +- crates/networking/p2p/rlpx/snap.rs | 4 +- crates/networking/p2p/rlpx/utils.rs | 4 +- crates/networking/p2p/snap.rs | 10 +-- crates/networking/p2p/types.rs | 4 +- crates/networking/rpc/Cargo.toml | 14 ++-- crates/networking/rpc/admin/mod.rs | 8 +- .../rpc/engine/exchange_transition_config.rs | 2 +- crates/networking/rpc/engine/fork_choice.rs | 2 +- crates/networking/rpc/engine/payload.rs | 10 +-- crates/networking/rpc/eth/account.rs | 4 +- crates/networking/rpc/eth/block.rs | 8 +- crates/networking/rpc/eth/fee_market.rs | 8 +- crates/networking/rpc/eth/filter.rs | 18 ++--- crates/networking/rpc/eth/gas_price.rs | 8 +- crates/networking/rpc/eth/logs.rs | 4 +- crates/networking/rpc/eth/transaction.rs | 21 +++--- crates/networking/rpc/rpc.rs | 10 +-- crates/networking/rpc/types/account_proof.rs | 2 +- crates/networking/rpc/types/block.rs | 6 +- .../networking/rpc/types/block_identifier.rs | 4 +- crates/networking/rpc/types/fork_choice.rs | 2 +- crates/networking/rpc/types/payload.rs | 4 +- crates/networking/rpc/types/receipt.rs | 16 ++-- crates/networking/rpc/types/transaction.rs | 4 +- crates/networking/rpc/utils.rs | 12 +-- crates/networking/rpc/web3/mod.rs | 4 +- crates/storage/store/Cargo.toml | 12 +-- crates/storage/store/engines/api.rs | 6 +- crates/storage/store/engines/in_memory.rs | 6 +- crates/storage/store/engines/libmdbx.rs | 10 +-- crates/storage/store/error.rs | 4 +- crates/storage/store/rlp.rs | 6 +- crates/storage/store/storage.rs | 16 ++-- crates/storage/trie/Cargo.toml | 4 +- crates/storage/trie/error.rs | 2 +- crates/storage/trie/nibbles.rs | 2 +- crates/storage/trie/node.rs | 2 +- crates/storage/trie/node/branch.rs | 2 +- crates/storage/trie/node/extension.rs | 2 +- crates/storage/trie/node/leaf.rs | 2 +- crates/storage/trie/node_hash.rs | 6 +- crates/storage/trie/rlp.rs | 2 +- crates/storage/trie/state.rs | 2 +- crates/storage/trie/trie.rs | 3 +- crates/vm/Cargo.toml | 16 ++-- crates/vm/db.rs | 12 +-- crates/vm/errors.rs | 6 +- crates/vm/execution_db.rs | 10 +-- crates/vm/execution_result.rs | 4 +- crates/vm/levm/Cargo.toml | 6 +- crates/vm/levm/Makefile | 2 +- .../vm/levm/bench/revm_comparison/Cargo.toml | 2 +- .../vm/levm/bench/revm_comparison/src/lib.rs | 2 +- crates/vm/levm/src/account.rs | 2 +- crates/vm/levm/src/call_frame.rs | 2 +- crates/vm/levm/src/constants.rs | 4 +- crates/vm/levm/src/db.rs | 2 +- crates/vm/levm/src/environment.rs | 2 +- crates/vm/levm/src/errors.rs | 2 +- crates/vm/levm/src/gas_cost.rs | 2 +- crates/vm/levm/src/memory.rs | 2 +- .../vm/levm/src/opcode_handlers/arithmetic.rs | 2 +- .../src/opcode_handlers/bitwise_comparison.rs | 2 +- crates/vm/levm/src/opcode_handlers/block.rs | 2 +- .../levm/src/opcode_handlers/environment.rs | 2 +- crates/vm/levm/src/opcode_handlers/keccak.rs | 2 +- crates/vm/levm/src/opcode_handlers/logging.rs | 2 +- crates/vm/levm/src/opcode_handlers/push.rs | 2 +- .../stack_memory_storage_flow.rs | 4 +- crates/vm/levm/src/opcode_handlers/system.rs | 12 +-- crates/vm/levm/src/operations.rs | 2 +- crates/vm/levm/src/utils.rs | 2 +- crates/vm/levm/src/vm.rs | 14 ++-- crates/vm/levm/tests/edge_case_tests.rs | 4 +- crates/vm/levm/tests/tests.rs | 4 +- crates/vm/vm.rs | 10 +-- test_data/network_params.yaml | 4 +- 194 files changed, 743 insertions(+), 757 deletions(-) rename cmd/ef_tests/{ethereum_rust => ethrex}/Cargo.toml (66%) rename cmd/ef_tests/{ethereum_rust => ethrex}/ef_tests.rs (100%) rename cmd/ef_tests/{ethereum_rust => ethrex}/network.rs (97%) rename cmd/ef_tests/{ethereum_rust => ethrex}/test_runner.rs (97%) rename cmd/ef_tests/{ethereum_rust => ethrex}/tests/cancun.rs (91%) rename cmd/ef_tests/{ethereum_rust => ethrex}/tests/shanghai.rs (88%) rename cmd/ef_tests/{ethereum_rust => ethrex}/types.rs (91%) rename cmd/{ethereum_rust => ethrex}/Cargo.toml (50%) rename cmd/{ethereum_rust => ethrex}/cli.rs (97%) rename cmd/{ethereum_rust => ethrex}/decode.rs (94%) rename cmd/{ethereum_rust/ethereum_rust.rs => ethrex/ethrex.rs} (90%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/Cargo.toml (71%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/README.md (92%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/assets/config_create.cast.gif (100%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/assets/config_delete.cast.gif (100%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/assets/config_edit.cast.gif (100%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/assets/config_set.cast.gif (100%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/assets/stack_init.cast.gif (100%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/assets/stack_restart.cast.gif (100%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/cli.rs (62%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/commands/autocomplete.rs (85%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/commands/config.rs (100%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/commands/mod.rs (100%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/commands/stack.rs (89%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/commands/test.rs (93%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/commands/utils.rs (100%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/commands/wallet.rs (98%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/config.rs (87%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/lib.rs (100%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/main.rs (90%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/utils/config/default_values.rs (100%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/utils/config/mod.rs (90%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/utils/messages.rs (97%) rename cmd/{ethereum_rust_l2 => ethrex_l2}/src/utils/mod.rs (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7d50e032f9..b98a92d72f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -43,7 +43,7 @@ jobs: - name: Run cargo clippy run: | - cargo clippy --all-targets --all-features --workspace --exclude ethereum_rust-prover -- -D warnings + cargo clippy --all-targets --all-features --workspace --exclude ethrex-prover -- -D warnings - name: Run cargo fmt run: | diff --git a/.github/workflows/hive_and_assertoor.yaml b/.github/workflows/hive_and_assertoor.yaml index 22a25aa6ce..dd31cbb258 100644 --- a/.github/workflows/hive_and_assertoor.yaml +++ b/.github/workflows/hive_and_assertoor.yaml @@ -37,14 +37,14 @@ jobs: context: . file: ./Dockerfile load: true - tags: ethereum_rust - outputs: type=docker,dest=/tmp/ethereum_rust_image.tar + tags: ethrex + outputs: type=docker,dest=/tmp/ethrex_image.tar - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: ethereum_rust_image - path: /tmp/ethereum_rust_image.tar + name: ethrex_image + path: /tmp/ethrex_image.tar run-hive: name: Hive - ${{ matrix.name }} @@ -78,12 +78,12 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: ethereum_rust_image + name: ethrex_image path: /tmp - name: Load image run: | - docker load --input /tmp/ethereum_rust_image.tar + docker load --input /tmp/ethrex_image.tar - name: Checkout sources uses: actions/checkout@v3 @@ -109,17 +109,17 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: ethereum_rust_image + name: ethrex_image path: /tmp - name: Load image run: | - docker load --input /tmp/ethereum_rust_image.tar + docker load --input /tmp/ethrex_image.tar - name: Setup kurtosis testnet and run assertoor tests uses: ethpandaops/kurtosis-assertoor-github-action@v1 with: kurtosis_version: '1.3.1' ethereum_package_url: 'github.com/lambdaclass/ethereum-package' - ethereum_package_branch: 'ethereum-rust-integration' + ethereum_package_branch: 'ethrex-integration' ethereum_package_args: './test_data/network_params.yaml' diff --git a/.github/workflows/l2_prover_ci.yaml b/.github/workflows/l2_prover_ci.yaml index 8d98bb9e85..f5d27b0e67 100644 --- a/.github/workflows/l2_prover_ci.yaml +++ b/.github/workflows/l2_prover_ci.yaml @@ -17,9 +17,9 @@ jobs: matrix: action: - command: check - args: -p ethereum_rust-prover + args: -p ethrex-prover - command: clippy - args: -p ethereum_rust-prover --all-targets --no-default-features + args: -p ethrex-prover --all-targets --no-default-features steps: - name: Checkout sources uses: actions/checkout@v4 diff --git a/.gitignore b/.gitignore index 8836258d9d..d0a4bbbc2b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,7 +13,7 @@ Cargo.lock # MSVC Windows builds of rustc generate these, which store debugging information *.pdb -cmd/ef_tests/ethereum_rust/vectors +cmd/ef_tests/ethrex/vectors cmd/ef_tests/levm/vectors # Repos checked out by make target diff --git a/Cargo.toml b/Cargo.toml index 0648424580..ed1de07cdb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,10 +9,10 @@ members = [ "crates/vm", "crates/storage/trie", "crates/common/rlp", - "cmd/ethereum_rust", - "cmd/ef_tests/ethereum_rust", + "cmd/ethrex", + "cmd/ef_tests/ethrex", "cmd/ef_tests/levm", - "cmd/ethereum_rust_l2", + "cmd/ethrex_l2", "crates/vm/levm", "crates/vm/levm/bench/revm_comparison", "crates/l2/", @@ -23,8 +23,8 @@ members = [ resolver = "2" default-members = [ - "cmd/ethereum_rust", - "cmd/ethereum_rust_l2", + "cmd/ethrex", + "cmd/ethrex_l2", "crates/l2/prover", ] @@ -33,16 +33,16 @@ version = "0.1.0" edition = "2021" [workspace.dependencies] -ethereum_rust-blockchain = { path = "./crates/blockchain" } -ethereum_rust-core = { path = "./crates/common" } -ethereum_rust-net = { path = "./crates/networking/p2p" } -ethereum_rust-rpc = { path = "./crates/networking/rpc" } -ethereum_rust-storage = { path = "./crates/storage/store" } -ethereum_rust-vm = { path = "./crates/vm" } -ethereum_rust-trie = { path = "./crates/storage/trie" } -ethereum_rust-rlp = { path = "./crates/common/rlp" } -ethereum_rust-l2 = { path = "./crates/l2" } -ethereum_rust-prover = { path = "./crates/l2/prover" } +ethrex-blockchain = { path = "./crates/blockchain" } +ethrex-core = { path = "./crates/common" } +ethrex-net = { path = "./crates/networking/p2p" } +ethrex-rpc = { path = "./crates/networking/rpc" } +ethrex-storage = { path = "./crates/storage/store" } +ethrex-vm = { path = "./crates/vm" } +ethrex-trie = { path = "./crates/storage/trie" } +ethrex-rlp = { path = "./crates/common/rlp" } +ethrex-l2 = { path = "./crates/l2" } +ethrex-prover = { path = "./crates/l2/prover" } tracing = { version = "0.1", features = ["log"] } tracing-subscriber = "0.3.0" diff --git a/Dockerfile b/Dockerfile index c945fd449f..0f3bec28b4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* RUN cargo install cargo-chef -WORKDIR /ethereum_rust +WORKDIR /ethrex FROM chef AS planner COPY . . @@ -17,7 +17,7 @@ COPY . . RUN cargo chef prepare --recipe-path recipe.json FROM chef AS builder -COPY --from=planner /ethereum_rust/recipe.json recipe.json +COPY --from=planner /ethrex/recipe.json recipe.json # Build dependencies only, these remained cached RUN cargo chef cook --release --recipe-path recipe.json @@ -27,7 +27,6 @@ RUN cargo build --release FROM ubuntu:24.04 WORKDIR /usr/local/bin -COPY --from=builder ethereum_rust/target/release/ethereum_rust . +COPY --from=builder ethrex/target/release/ethrex . EXPOSE 8545 -ENTRYPOINT [ "./ethereum_rust" ] - +ENTRYPOINT [ "./ethrex" ] diff --git a/Makefile b/Makefile index 63cd3c4791..da4237586b 100644 --- a/Makefile +++ b/Makefile @@ -8,15 +8,15 @@ build: ## ๐Ÿ”จ Build the client cargo build --workspace lint: ## ๐Ÿงน Linter check - cargo clippy --all-targets --all-features --workspace --exclude ethereum_rust-prover -- -D warnings + cargo clippy --all-targets --all-features --workspace --exclude ethrex-prover -- -D warnings SPECTEST_VERSION := v3.0.0 SPECTEST_ARTIFACT := tests_$(SPECTEST_VERSION).tar.gz -SPECTEST_VECTORS_DIR := cmd/ef_tests/ethereum_rust/vectors +SPECTEST_VECTORS_DIR := cmd/ef_tests/ethrex/vectors CRATE ?= * test: $(SPECTEST_VECTORS_DIR) ## ๐Ÿงช Run each crate's tests - cargo test -p '$(CRATE)' --workspace --exclude ethereum_rust-prover --exclude ethereum_rust-levm --exclude ef_tests-levm -- --skip test_contract_compilation --skip testito + cargo test -p '$(CRATE)' --workspace --exclude ethrex-prover --exclude ethrex-levm --exclude ef_tests-levm -- --skip test_contract_compilation --skip testito clean: clean-vectors ## ๐Ÿงน Remove build artifacts cargo clean @@ -24,13 +24,13 @@ 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 ethereum_rust . + docker build -t ethrex . touch $(STAMP_FILE) build-image: $(STAMP_FILE) ## ๐Ÿณ Build the Docker image run-image: build-image ## ๐Ÿƒ Run the Docker image - docker run --rm -p 127.0.0.1:8545:8545 ethereum_rust --http.addr 0.0.0.0 + docker run --rm -p 127.0.0.1:8545:8545 ethrex --http.addr 0.0.0.0 $(SPECTEST_ARTIFACT): rm -f tests_*.tar.gz # Delete older versions @@ -46,12 +46,12 @@ download-test-vectors: $(SPECTEST_VECTORS_DIR) ## ๐Ÿ“ฅ Download test vectors clean-vectors: ## ๐Ÿ—‘๏ธ Clean test vectors rm -rf $(SPECTEST_VECTORS_DIR) -ETHEREUM_PACKAGE_REVISION := c7952d75d72159d03aec423b46797df2ded11f99 +ETHEREUM_PACKAGE_REVISION := 5b49d02ee556232a73ea1e28000ec5b3fca1073f # Shallow clones can't specify a single revision, but at least we avoid working # the whole history by making it shallow since a given date (one day before our # target revision). ethereum-package: - git clone --single-branch --branch ethereum-rust-integration https://github.com/lambdaclass/ethereum-package + git clone --single-branch --branch ethrex-integration https://github.com/lambdaclass/ethereum-package checkout-ethereum-package: ethereum-package ## ๐Ÿ“ฆ Checkout specific Ethereum package revision cd ethereum-package && \ @@ -60,7 +60,7 @@ checkout-ethereum-package: ethereum-package ## ๐Ÿ“ฆ Checkout specific Ethereum p localnet: stop-localnet-silent build-image checkout-ethereum-package ## ๐ŸŒ Start local network kurtosis run --enclave lambdanet ethereum-package --args-file test_data/network_params.yaml - docker logs -f $$(docker ps -q --filter ancestor=ethereum_rust) + docker logs -f $$(docker ps -q --filter ancestor=ethrex) stop-localnet: ## ๐Ÿ›‘ Stop local network kurtosis enclave stop lambdanet @@ -71,7 +71,7 @@ stop-localnet-silent: @kurtosis enclave stop lambdanet >/dev/null 2>&1 || true @kurtosis enclave rm lambdanet --force >/dev/null 2>&1 || true -HIVE_REVISION := 421852ec25e4e608fe5460656f4bf0637649619e +HIVE_REVISION := fc6ddec210095e2369019e7f4ab2f9f38e35a8e8 # Shallow clones can't specify a single revision, but at least we avoid working # the whole history by making it shallow since a given date (one day before our # target revision). @@ -95,13 +95,13 @@ TEST_PATTERN ?= / # For example, to run the rpc-compat suites for eth_chainId & eth_blockNumber you should run: # `make run-hive SIMULATION=ethereum/rpc-compat TEST_PATTERN="/eth_chainId|eth_blockNumber"` run-hive: build-image setup-hive ## ๐Ÿงช Run Hive testing suite - cd hive && ./hive --sim $(SIMULATION) --client ethereumrust --sim.limit "$(TEST_PATTERN)" + cd hive && ./hive --sim $(SIMULATION) --client ethrex --sim.limit "$(TEST_PATTERN)" run-hive-on-latest: setup-hive ## ๐Ÿงช Run Hive testing suite with the latest docker image - cd hive && ./hive --sim $(SIMULATION) --client ethereumrust --sim.limit "$(TEST_PATTERN)" + cd hive && ./hive --sim $(SIMULATION) --client ethrex --sim.limit "$(TEST_PATTERN)" run-hive-debug: build-image setup-hive ## ๐Ÿž Run Hive testing suite in debug mode - cd hive && ./hive --sim $(SIMULATION) --client ethereumrust --sim.limit "$(TEST_PATTERN)" --docker.output + cd hive && ./hive --sim $(SIMULATION) --client ethrex --sim.limit "$(TEST_PATTERN)" --docker.output clean-hive-logs: ## ๐Ÿงน Clean Hive logs rm -rf ./hive/workspace/logs diff --git a/README.md b/README.md index 351ca536b6..3c08cf8ed4 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # ethrex [![Telegram Chat][tg-badge]][tg-url] -[![license](https://img.shields.io/github/license/lambdaclass/ethereum_rust)](/LICENSE) +[![license](https://img.shields.io/github/license/lambdaclass/ethrex)](/LICENSE) [tg-badge]: https://img.shields.io/endpoint?url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Frust_ethereum%2F&logo=telegram&label=chat&color=neon [tg-url]: https://t.me/rust_ethereum @@ -47,7 +47,7 @@ An Ethereum execution client consists roughly of the following parts: - The Ethereum Wire Protocol (`ETH`), used for state synchronization and block/transaction propagation, among other things. This runs on top of `RLPx`. - The `SNAP` protocol, used for exchanging state snapshots. Mainly needed for **snap sync**, a more optimized way of doing state sync than the old fast sync (you can read more about it [here](https://blog.ethereum.org/2021/03/03/geth-v1-10-0)). - Block building and Fork choice management (i.e. logic to both build blocks so a validator can propose them and set where the head of the chain is currently at, according to what the consensus layer determines). This is essentially what our `blockchain` crate contains. -- The block execution logic itself, i.e., an EVM implementation. We are finishing an implementation of our own called [levm](https://github.com/lambdaclass/ethereum_rust/tree/main/crates/vm/levm) (Lambda EVM). +- The block execution logic itself, i.e., an EVM implementation. We are finishing an implementation of our own called [levm](https://github.com/lambdaclass/ethrex/tree/main/crates/vm/levm) (Lambda EVM). Because most of the milestones below do not overlap much, we are currently working on them in parallel. @@ -60,61 +60,61 @@ Implement the bare minimum required to: In a bit more detail: -| Task Description | Status | -| --------- | --------------------------------------------------------------------------- | -| Add `libmdbx` bindings and basic API, create tables for state (blocks, transactions, etc) | โœ… +| Task Description | Status | +| --------- | --------------------------------------------------------------------------- | +| Add `libmdbx` bindings and basic API, create tables for state (blocks, transactions, etc) | โœ… | EVM wrapper for block execution | โœ… | | JSON RPC API server setup | โœ… | | RPC State-serving endpoints | ๐Ÿ—๏ธ (almost done, a few endpoints are left) | -| Basic Engine API implementation. Set new chain head (`forkchoiceUpdated`) and new block (`newPayload`). | โœ… +| Basic Engine API implementation. Set new chain head (`forkchoiceUpdated`) and new block (`newPayload`). | โœ… -See detailed issues and progress for this milestone [here](https://github.com/lambdaclass/ethereum_rust/milestone/1). +See detailed issues and progress for this milestone [here](https://github.com/lambdaclass/ethrex/milestone/1). ### Milestone 2: History & Reorgs Implement support for block reorganizations and historical state queries. This milestone involves persisting the state trie to enable efficient access to historical states and implementing a tree structure for the blockchain to manage multiple chain branches. It also involves a real implementation of the `engine_forkchoiceUpdated` Engine API when we do not have to build the block ourselves (i.e. when `payloadAttributes` is null). -| Task Description | Status | -| --------- | --------------------------------------------------------------------------- | -| Persist data on an on-disk Merkle Patricia Tree using `libmdbx` | โœ… -| Engine API `forkchoiceUpdated` implementation (without `payloadAttributes`) | ๐Ÿ—๏ธ -| Support for RPC historical queries, i.e. queries (`eth_call`, `eth_getBalance`, etc) at any block | โœ… +| Task Description | Status | +| --------- | --------------------------------------------------------------------------- | +| Persist data on an on-disk Merkle Patricia Tree using `libmdbx` | โœ… +| Engine API `forkchoiceUpdated` implementation (without `payloadAttributes`) | ๐Ÿ—๏ธ +| Support for RPC historical queries, i.e. queries (`eth_call`, `eth_getBalance`, etc) at any block | โœ… -Detailed issues and progress [here](https://github.com/lambdaclass/ethereum_rust/milestone/4). +Detailed issues and progress [here](https://github.com/lambdaclass/ethrex/milestone/4). ### Milestone 3: Block building Add the ability to build new payloads (blocks), so the consensus client can propose new blocks based on transactions received from the RPC endpoints. -| Task Description | Status | -| --------- | --------------------------------------------------------------------------- | -| `engine_forkchoiceUpdated` implementation with a non-null `payloadAttributes` | ๐Ÿ—๏ธ -| `engine_getPayload` endpoint implementation that builds blocks. | ๐Ÿ—๏ธ -| Implement a mempool and the `eth_sendRawTransaction` endpoint where users can send transactions | โœ… +| Task Description | Status | +| --------- | --------------------------------------------------------------------------- | +| `engine_forkchoiceUpdated` implementation with a non-null `payloadAttributes` | ๐Ÿ—๏ธ +| `engine_getPayload` endpoint implementation that builds blocks. | ๐Ÿ—๏ธ +| Implement a mempool and the `eth_sendRawTransaction` endpoint where users can send transactions | โœ… -Detailed issues and progress [here](https://github.com/lambdaclass/ethereum_rust/milestone/5). +Detailed issues and progress [here](https://github.com/lambdaclass/ethrex/milestone/5). ### Milestone 4: P2P Network Implement the peer to peer networking stack, i.e. the DevP2P protocol. This includes `discv4`, `RLPx` and the `eth` capability. This will let us get and retrieve blocks and transactions from other nodes. We'll add the transactions we receive to the mempool. We'll also download blocks from other nodes when we get payloads where the parent isn't in our local chain. -| Task Description | Status | -| --------- | --------------------------------------------------------------------------- | -| Implement `discv4` for peer discovery | โœ… -| Implement the `RLPx` transport protocol | ๐Ÿ—๏ธ -| Implement the `eth` capability | ๐Ÿ—๏ธ +| Task Description | Status | +| --------- | --------------------------------------------------------------------------- | +| Implement `discv4` for peer discovery | โœ… +| Implement the `RLPx` transport protocol | ๐Ÿ—๏ธ +| Implement the `eth` capability | ๐Ÿ—๏ธ -Detailed issues and progress [here](https://github.com/lambdaclass/ethereum_rust/milestone/2). +Detailed issues and progress [here](https://github.com/lambdaclass/ethrex/milestone/2). ### Milestone 5: State Sync Add support for the `SNAP` protocol, which lets us get a recent copy of the blockchain state instead of going through all blocks from genesis. This is used for used for snap sync. Since we don't support older versions of the spec by design, this is a prerequisite to being able to sync the node with public networks, including mainnet. -| Task Description | Status | -| --------- | --------------------------------------------------------------------------- | -| Implement `SNAP` protocol for snap syncing | โŒ +| Task Description | Status | +| --------- | --------------------------------------------------------------------------- | +| Implement `SNAP` protocol for snap syncing | โŒ -Detailed issues and progress [here](https://github.com/lambdaclass/ethereum_rust/milestone/3). +Detailed issues and progress [here](https://github.com/lambdaclass/ethrex/milestone/3). ## Quick Start (L1 localnet) @@ -160,12 +160,12 @@ make build ### 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: -- Mac: `~/Library/Application Support/ethereum_rust` -- Linux: `~/.config/ethereum_rust` +- Mac: `~/Library/Application Support/ethrex` +- Linux: `~/.config/ethrex` You can delete the db with: ```bash -cargo run --bin ethereum_rust -- removedb +cargo run --bin ethrex -- removedb ``` ### Test @@ -192,7 +192,7 @@ make test CRATE= ``` For example: ```bash -make test CRATE="ethereum_rust-blockchain" +make test CRATE="ethrex-blockchain" ``` ##### Hive Tests @@ -236,7 +236,7 @@ This example runs **every** test under rpc, with debug output Example run: ```bash -cargo run --bin ethereum_rust -- --network test_data/genesis-kurtosis.json +cargo run --bin ethrex -- --network test_data/genesis-kurtosis.json ``` The `network` argument is mandatory, as it defines the parameters of the chain. @@ -468,7 +468,7 @@ Most of them are [here](https://github.com/ethpandaops/ethereum-package/blob/mai ## ethrex L2 Docs - [ethrex L2 Docs](./crates/l2/docs/README.md) -- [ethrex L2 CLI Docs](./cmd/ethereum_rust_l2/README.md) +- [ethrex L2 CLI Docs](./cmd/ethrex_l2/README.md) ## ๐Ÿ“š References and acknowledgements diff --git a/cmd/ef_tests/ethereum_rust/Cargo.toml b/cmd/ef_tests/ethrex/Cargo.toml similarity index 66% rename from cmd/ef_tests/ethereum_rust/Cargo.toml rename to cmd/ef_tests/ethrex/Cargo.toml index abd9c11c41..4c77e6c6fb 100644 --- a/cmd/ef_tests/ethereum_rust/Cargo.toml +++ b/cmd/ef_tests/ethrex/Cargo.toml @@ -1,13 +1,13 @@ [package] -name = "ef_tests-ethereum_rust" +name = "ef_tests-ethrex" version.workspace = true edition.workspace = true [dependencies] -ethereum_rust-blockchain.workspace = true -ethereum_rust-core.workspace = true -ethereum_rust-storage.workspace = true -ethereum_rust-rlp.workspace = true +ethrex-blockchain.workspace = true +ethrex-core.workspace = true +ethrex-storage.workspace = true +ethrex-rlp.workspace = true serde.workspace = true serde_json.workspace = true bytes.workspace = true diff --git a/cmd/ef_tests/ethereum_rust/ef_tests.rs b/cmd/ef_tests/ethrex/ef_tests.rs similarity index 100% rename from cmd/ef_tests/ethereum_rust/ef_tests.rs rename to cmd/ef_tests/ethrex/ef_tests.rs diff --git a/cmd/ef_tests/ethereum_rust/network.rs b/cmd/ef_tests/ethrex/network.rs similarity index 97% rename from cmd/ef_tests/ethereum_rust/network.rs rename to cmd/ef_tests/ethrex/network.rs index c69a5b2d57..300ab4ee03 100644 --- a/cmd/ef_tests/ethereum_rust/network.rs +++ b/cmd/ef_tests/ethrex/network.rs @@ -1,4 +1,4 @@ -use ethereum_rust_core::types::ChainConfig; +use ethrex_core::types::ChainConfig; use lazy_static::lazy_static; use serde::Deserialize; diff --git a/cmd/ef_tests/ethereum_rust/test_runner.rs b/cmd/ef_tests/ethrex/test_runner.rs similarity index 97% rename from cmd/ef_tests/ethereum_rust/test_runner.rs rename to cmd/ef_tests/ethrex/test_runner.rs index 2bfb665075..7d1d13f03d 100644 --- a/cmd/ef_tests/ethereum_rust/test_runner.rs +++ b/cmd/ef_tests/ethrex/test_runner.rs @@ -1,12 +1,12 @@ use std::{collections::HashMap, path::Path}; use crate::types::{BlockWithRLP, TestUnit}; -use ethereum_rust_blockchain::{add_block, fork_choice::apply_fork_choice}; -use ethereum_rust_core::types::{ +use ethrex_blockchain::{add_block, fork_choice::apply_fork_choice}; +use ethrex_core::types::{ Account as CoreAccount, Block as CoreBlock, BlockHeader as CoreBlockHeader, }; -use ethereum_rust_rlp::decode::RLPDecode; -use ethereum_rust_storage::{EngineType, Store}; +use ethrex_rlp::decode::RLPDecode; +use ethrex_storage::{EngineType, Store}; pub fn run_ef_test(test_key: &str, test: &TestUnit) { // check that the decoded genesis block header matches the deserialized one diff --git a/cmd/ef_tests/ethereum_rust/tests/cancun.rs b/cmd/ef_tests/ethrex/tests/cancun.rs similarity index 91% rename from cmd/ef_tests/ethereum_rust/tests/cancun.rs rename to cmd/ef_tests/ethrex/tests/cancun.rs index 4ed4ad94d3..13ade9dd28 100644 --- a/cmd/ef_tests/ethereum_rust/tests/cancun.rs +++ b/cmd/ef_tests/ethrex/tests/cancun.rs @@ -1,6 +1,6 @@ use std::path::Path; -use ef_tests_ethereum_rust::test_runner::{parse_test_file, run_ef_test}; +use ef_tests_ethrex::test_runner::{parse_test_file, run_ef_test}; fn parse_and_execute(path: &Path) -> datatest_stable::Result<()> { let tests = parse_test_file(path); diff --git a/cmd/ef_tests/ethereum_rust/tests/shanghai.rs b/cmd/ef_tests/ethrex/tests/shanghai.rs similarity index 88% rename from cmd/ef_tests/ethereum_rust/tests/shanghai.rs rename to cmd/ef_tests/ethrex/tests/shanghai.rs index d3689f9391..666eff8730 100644 --- a/cmd/ef_tests/ethereum_rust/tests/shanghai.rs +++ b/cmd/ef_tests/ethrex/tests/shanghai.rs @@ -1,6 +1,6 @@ use std::path::Path; -use ef_tests_ethereum_rust::test_runner::{parse_test_file, run_ef_test}; +use ef_tests_ethrex::test_runner::{parse_test_file, run_ef_test}; fn parse_and_execute(path: &Path) -> datatest_stable::Result<()> { let tests = parse_test_file(path); diff --git a/cmd/ef_tests/ethereum_rust/types.rs b/cmd/ef_tests/ethrex/types.rs similarity index 91% rename from cmd/ef_tests/ethereum_rust/types.rs rename to cmd/ef_tests/ethrex/types.rs index 05a525475a..e05ecc0310 100644 --- a/cmd/ef_tests/ethereum_rust/types.rs +++ b/cmd/ef_tests/ethrex/types.rs @@ -1,11 +1,11 @@ use bytes::Bytes; -use ethereum_rust_core::types::{ - code_hash, Account as ethereum_rustAccount, AccountInfo, Block as CoreBlock, BlockBody, +use ethrex_core::types::{ + code_hash, Account as ethrexAccount, AccountInfo, Block as CoreBlock, BlockBody, EIP1559Transaction, EIP2930Transaction, EIP4844Transaction, LegacyTransaction, - Transaction as ethereum_rustTransaction, TxKind, + Transaction as ethrexTransaction, TxKind, }; -use ethereum_rust_core::types::{Genesis, GenesisAccount, Withdrawal}; -use ethereum_rust_core::{types::BlockHeader, Address, Bloom, H256, H64, U256}; +use ethrex_core::types::{Genesis, GenesisAccount, Withdrawal}; +use ethrex_core::{types::BlockHeader, Address, Bloom, H256, H64, U256}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; @@ -18,7 +18,7 @@ pub struct TestUnit { pub info: Option, pub blocks: Vec, pub genesis_block_header: Header, - #[serde(rename = "genesisRLP", with = "ethereum_rust_core::serde_utils::bytes")] + #[serde(rename = "genesisRLP", with = "ethrex_core::serde_utils::bytes")] pub genesis_rlp: Bytes, pub lastblockhash: H256, pub network: Network, @@ -70,7 +70,7 @@ impl TestUnit { #[derive(Debug, PartialEq, Eq, Serialize, Deserialize, Clone)] pub struct Account { pub balance: U256, - #[serde(with = "ethereum_rust_core::serde_utils::bytes")] + #[serde(with = "ethrex_core::serde_utils::bytes")] pub code: Bytes, pub nonce: U256, pub storage: HashMap, @@ -109,7 +109,7 @@ pub struct Header { pub bloom: Bloom, pub coinbase: Address, pub difficulty: U256, - #[serde(with = "ethereum_rust_core::serde_utils::bytes")] + #[serde(with = "ethrex_core::serde_utils::bytes")] pub extra_data: Bytes, pub gas_limit: U256, pub gas_used: U256, @@ -134,7 +134,7 @@ pub struct Header { #[derive(Debug, PartialEq, Eq, Deserialize, Clone)] #[serde(rename_all = "camelCase")] pub struct BlockWithRLP { - #[serde(with = "ethereum_rust_core::serde_utils::bytes")] + #[serde(with = "ethrex_core::serde_utils::bytes")] pub rlp: Bytes, #[serde(flatten)] inner: Option, @@ -191,7 +191,7 @@ impl From for CoreBlock { pub struct Transaction { #[serde(rename = "type")] pub transaction_type: Option, - #[serde(with = "ethereum_rust_core::serde_utils::bytes")] + #[serde(with = "ethrex_core::serde_utils::bytes")] pub data: Bytes, pub gas_limit: U256, pub gas_price: Option, @@ -211,7 +211,7 @@ pub struct Transaction { pub to: TxKind, } -// Conversions between EFtests & ethereum_rust types +// Conversions between EFtests & ethrex types impl From
for BlockHeader { fn from(val: Header) -> Self { BlockHeader { @@ -239,17 +239,17 @@ impl From
for BlockHeader { } } -impl From for ethereum_rustTransaction { +impl From for ethrexTransaction { fn from(val: Transaction) -> Self { match val.transaction_type { Some(tx_type) => match tx_type.as_u64() { - 0 => ethereum_rustTransaction::LegacyTransaction(val.into()), - 1 => ethereum_rustTransaction::EIP2930Transaction(val.into()), - 2 => ethereum_rustTransaction::EIP1559Transaction(val.into()), - 3 => ethereum_rustTransaction::EIP4844Transaction(val.into()), + 0 => ethrexTransaction::LegacyTransaction(val.into()), + 1 => ethrexTransaction::EIP2930Transaction(val.into()), + 2 => ethrexTransaction::EIP1559Transaction(val.into()), + 3 => ethrexTransaction::EIP4844Transaction(val.into()), _ => unimplemented!(), }, - None => ethereum_rustTransaction::LegacyTransaction(val.into()), + None => ethrexTransaction::LegacyTransaction(val.into()), } } } @@ -365,9 +365,9 @@ impl From for EIP2930Transaction { } } -impl From for ethereum_rustAccount { +impl From for ethrexAccount { fn from(val: Account) -> Self { - ethereum_rustAccount { + ethrexAccount { info: AccountInfo { code_hash: code_hash(&val.code), balance: val.balance, diff --git a/cmd/ef_tests/levm/Cargo.toml b/cmd/ef_tests/levm/Cargo.toml index 92e2053527..51504dbc0b 100644 --- a/cmd/ef_tests/levm/Cargo.toml +++ b/cmd/ef_tests/levm/Cargo.toml @@ -4,12 +4,12 @@ version.workspace = true edition.workspace = true [dependencies] -ethereum_rust-blockchain = { workspace = true, features = ["levm"] } -ethereum_rust-core.workspace = true -ethereum_rust-storage.workspace = true -ethereum_rust-rlp.workspace = true -ethereum_rust-vm = { workspace = true, features = ["levm"] } -ethereum_rust-levm = { path = "../../../crates/vm/levm" } +ethrex-blockchain = { workspace = true, features = ["levm"] } +ethrex-core.workspace = true +ethrex-storage.workspace = true +ethrex-rlp.workspace = true +ethrex-vm = { workspace = true, features = ["levm"] } +ethrex-levm = { path = "../../../crates/vm/levm" } serde.workspace = true serde_json.workspace = true bytes.workspace = true diff --git a/cmd/ef_tests/levm/deserialize.rs b/cmd/ef_tests/levm/deserialize.rs index 1fd978a4fc..b81f4208b3 100644 --- a/cmd/ef_tests/levm/deserialize.rs +++ b/cmd/ef_tests/levm/deserialize.rs @@ -1,6 +1,6 @@ use crate::types::EFTest; use bytes::Bytes; -use ethereum_rust_core::U256; +use ethrex_core::U256; use serde::Deserialize; use std::{collections::HashMap, str::FromStr}; diff --git a/cmd/ef_tests/levm/runner.rs b/cmd/ef_tests/levm/runner.rs index 691b89adcd..d3b4eaa95b 100644 --- a/cmd/ef_tests/levm/runner.rs +++ b/cmd/ef_tests/levm/runner.rs @@ -1,16 +1,16 @@ use crate::{report::EFTestsReport, types::EFTest, utils}; -use ethereum_rust_core::{ +use ethrex_core::{ types::{code_hash, AccountInfo}, H256, U256, }; -use ethereum_rust_levm::{ +use ethrex_levm::{ db::Cache, errors::{TransactionReport, VMError}, vm::VM, Environment, }; -use ethereum_rust_storage::AccountUpdate; -use ethereum_rust_vm::db::StoreWrapper; +use ethrex_storage::AccountUpdate; +use ethrex_vm::db::StoreWrapper; use keccak_hash::keccak; use spinoff::{spinners::Dots, Color, Spinner}; use std::{collections::HashMap, error::Error, sync::Arc}; diff --git a/cmd/ef_tests/levm/types.rs b/cmd/ef_tests/levm/types.rs index d1403195fc..9721b1e60f 100644 --- a/cmd/ef_tests/levm/types.rs +++ b/cmd/ef_tests/levm/types.rs @@ -4,7 +4,7 @@ use crate::deserialize::{ deserialize_u256_vec_safe, }; use bytes::Bytes; -use ethereum_rust_core::{ +use ethrex_core::{ types::{Genesis, GenesisAccount, TxKind}, Address, H256, U256, }; diff --git a/cmd/ef_tests/levm/utils.rs b/cmd/ef_tests/levm/utils.rs index 512175697c..dedb641c94 100644 --- a/cmd/ef_tests/levm/utils.rs +++ b/cmd/ef_tests/levm/utils.rs @@ -1,7 +1,7 @@ use crate::types::EFTest; -use ethereum_rust_core::{types::Genesis, H256}; -use ethereum_rust_storage::{EngineType, Store}; -use ethereum_rust_vm::{evm_state, EvmState}; +use ethrex_core::{types::Genesis, H256}; +use ethrex_storage::{EngineType, Store}; +use ethrex_vm::{evm_state, EvmState}; pub fn load_initial_state(test: &EFTest) -> (EvmState, H256) { let genesis = Genesis::from(test); diff --git a/cmd/ethereum_rust/Cargo.toml b/cmd/ethrex/Cargo.toml similarity index 50% rename from cmd/ethereum_rust/Cargo.toml rename to cmd/ethrex/Cargo.toml index 989ec49de5..eeec636c13 100644 --- a/cmd/ethereum_rust/Cargo.toml +++ b/cmd/ethrex/Cargo.toml @@ -1,19 +1,19 @@ [package] -name = "ethereum_rust" +name = "ethrex" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ethereum_rust-blockchain.workspace = true -ethereum_rust-rpc.workspace = true -ethereum_rust-core.workspace = true -ethereum_rust-net.workspace = true -ethereum_rust-storage.workspace = true -ethereum_rust-vm.workspace = true -ethereum_rust-rlp.workspace = true -ethereum_rust-l2.workspace = true +ethrex-blockchain.workspace = true +ethrex-rpc.workspace = true +ethrex-core.workspace = true +ethrex-net.workspace = true +ethrex-storage.workspace = true +ethrex-vm.workspace = true +ethrex-rlp.workspace = true +ethrex-l2.workspace = true bytes.workspace = true hex.workspace = true @@ -31,14 +31,14 @@ tokio-util.workspace = true cfg-if = "1.0.0" -ethereum_rust-dev = { path = "../../crates/blockchain/dev", optional = true } +ethrex-dev = { path = "../../crates/blockchain/dev", optional = true } [[bin]] -name = "ethereum_rust" -path = "./ethereum_rust.rs" +name = "ethrex" +path = "./ethrex.rs" [features] default = [] -dev = ["dep:ethereum_rust-dev"] -l2 = ["ethereum_rust-vm/l2"] -levm = ["ethereum_rust-vm/levm", "ethereum_rust-blockchain/levm"] +dev = ["dep:ethrex-dev"] +l2 = ["ethrex-vm/l2"] +levm = ["ethrex-vm/levm", "ethrex-blockchain/levm"] diff --git a/cmd/ethereum_rust/cli.rs b/cmd/ethrex/cli.rs similarity index 97% rename from cmd/ethereum_rust/cli.rs rename to cmd/ethrex/cli.rs index f3980bfa1d..ffd7601947 100644 --- a/cmd/ethereum_rust/cli.rs +++ b/cmd/ethrex/cli.rs @@ -1,9 +1,9 @@ use clap::{Arg, ArgAction, Command}; -use ethereum_rust_net::bootnode::BootNode; +use ethrex_net::bootnode::BootNode; use tracing::Level; pub fn cli() -> Command { - Command::new("ethereum_rust") + Command::new("ethrex") .about("ethrex Execution client") .author("Lambdaclass") .arg( diff --git a/cmd/ethereum_rust/decode.rs b/cmd/ethrex/decode.rs similarity index 94% rename from cmd/ethereum_rust/decode.rs rename to cmd/ethrex/decode.rs index a3a01a48d7..01bb326473 100644 --- a/cmd/ethereum_rust/decode.rs +++ b/cmd/ethrex/decode.rs @@ -1,7 +1,7 @@ use anyhow::Error; use bytes::Bytes; -use ethereum_rust_core::types::{Block, Genesis}; -use ethereum_rust_rlp::decode::RLPDecode as _; +use ethrex_core::types::{Block, Genesis}; +use ethrex_rlp::decode::RLPDecode as _; use std::{ fs::File, io::{BufReader, Read as _}, @@ -38,7 +38,7 @@ pub fn genesis_file(file: File) -> Result { #[cfg(test)] mod tests { use crate::decode::chain_file; - use ethereum_rust_core::H256; + use ethrex_core::H256; use std::{fs::File, str::FromStr as _}; #[test] diff --git a/cmd/ethereum_rust/ethereum_rust.rs b/cmd/ethrex/ethrex.rs similarity index 90% rename from cmd/ethereum_rust/ethereum_rust.rs rename to cmd/ethrex/ethrex.rs index 67e208dbac..36df606833 100644 --- a/cmd/ethereum_rust/ethereum_rust.rs +++ b/cmd/ethrex/ethrex.rs @@ -1,13 +1,13 @@ use bytes::Bytes; use directories::ProjectDirs; -use ethereum_rust_blockchain::add_block; -use ethereum_rust_blockchain::fork_choice::apply_fork_choice; -use ethereum_rust_core::types::{Block, Genesis}; -use ethereum_rust_core::H256; -use ethereum_rust_net::bootnode::BootNode; -use ethereum_rust_net::node_id_from_signing_key; -use ethereum_rust_net::types::Node; -use ethereum_rust_storage::{EngineType, Store}; +use ethrex_blockchain::add_block; +use ethrex_blockchain::fork_choice::apply_fork_choice; +use ethrex_core::types::{Block, Genesis}; +use ethrex_core::H256; +use ethrex_net::bootnode::BootNode; +use ethrex_net::node_id_from_signing_key; +use ethrex_net::types::Node; +use ethrex_storage::{EngineType, Store}; use k256::ecdsa::SigningKey; use local_ip_address::local_ip; use std::future::IntoFuture; @@ -26,7 +26,7 @@ use tracing_subscriber::{EnvFilter, FmtSubscriber}; mod cli; mod decode; -const DEFAULT_DATADIR: &str = "ethereum_rust"; +const DEFAULT_DATADIR: &str = "ethrex"; #[tokio::main] async fn main() { let matches = cli::cli().get_matches(); @@ -161,7 +161,7 @@ async fn main() { let jwt_secret = read_jwtsecret_file(authrpc_jwtsecret); // TODO Learn how should the key be created - // https://github.com/lambdaclass/lambda_ethereum_rust/issues/836 + // https://github.com/lambdaclass/lambda_ethrex/issues/836 //let signer = SigningKey::random(&mut OsRng); let key_bytes = H256::from_str("577d8278cc7748fad214b5378669b420f8221afb45ce930b7f22da49cbc545f3").unwrap(); @@ -185,7 +185,7 @@ async fn main() { // TODO: Check every module starts properly. let tracker = TaskTracker::new(); - let rpc_api = ethereum_rust_rpc::start_api( + let rpc_api = ethrex_rpc::start_api( http_socket_addr, authrpc_socket_addr, store.clone(), @@ -195,7 +195,7 @@ async fn main() { .into_future(); // TODO Find a proper place to show node information - // https://github.com/lambdaclass/lambda_ethereum_rust/issues/836 + // https://github.com/lambdaclass/lambda_ethrex/issues/836 let enode = local_p2p_node.enode_url(); info!("Node: {enode}"); @@ -204,10 +204,10 @@ async fn main() { // We do not want to start the networking module if the l2 feature is enabled. cfg_if::cfg_if! { if #[cfg(feature = "l2")] { - let l2_proposer = ethereum_rust_l2::start_proposer(store).into_future(); + let l2_proposer = ethrex_l2::start_proposer(store).into_future(); tracker.spawn(l2_proposer); } else if #[cfg(feature = "dev")] { - use ethereum_rust_dev; + use ethrex_dev; let authrpc_jwtsecret = std::fs::read(authrpc_jwtsecret).expect("Failed to read JWT secret"); let head_block_hash = { @@ -216,10 +216,10 @@ async fn main() { }; let max_tries = 3; let url = format!("http://{authrpc_socket_addr}"); - let block_producer_engine = ethereum_rust_dev::block_producer::start_block_producer(url, authrpc_jwtsecret.into(), head_block_hash, max_tries, 1000, ethereum_rust_core::Address::default()); + let block_producer_engine = ethrex_dev::block_producer::start_block_producer(url, authrpc_jwtsecret.into(), head_block_hash, max_tries, 1000, ethrex_core::Address::default()); tracker.spawn(block_producer_engine); } else { - let networking = ethereum_rust_net::start_network( + let networking = ethrex_net::start_network( udp_socket_addr, tcp_socket_addr, bootnodes, diff --git a/cmd/ethereum_rust_l2/Cargo.toml b/cmd/ethrex_l2/Cargo.toml similarity index 71% rename from cmd/ethereum_rust_l2/Cargo.toml rename to cmd/ethrex_l2/Cargo.toml index 0cbcd346e5..5b969aa034 100644 --- a/cmd/ethereum_rust_l2/Cargo.toml +++ b/cmd/ethrex_l2/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ethereum_rust_l2_cli" +name = "ethrex_l2_cli" version.workspace = true edition.workspace = true @@ -26,12 +26,12 @@ strum = "0.26.3" secp256k1.workspace = true keccak-hash = "0.10.0" -ethereum_rust-l2.workspace = true -ethereum_rust-core.workspace = true -ethereum_rust-blockchain.workspace = true -ethereum_rust-prover.workspace = true -ethereum_rust-rlp.workspace = true -ethereum_rust-rpc.workspace = true +ethrex-l2.workspace = true +ethrex-core.workspace = true +ethrex-blockchain.workspace = true +ethrex-prover.workspace = true +ethrex-rlp.workspace = true +ethrex-rpc.workspace = true [[bin]] name = "l2" diff --git a/cmd/ethereum_rust_l2/README.md b/cmd/ethrex_l2/README.md similarity index 92% rename from cmd/ethereum_rust_l2/README.md rename to cmd/ethrex_l2/README.md index cb81977271..7441580c11 100644 --- a/cmd/ethereum_rust_l2/README.md +++ b/cmd/ethrex_l2/README.md @@ -22,7 +22,7 @@ ## How to install -Running the command below will install the `ethereum_rust_l2` binary in your system. +Running the command below will install the `ethrex_l2` binary in your system. ``` cargo install --path . @@ -31,7 +31,7 @@ cargo install --path . ## Commands ``` -Usage: ethereum_rust_l2 +Usage: ethrex_l2 Commands: stack Stack related commands. @@ -45,7 +45,7 @@ Options: -V, --version Print version ``` -> [!IMPORTANT] +> [!IMPORTANT] > Most of the CLI interaction needs a configuration to be set. You can set a configuration with the `config` command. ### `config` @@ -53,7 +53,7 @@ Options: ``` CLI config commands. -Usage: ethereum_rust_l2 config +Usage: ethrex_l2 config Commands: edit Edit an existing config. @@ -73,7 +73,7 @@ Options: ``` Stack related commands. -Usage: ethereum_rust_l2 stack +Usage: ethrex_l2 stack Commands: init Initializes the L2 network in the provided L1. [aliases: i] @@ -95,7 +95,7 @@ Options: ``` Wallet interaction commands. The configured wallet could operate both with the L1 and L2 networks. -Usage: ethereum_rust_l2 wallet +Usage: ethrex_l2 wallet Commands: balance Get the balance of the wallet. @@ -116,7 +116,7 @@ Options: ``` Generate shell completion scripts. -Usage: ethereum_rust_l2 autocomplete +Usage: ethrex_l2 autocomplete Commands: generate Generate autocomplete shell script. diff --git a/cmd/ethereum_rust_l2/assets/config_create.cast.gif b/cmd/ethrex_l2/assets/config_create.cast.gif similarity index 100% rename from cmd/ethereum_rust_l2/assets/config_create.cast.gif rename to cmd/ethrex_l2/assets/config_create.cast.gif diff --git a/cmd/ethereum_rust_l2/assets/config_delete.cast.gif b/cmd/ethrex_l2/assets/config_delete.cast.gif similarity index 100% rename from cmd/ethereum_rust_l2/assets/config_delete.cast.gif rename to cmd/ethrex_l2/assets/config_delete.cast.gif diff --git a/cmd/ethereum_rust_l2/assets/config_edit.cast.gif b/cmd/ethrex_l2/assets/config_edit.cast.gif similarity index 100% rename from cmd/ethereum_rust_l2/assets/config_edit.cast.gif rename to cmd/ethrex_l2/assets/config_edit.cast.gif diff --git a/cmd/ethereum_rust_l2/assets/config_set.cast.gif b/cmd/ethrex_l2/assets/config_set.cast.gif similarity index 100% rename from cmd/ethereum_rust_l2/assets/config_set.cast.gif rename to cmd/ethrex_l2/assets/config_set.cast.gif diff --git a/cmd/ethereum_rust_l2/assets/stack_init.cast.gif b/cmd/ethrex_l2/assets/stack_init.cast.gif similarity index 100% rename from cmd/ethereum_rust_l2/assets/stack_init.cast.gif rename to cmd/ethrex_l2/assets/stack_init.cast.gif diff --git a/cmd/ethereum_rust_l2/assets/stack_restart.cast.gif b/cmd/ethrex_l2/assets/stack_restart.cast.gif similarity index 100% rename from cmd/ethereum_rust_l2/assets/stack_restart.cast.gif rename to cmd/ethrex_l2/assets/stack_restart.cast.gif diff --git a/cmd/ethereum_rust_l2/src/cli.rs b/cmd/ethrex_l2/src/cli.rs similarity index 62% rename from cmd/ethereum_rust_l2/src/cli.rs rename to cmd/ethrex_l2/src/cli.rs index 6933a1dfca..e4d7570a70 100644 --- a/cmd/ethereum_rust_l2/src/cli.rs +++ b/cmd/ethrex_l2/src/cli.rs @@ -7,14 +7,14 @@ use clap::{Parser, Subcommand}; pub const VERSION_STRING: &str = env!("CARGO_PKG_VERSION"); #[derive(Parser)] -#[command(name="ethereum_rust_l2_cli", author, version=VERSION_STRING, about, long_about = None)] -pub struct EthereumRustL2CLI { +#[command(name="Ethrex_l2_cli", author, version=VERSION_STRING, about, long_about = None)] +pub struct EthrexL2CLI { #[command(subcommand)] - command: EthereumRustL2Command, + command: EthrexL2Command, } #[derive(Subcommand)] -enum EthereumRustL2Command { +enum EthrexL2Command { #[clap(subcommand, about = "Stack related commands.")] Stack(stack::Command), #[clap( @@ -38,18 +38,18 @@ enum EthereumRustL2Command { } pub async fn start() -> eyre::Result<()> { - let EthereumRustL2CLI { command } = EthereumRustL2CLI::parse(); - if let EthereumRustL2Command::Config(cmd) = command { + let EthrexL2CLI { command } = EthrexL2CLI::parse(); + if let EthrexL2Command::Config(cmd) = command { return cmd.run().await; } let cfg = load_selected_config().await?; match command { - EthereumRustL2Command::Stack(cmd) => cmd.run(cfg).await?, - EthereumRustL2Command::Wallet(cmd) => cmd.run(cfg).await?, - EthereumRustL2Command::Utils(cmd) => cmd.run().await?, - EthereumRustL2Command::Autocomplete(cmd) => cmd.run()?, - EthereumRustL2Command::Config(_) => unreachable!(), - EthereumRustL2Command::Test(cmd) => cmd.run(cfg).await?, + EthrexL2Command::Stack(cmd) => cmd.run(cfg).await?, + EthrexL2Command::Wallet(cmd) => cmd.run(cfg).await?, + EthrexL2Command::Utils(cmd) => cmd.run().await?, + EthrexL2Command::Autocomplete(cmd) => cmd.run()?, + EthrexL2Command::Config(_) => unreachable!(), + EthrexL2Command::Test(cmd) => cmd.run(cfg).await?, }; Ok(()) } diff --git a/cmd/ethereum_rust_l2/src/commands/autocomplete.rs b/cmd/ethrex_l2/src/commands/autocomplete.rs similarity index 85% rename from cmd/ethereum_rust_l2/src/commands/autocomplete.rs rename to cmd/ethrex_l2/src/commands/autocomplete.rs index a227d75f7e..c98fbc1c72 100644 --- a/cmd/ethereum_rust_l2/src/commands/autocomplete.rs +++ b/cmd/ethrex_l2/src/commands/autocomplete.rs @@ -1,4 +1,4 @@ -use crate::cli::EthereumRustL2CLI; +use crate::cli::EthrexL2CLI; use clap::{CommandFactory, Subcommand, ValueEnum}; use clap_complete::{aot::Shell, generate}; use std::fs::{File, OpenOptions}; @@ -58,8 +58,8 @@ fn generate_bash_script(shell_arg: Option) -> eyre::Result<()> { let shell = get_shell(shell_arg)?; generate( shell, - &mut EthereumRustL2CLI::command(), - "ethereum_rust_l2", + &mut EthrexL2CLI::command(), + "ethrex_l2", &mut io::stdout(), ); Ok(()) @@ -67,9 +67,9 @@ fn generate_bash_script(shell_arg: Option) -> eyre::Result<()> { fn shellrc_command_exists(shellrc_path: &std::path::Path, shell: Shell) -> eyre::Result { let expected_string = if shell == Shell::Elvish { - "-source $HOME/.ethereum-rust-l2-completion" + "-source $HOME/.ethrex-l2-completion" } else { - ". $HOME/.ethereum-rust-l2-completion" + ". $HOME/.ethrex-l2-completion" }; let file = File::open(shellrc_path)?; @@ -90,14 +90,9 @@ fn install_bash_script(shell_arg: Option) -> eyre::Result<()> { let file_path = dirs::home_dir() .ok_or(eyre::eyre!("Cannot find home directory."))? - .join(".ethereum-rust-l2-completion"); + .join(".ethrex-l2-completion"); let mut file = File::create(file_path)?; - generate( - shell, - &mut EthereumRustL2CLI::command(), - "ethereum_rust_l2", - &mut file, - ); + generate(shell, &mut EthrexL2CLI::command(), "ethrex_l2", &mut file); file.flush()?; let shellrc_path = dirs::home_dir() @@ -107,9 +102,9 @@ fn install_bash_script(shell_arg: Option) -> eyre::Result<()> { if !shellrc_command_exists(&shellrc_path, shell)? { let mut file = OpenOptions::new().append(true).open(shellrc_path)?; if shell == Shell::Elvish { - file.write_all(b"\n-source $HOME/.ethereum-rust-l2-completion\n")?; + file.write_all(b"\n-source $HOME/.ethrex-l2-completion\n")?; } else { - file.write_all(b"\n. $HOME/.ethereum-rust-l2-completion\n")?; + file.write_all(b"\n. $HOME/.ethrex-l2-completion\n")?; } file.flush()?; } diff --git a/cmd/ethereum_rust_l2/src/commands/config.rs b/cmd/ethrex_l2/src/commands/config.rs similarity index 100% rename from cmd/ethereum_rust_l2/src/commands/config.rs rename to cmd/ethrex_l2/src/commands/config.rs diff --git a/cmd/ethereum_rust_l2/src/commands/mod.rs b/cmd/ethrex_l2/src/commands/mod.rs similarity index 100% rename from cmd/ethereum_rust_l2/src/commands/mod.rs rename to cmd/ethrex_l2/src/commands/mod.rs diff --git a/cmd/ethereum_rust_l2/src/commands/stack.rs b/cmd/ethrex_l2/src/commands/stack.rs similarity index 89% rename from cmd/ethereum_rust_l2/src/commands/stack.rs rename to cmd/ethrex_l2/src/commands/stack.rs index 13285c474f..567708e028 100644 --- a/cmd/ethereum_rust_l2/src/commands/stack.rs +++ b/cmd/ethrex_l2/src/commands/stack.rs @@ -1,4 +1,4 @@ -use crate::{config::EthereumRustL2Config, utils::config::confirm}; +use crate::{config::EthrexL2Config, utils::config::confirm}; use clap::Subcommand; use eyre::ContextCompat; use secp256k1::SecretKey; @@ -68,13 +68,13 @@ pub(crate) enum Command { } impl Command { - pub async fn run(self, cfg: EthereumRustL2Config) -> eyre::Result<()> { + pub async fn run(self, cfg: EthrexL2Config) -> eyre::Result<()> { let root = std::path::Path::new(CARGO_MANIFEST_DIR) .parent() .map(std::path::Path::parent) .context("Failed to get parent")? .context("Failed to get grandparent")?; - let ethereum_rust_dev_path = root.join("crates/blockchain/dev"); + let ethrex_dev_path = root.join("crates/blockchain/dev"); let l2_crate_path = root.join("crates/l2"); let contracts_path = l2_crate_path.join("contracts"); @@ -90,7 +90,7 @@ impl Command { // or in a testnet. If the L1 RPC URL is localhost, then it is // a local environment and the local node needs to be started. if l1_rpc_url.contains("localhost") { - start_l1(&l2_crate_path, ðereum_rust_dev_path).await?; + start_l1(&l2_crate_path, ðrex_dev_path).await?; tokio::time::sleep(std::time::Duration::from_secs(1)).await; } if !skip_l1_deployment { @@ -101,7 +101,7 @@ impl Command { Command::Shutdown { l1, l2, force } => { if force || (l1 && confirm("Are you sure you want to shutdown the local L1 node?")?) { - shutdown_l1(ðereum_rust_dev_path)?; + shutdown_l1(ðrex_dev_path)?; } if force || (l2 && confirm("Are you sure you want to shutdown the L2 node?")?) { shutdown_l2()?; @@ -114,7 +114,7 @@ impl Command { start_prover, } => { if force || l1 { - start_l1(&l2_crate_path, ðereum_rust_dev_path).await?; + start_l1(&l2_crate_path, ðrex_dev_path).await?; } if force || l2 { start_l2(root.to_path_buf(), &l2_rpc_url, start_prover).await?; @@ -200,14 +200,14 @@ fn deploy_l1( Ok(()) } -fn shutdown_l1(ethereum_rust_dev_path: &Path) -> eyre::Result<()> { - let local_l1_docker_compose_path = ethereum_rust_dev_path.join("docker-compose-dev.yaml"); +fn shutdown_l1(ethrex_dev_path: &Path) -> eyre::Result<()> { + let local_l1_docker_compose_path = ethrex_dev_path.join("docker-compose-dev.yaml"); let cmd = std::process::Command::new("docker") .arg("compose") .arg("-f") .arg(local_l1_docker_compose_path) .arg("down") - .current_dir(ethereum_rust_dev_path) + .current_dir(ethrex_dev_path) .spawn()? .wait()?; if !cmd.success() { @@ -219,15 +219,15 @@ fn shutdown_l1(ethereum_rust_dev_path: &Path) -> eyre::Result<()> { fn shutdown_l2() -> eyre::Result<()> { std::process::Command::new("pkill") .arg("-f") - .arg("ethereum_rust") + .arg("ethrex") .spawn()? .wait()?; Ok(()) } -async fn start_l1(l2_crate_path: &Path, ethereum_rust_dev_path: &Path) -> eyre::Result<()> { +async fn start_l1(l2_crate_path: &Path, ethrex_dev_path: &Path) -> eyre::Result<()> { create_volumes(l2_crate_path)?; - docker_compose_l2_up(ethereum_rust_dev_path)?; + docker_compose_l2_up(ethrex_dev_path)?; Ok(()) } @@ -237,15 +237,15 @@ fn create_volumes(l2_crate_path: &Path) -> eyre::Result<()> { Ok(()) } -fn docker_compose_l2_up(ethereum_rust_dev_path: &Path) -> eyre::Result<()> { - let local_l1_docker_compose_path = ethereum_rust_dev_path.join("docker-compose-dev.yaml"); +fn docker_compose_l2_up(ethrex_dev_path: &Path) -> eyre::Result<()> { + let local_l1_docker_compose_path = ethrex_dev_path.join("docker-compose-dev.yaml"); let cmd = std::process::Command::new("docker") .arg("compose") .arg("-f") .arg(local_l1_docker_compose_path) .arg("up") .arg("-d") - .current_dir(ethereum_rust_dev_path) + .current_dir(ethrex_dev_path) .spawn()? .wait()?; if !cmd.success() { @@ -264,7 +264,7 @@ async fn start_l2(root: PathBuf, l2_rpc_url: &str, start_prover: bool) -> eyre:: .arg("run") .arg("--release") .arg("--bin") - .arg("ethereum_rust") + .arg("ethrex") .arg("--features") .arg("l2") .arg("--") @@ -293,7 +293,7 @@ async fn start_l2(root: PathBuf, l2_rpc_url: &str, start_prover: bool) -> eyre:: .arg("--features") .arg("build_zkvm") .arg("--bin") - .arg("ethereum_rust_prover") + .arg("ethrex_prover") .current_dir(root_clone) .status(); diff --git a/cmd/ethereum_rust_l2/src/commands/test.rs b/cmd/ethrex_l2/src/commands/test.rs similarity index 93% rename from cmd/ethereum_rust_l2/src/commands/test.rs rename to cmd/ethrex_l2/src/commands/test.rs index 3e78b16318..ae8e90ef09 100644 --- a/cmd/ethereum_rust_l2/src/commands/test.rs +++ b/cmd/ethrex_l2/src/commands/test.rs @@ -1,9 +1,9 @@ -use crate::config::EthereumRustL2Config; +use crate::config::EthrexL2Config; use bytes::Bytes; use clap::Subcommand; -use ethereum_rust_blockchain::constants::TX_GAS_COST; -use ethereum_rust_l2::utils::eth_client::{eth_sender::Overrides, EthClient}; use ethereum_types::{Address, H160, H256, U256}; +use ethrex_blockchain::constants::TX_GAS_COST; +use ethrex_l2::utils::eth_client::{eth_sender::Overrides, EthClient}; use keccak_hash::keccak; use secp256k1::SecretKey; use std::{ @@ -67,7 +67,7 @@ async fn transfer_from( value: U256, iterations: u64, verbose: bool, - cfg: EthereumRustL2Config, + cfg: EthrexL2Config, ) -> u64 { let client = EthClient::new(&cfg.network.l2_rpc_url); let private_key = SecretKey::from_slice(pk.parse::().unwrap().as_bytes()).unwrap(); @@ -117,7 +117,7 @@ async fn transfer_from( } impl Command { - pub async fn run(self, cfg: EthereumRustL2Config) -> eyre::Result<()> { + pub async fn run(self, cfg: EthrexL2Config) -> eyre::Result<()> { match self { Command::Load { path, diff --git a/cmd/ethereum_rust_l2/src/commands/utils.rs b/cmd/ethrex_l2/src/commands/utils.rs similarity index 100% rename from cmd/ethereum_rust_l2/src/commands/utils.rs rename to cmd/ethrex_l2/src/commands/utils.rs diff --git a/cmd/ethereum_rust_l2/src/commands/wallet.rs b/cmd/ethrex_l2/src/commands/wallet.rs similarity index 98% rename from cmd/ethereum_rust_l2/src/commands/wallet.rs rename to cmd/ethrex_l2/src/commands/wallet.rs index d9de3f43e1..fdd6f0c6db 100644 --- a/cmd/ethereum_rust_l2/src/commands/wallet.rs +++ b/cmd/ethrex_l2/src/commands/wallet.rs @@ -1,13 +1,13 @@ -use crate::{commands::utils::encode_calldata, config::EthereumRustL2Config}; +use crate::{commands::utils::encode_calldata, config::EthrexL2Config}; use bytes::Bytes; use clap::Subcommand; -use ethereum_rust_core::types::{PrivilegedTxType, Transaction}; -use ethereum_rust_l2::utils::{ +use ethereum_types::{Address, H256, U256}; +use ethrex_core::types::{PrivilegedTxType, Transaction}; +use ethrex_l2::utils::{ eth_client::{eth_sender::Overrides, EthClient}, merkle_tree::merkle_proof, }; -use ethereum_rust_rpc::types::block::BlockBodyWrapper; -use ethereum_types::{Address, H256, U256}; +use ethrex_rpc::types::block::BlockBodyWrapper; use eyre::OptionExt; use hex::FromHexError; use itertools::Itertools; @@ -251,7 +251,7 @@ async fn get_withdraw_merkle_proof( } impl Command { - pub async fn run(self, cfg: EthereumRustL2Config) -> eyre::Result<()> { + pub async fn run(self, cfg: EthrexL2Config) -> eyre::Result<()> { let eth_client = EthClient::new(&cfg.network.l1_rpc_url); let rollup_client = EthClient::new(&cfg.network.l2_rpc_url); let from = cfg.wallet.address; diff --git a/cmd/ethereum_rust_l2/src/config.rs b/cmd/ethrex_l2/src/config.rs similarity index 87% rename from cmd/ethereum_rust_l2/src/config.rs rename to cmd/ethrex_l2/src/config.rs index 523febdcf7..c568c2877a 100644 --- a/cmd/ethereum_rust_l2/src/config.rs +++ b/cmd/ethrex_l2/src/config.rs @@ -11,7 +11,7 @@ use secp256k1::SecretKey; use serde::{Deserialize, Serialize}; #[derive(Deserialize, Serialize, Clone)] -pub struct EthereumRustL2Config { +pub struct EthrexL2Config { pub network: NetworkConfig, pub wallet: WalletConfig, pub contracts: ContractsConfig, @@ -31,8 +31,8 @@ pub struct NetworkConfig { pub struct WalletConfig { pub address: Address, #[serde( - serialize_with = "ethereum_rust_l2::utils::secret_key_serializer", - deserialize_with = "ethereum_rust_l2::utils::secret_key_deserializer" + serialize_with = "ethrex_l2::utils::secret_key_serializer", + deserialize_with = "ethrex_l2::utils::secret_key_deserializer" )] pub private_key: SecretKey, } @@ -42,7 +42,7 @@ pub struct ContractsConfig { pub common_bridge: Address, } -pub async fn try_load_selected_config() -> eyre::Result> { +pub async fn try_load_selected_config() -> eyre::Result> { let config_path = selected_config_path()?; if !config_path.exists() { return Ok(None); @@ -53,7 +53,7 @@ pub async fn try_load_selected_config() -> eyre::Result eyre::Result { +pub async fn load_selected_config() -> eyre::Result { let config_path = selected_config_path()?; if !config_path.exists() { println!("No config set, please select a config to set"); diff --git a/cmd/ethereum_rust_l2/src/lib.rs b/cmd/ethrex_l2/src/lib.rs similarity index 100% rename from cmd/ethereum_rust_l2/src/lib.rs rename to cmd/ethrex_l2/src/lib.rs diff --git a/cmd/ethereum_rust_l2/src/main.rs b/cmd/ethrex_l2/src/main.rs similarity index 90% rename from cmd/ethereum_rust_l2/src/main.rs rename to cmd/ethrex_l2/src/main.rs index c8ea06604d..bc50c9ae8f 100644 --- a/cmd/ethereum_rust_l2/src/main.rs +++ b/cmd/ethrex_l2/src/main.rs @@ -1,4 +1,4 @@ -use ethereum_rust_l2_cli::cli; +use ethrex_l2_cli::cli; #[tokio::main] async fn main() { diff --git a/cmd/ethereum_rust_l2/src/utils/config/default_values.rs b/cmd/ethrex_l2/src/utils/config/default_values.rs similarity index 100% rename from cmd/ethereum_rust_l2/src/utils/config/default_values.rs rename to cmd/ethrex_l2/src/utils/config/default_values.rs diff --git a/cmd/ethereum_rust_l2/src/utils/config/mod.rs b/cmd/ethrex_l2/src/utils/config/mod.rs similarity index 90% rename from cmd/ethereum_rust_l2/src/utils/config/mod.rs rename to cmd/ethrex_l2/src/utils/config/mod.rs index 9177ee2255..e02e1ea1b1 100644 --- a/cmd/ethereum_rust_l2/src/utils/config/mod.rs +++ b/cmd/ethrex_l2/src/utils/config/mod.rs @@ -1,6 +1,6 @@ use crate::{ commands::{self, config::EditConfigOpts}, - config::{ContractsConfig, EthereumRustL2Config, NetworkConfig, WalletConfig}, + config::{ContractsConfig, EthrexL2Config, NetworkConfig, WalletConfig}, utils::messages::{ ADDRESS_PROMPT_MSG, CONFIG_CREATE_PROMPT_MSG, CONFIG_EDIT_PROMPT_MSG, L1_CHAIN_ID_PROMPT_MSG, L1_EXPLORER_URL_PROMPT_MSG, L1_RPC_URL_PROMPT_MSG, @@ -28,7 +28,7 @@ pub const SELECTED_CONFIG_FILE_NAME: &str = ".selected"; pub fn configs_dir_path() -> eyre::Result { let configs_dir_path = dirs::config_dir() .ok_or_else(|| eyre::eyre!("Could not find user's config directory"))? - .join("ethereum-rust-l2-cli") + .join("Ethrex-l2-cli") .join("configs"); if !configs_dir_path.exists() { std::fs::create_dir_all(&configs_dir_path)?; @@ -95,8 +95,8 @@ pub fn config_path_interactive_selection(prompt: &str) -> eyre::Result config_path(configs.get(selection).context("No config selected")?) } -pub fn prompt_config() -> eyre::Result { - let prompted_config = EthereumRustL2Config { +pub fn prompt_config() -> eyre::Result { + let prompted_config = EthrexL2Config { network: NetworkConfig { l1_rpc_url: prompt(L1_RPC_URL_PROMPT_MSG, DEFAULT_L1_RPC_URL.into())?, l1_chain_id: prompt(L1_CHAIN_ID_PROMPT_MSG, DEFAULT_L1_CHAIN_ID)?, @@ -149,11 +149,8 @@ pub fn selected_config_path() -> eyre::Result { Ok(configs_dir_path()?.join(SELECTED_CONFIG_FILE_NAME)) } -pub fn edit_config_by_name_interactively( - config_path: &PathBuf, -) -> eyre::Result { - let existing_config: EthereumRustL2Config = - toml::from_str(&std::fs::read_to_string(config_path)?)?; +pub fn edit_config_by_name_interactively(config_path: &PathBuf) -> eyre::Result { + let existing_config: EthrexL2Config = toml::from_str(&std::fs::read_to_string(config_path)?)?; let new_config = edit_existing_config_interactively(existing_config)?; Ok(new_config) } @@ -161,16 +158,15 @@ pub fn edit_config_by_name_interactively( pub fn edit_config_by_name_with_args( config_path: &PathBuf, opts: EditConfigOpts, -) -> eyre::Result { - let existing_config: EthereumRustL2Config = - toml::from_str(&std::fs::read_to_string(config_path)?)?; +) -> eyre::Result { + let existing_config: EthrexL2Config = toml::from_str(&std::fs::read_to_string(config_path)?)?; let new_config = edit_existing_config_non_interactively(existing_config, opts)?; Ok(new_config) } -pub fn edit_config_interactively() -> eyre::Result<(EthereumRustL2Config, PathBuf)> { +pub fn edit_config_interactively() -> eyre::Result<(EthrexL2Config, PathBuf)> { let config_path = config_path_interactive_selection(CONFIG_EDIT_PROMPT_MSG)?; - let existing_config: EthereumRustL2Config = + let existing_config: EthrexL2Config = toml::from_str(&std::fs::read_to_string(config_path.clone())?)?; let new_config = edit_existing_config_interactively(existing_config)?; Ok((new_config, config_path)) @@ -195,9 +191,9 @@ pub async fn set_new_config(config_path: PathBuf) -> eyre::Result<()> { } pub fn edit_existing_config_interactively( - existing_config: EthereumRustL2Config, -) -> eyre::Result { - let config = EthereumRustL2Config { + existing_config: EthrexL2Config, +) -> eyre::Result { + let config = EthrexL2Config { network: NetworkConfig { l1_rpc_url: prompt(L1_RPC_URL_PROMPT_MSG, existing_config.network.l1_rpc_url)?, l1_chain_id: prompt(L1_CHAIN_ID_PROMPT_MSG, existing_config.network.l1_chain_id)?, @@ -236,10 +232,10 @@ pub fn edit_existing_config_interactively( } pub fn edit_existing_config_non_interactively( - existing_config: EthereumRustL2Config, + existing_config: EthrexL2Config, opts: EditConfigOpts, -) -> eyre::Result { - let config = EthereumRustL2Config { +) -> eyre::Result { + let config = EthrexL2Config { network: NetworkConfig { l1_rpc_url: opts .l1_rpc_url diff --git a/cmd/ethereum_rust_l2/src/utils/messages.rs b/cmd/ethrex_l2/src/utils/messages.rs similarity index 97% rename from cmd/ethereum_rust_l2/src/utils/messages.rs rename to cmd/ethrex_l2/src/utils/messages.rs index 5893a69a03..ee86c36534 100644 --- a/cmd/ethereum_rust_l2/src/utils/messages.rs +++ b/cmd/ethrex_l2/src/utils/messages.rs @@ -1,4 +1,4 @@ -// `ethereum_rust_l2 config` messages +// `ethrex_l2 config` messages pub const CONFIG_OVERRIDE_PROMPT_MSG: &str = "Config already exists. Do you want to overwrite it?"; pub const CONFIG_CREATE_PROMPT_MSG: &str = "This config does not exist. Do you want to create it?"; pub const CONFIG_CREATE_NAME_PROMPT_MSG: &str = "What do you want to name the new config?"; diff --git a/cmd/ethereum_rust_l2/src/utils/mod.rs b/cmd/ethrex_l2/src/utils/mod.rs similarity index 100% rename from cmd/ethereum_rust_l2/src/utils/mod.rs rename to cmd/ethrex_l2/src/utils/mod.rs diff --git a/crates/blockchain/Cargo.toml b/crates/blockchain/Cargo.toml index f65389f152..1c81c4533f 100644 --- a/crates/blockchain/Cargo.toml +++ b/crates/blockchain/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ethereum_rust-blockchain" +name = "ethrex-blockchain" version = "0.1.0" edition = "2021" @@ -12,10 +12,10 @@ tracing.workspace = true bytes.workspace = true cfg-if = "1.0.0" -ethereum_rust-rlp.workspace = true -ethereum_rust-core = { path = "../common", default-features = false } -ethereum_rust-storage = { path = "../storage/store", default-features = false } -ethereum_rust-vm = { path = "../vm", default-features = false } +ethrex-rlp.workspace = true +ethrex-core = { path = "../common", default-features = false } +ethrex-storage = { path = "../storage/store", default-features = false } +ethrex-vm = { path = "../vm", default-features = false } k256 = { version = "0.13.3", features = ["ecdh"] } @@ -29,9 +29,9 @@ path = "./blockchain.rs" [features] default = ["libmdbx", "c-kzg"] libmdbx = [ - "ethereum_rust-core/libmdbx", - "ethereum_rust-storage/default", - "ethereum_rust-vm/libmdbx", + "ethrex-core/libmdbx", + "ethrex-storage/default", + "ethrex-vm/libmdbx", ] -levm = ["ethereum_rust-vm/levm"] -c-kzg =["ethereum_rust-core/c-kzg"] +levm = ["ethrex-vm/levm"] +c-kzg =["ethrex-core/c-kzg"] diff --git a/crates/blockchain/blockchain.rs b/crates/blockchain/blockchain.rs index 6f85420a1d..6b1aab8f6c 100644 --- a/crates/blockchain/blockchain.rs +++ b/crates/blockchain/blockchain.rs @@ -7,15 +7,15 @@ mod smoke_test; use constants::{GAS_PER_BLOB, MAX_BLOB_GAS_PER_BLOCK, MAX_BLOB_NUMBER_PER_BLOCK}; use error::{ChainError, InvalidBlockError}; -use ethereum_rust_core::types::{ +use ethrex_core::types::{ validate_block_header, validate_cancun_header_fields, validate_no_cancun_header_fields, Block, BlockHash, BlockHeader, BlockNumber, EIP4844Transaction, Receipt, Transaction, }; -use ethereum_rust_core::H256; +use ethrex_core::H256; -use ethereum_rust_storage::error::StoreError; -use ethereum_rust_storage::Store; -use ethereum_rust_vm::{evm_state, execute_block, spec_id, EvmState, SpecId}; +use ethrex_storage::error::StoreError; +use ethrex_storage::Store; +use ethrex_vm::{evm_state, execute_block, spec_id, EvmState, SpecId}; //TODO: Implement a struct Chain or BlockChain to encapsulate //functionality and canonical chain state and config @@ -27,7 +27,7 @@ use ethereum_rust_vm::{evm_state, execute_block, spec_id, EvmState, SpecId}; /// Performs pre and post execution validation, and updates the database with the post state. #[cfg(not(feature = "levm"))] pub fn add_block(block: &Block, storage: &Store) -> Result<(), ChainError> { - use ethereum_rust_vm::get_state_transitions; + use ethrex_vm::get_state_transitions; let block_hash = block.header.compute_block_hash(); diff --git a/crates/blockchain/dev/Cargo.toml b/crates/blockchain/dev/Cargo.toml index a4601cd169..919488b9e5 100644 --- a/crates/blockchain/dev/Cargo.toml +++ b/crates/blockchain/dev/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "ethereum_rust-dev" +name = "ethrex-dev" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ethereum_rust-rpc.workspace = true +ethrex-rpc.workspace = true tokio.workspace = true tracing.workspace = true diff --git a/crates/blockchain/dev/Dockerfile b/crates/blockchain/dev/Dockerfile index af091f266e..246c958a3b 100644 --- a/crates/blockchain/dev/Dockerfile +++ b/crates/blockchain/dev/Dockerfile @@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* RUN cargo install cargo-chef -WORKDIR /ethereum_rust +WORKDIR /ethrex FROM chef AS planner COPY . . @@ -17,7 +17,7 @@ COPY . . RUN cargo chef prepare --recipe-path recipe.json FROM chef AS builder -COPY --from=planner /ethereum_rust/recipe.json recipe.json +COPY --from=planner /ethrex/recipe.json recipe.json # Build dependencies only, these remained cached RUN cargo chef cook --release --recipe-path recipe.json @@ -27,6 +27,6 @@ RUN cargo build --release --features dev FROM ubuntu:24.04 WORKDIR /usr/local/bin -COPY --from=builder ethereum_rust/target/release/ethereum_rust . +COPY --from=builder ethrex/target/release/ethrex . EXPOSE 8545 -ENTRYPOINT [ "./ethereum_rust" ] +ENTRYPOINT [ "./ethrex" ] diff --git a/crates/blockchain/dev/block_producer.rs b/crates/blockchain/dev/block_producer.rs index f9ef468533..7cbe818e73 100644 --- a/crates/blockchain/dev/block_producer.rs +++ b/crates/blockchain/dev/block_producer.rs @@ -1,7 +1,7 @@ use crate::utils::engine_client::{errors::EngineClientError, EngineClient}; use bytes::Bytes; -use ethereum_rust_rpc::types::fork_choice::{ForkChoiceState, PayloadAttributesV3}; use ethereum_types::{Address, H256}; +use ethrex_rpc::types::fork_choice::{ForkChoiceState, PayloadAttributesV3}; use sha2::{Digest, Sha256}; use std::time::{SystemTime, UNIX_EPOCH}; diff --git a/crates/blockchain/dev/docker-compose-dev.yaml b/crates/blockchain/dev/docker-compose-dev.yaml index de952a73ed..b95dce07cb 100644 --- a/crates/blockchain/dev/docker-compose-dev.yaml +++ b/crates/blockchain/dev/docker-compose-dev.yaml @@ -1,8 +1,8 @@ services: - ethereum_rust: + ethrex: restart: always - container_name: ethereum_rust_l1 - image: "ethereum_rust_dev" + container_name: ethrex_l1 + image: "ethrex_dev" build: context: ../../../ dockerfile: ./crates/blockchain/dev/Dockerfile diff --git a/crates/blockchain/dev/utils/engine_client/mod.rs b/crates/blockchain/dev/utils/engine_client/mod.rs index 551bdb2863..47dd69f557 100644 --- a/crates/blockchain/dev/utils/engine_client/mod.rs +++ b/crates/blockchain/dev/utils/engine_client/mod.rs @@ -3,7 +3,8 @@ use errors::{ EngineClientError, ExchangeCapabilitiesError, ForkChoiceUpdateError, GetPayloadError, NewPayloadError, }; -use ethereum_rust_rpc::{ +use ethereum_types::H256; +use ethrex_rpc::{ engine::{ fork_choice::ForkChoiceUpdatedV3, payload::{GetPayloadV3Request, NewPayloadV3Request}, @@ -15,7 +16,6 @@ use ethereum_rust_rpc::{ }, utils::{RpcErrorResponse, RpcRequest, RpcSuccessResponse}, }; -use ethereum_types::H256; use reqwest::Client; use serde::Deserialize; use serde_json::json; diff --git a/crates/blockchain/error.rs b/crates/blockchain/error.rs index f19a20f286..8a16ab224c 100644 --- a/crates/blockchain/error.rs +++ b/crates/blockchain/error.rs @@ -1,6 +1,6 @@ -use ethereum_rust_core::types::{BlobsBundleError, InvalidBlockHeaderError}; -use ethereum_rust_storage::error::StoreError; -use ethereum_rust_vm::EvmError; +use ethrex_core::types::{BlobsBundleError, InvalidBlockHeaderError}; +use ethrex_storage::error::StoreError; +use ethrex_vm::EvmError; #[derive(Debug, thiserror::Error)] pub enum ChainError { diff --git a/crates/blockchain/fork_choice.rs b/crates/blockchain/fork_choice.rs index 3514d35cb0..46ba0ed955 100644 --- a/crates/blockchain/fork_choice.rs +++ b/crates/blockchain/fork_choice.rs @@ -1,8 +1,8 @@ -use ethereum_rust_core::{ +use ethrex_core::{ types::{Block, BlockHash, BlockHeader, BlockNumber}, H256, }; -use ethereum_rust_storage::{error::StoreError, Store}; +use ethrex_storage::{error::StoreError, Store}; use crate::{ error::{self, InvalidForkChoice}, diff --git a/crates/blockchain/mempool.rs b/crates/blockchain/mempool.rs index 61af5a2a02..aa566f239c 100644 --- a/crates/blockchain/mempool.rs +++ b/crates/blockchain/mempool.rs @@ -9,13 +9,13 @@ use crate::{ }, error::MempoolError, }; -use ethereum_rust_core::{ +use ethrex_core::{ types::{ BlobsBundle, BlockHeader, ChainConfig, EIP4844Transaction, MempoolTransaction, Transaction, }, Address, H256, U256, }; -use ethereum_rust_storage::{error::StoreError, Store}; +use ethrex_storage::{error::StoreError, Store}; /// Add a blob transaction and its blobs bundle to the mempool #[cfg(feature = "c-kzg")] @@ -82,7 +82,7 @@ pub fn filter_transactions( return false; } // This is a temporary fix to avoid invalid transactions to be included. - // This should be removed once https://github.com/lambdaclass/ethereum_rust/issues/680 + // This should be removed once https://github.com/lambdaclass/ethrex/issues/680 // is addressed. } else if tx.effective_gas_tip(filter.base_fee).is_none() { return false; @@ -305,12 +305,12 @@ mod tests { }; use super::{transaction_intrinsic_gas, validate_transaction}; - use ethereum_rust_core::types::{ + use ethrex_core::types::{ BlockHeader, ChainConfig, EIP1559Transaction, EIP4844Transaction, Transaction, TxKind, }; - use ethereum_rust_core::{Address, Bytes, H256, U256}; - use ethereum_rust_storage::EngineType; - use ethereum_rust_storage::{error::StoreError, Store}; + use ethrex_core::{Address, Bytes, H256, U256}; + use ethrex_storage::EngineType; + use ethrex_storage::{error::StoreError, Store}; fn setup_storage(config: ChainConfig, header: BlockHeader) -> Result { let store = Store::new("test", EngineType::InMemory)?; diff --git a/crates/blockchain/payload.rs b/crates/blockchain/payload.rs index e6fc48a9cd..a9e841fb86 100644 --- a/crates/blockchain/payload.rs +++ b/crates/blockchain/payload.rs @@ -3,7 +3,7 @@ use std::{ collections::HashMap, }; -use ethereum_rust_core::{ +use ethrex_core::{ types::{ calculate_base_fee_per_blob_gas, calculate_base_fee_per_gas, compute_receipts_root, compute_transactions_root, compute_withdrawals_root, BlobsBundle, Block, BlockBody, @@ -12,9 +12,9 @@ use ethereum_rust_core::{ }, Address, Bloom, Bytes, H256, U256, }; -use ethereum_rust_rlp::encode::RLPEncode; -use ethereum_rust_storage::{error::StoreError, Store}; -use ethereum_rust_vm::{ +use ethrex_rlp::encode::RLPEncode; +use ethrex_storage::{error::StoreError, Store}; +use ethrex_vm::{ beacon_root_contract_call, evm_state, execute_tx, get_state_transitions, process_withdrawals, spec_id, EvmError, EvmState, SpecId, }; @@ -224,7 +224,7 @@ fn fetch_mempool_transactions( context: &mut PayloadBuildContext, ) -> Result<(TransactionQueue, TransactionQueue), ChainError> { let tx_filter = PendingTxFilter { - /*TODO(https://github.com/lambdaclass/ethereum_rust/issues/680): add tip filter */ + /*TODO(https://github.com/lambdaclass/ethrex/issues/680): add tip filter */ base_fee: context.base_fee_per_gas(), blob_fee: Some(context.base_fee_per_blob_gas), ..Default::default() diff --git a/crates/blockchain/smoke_test.rs b/crates/blockchain/smoke_test.rs index f2897b7ff8..c9fbe74982 100644 --- a/crates/blockchain/smoke_test.rs +++ b/crates/blockchain/smoke_test.rs @@ -10,11 +10,11 @@ mod blockchain_integration_test { payload::{build_payload, create_payload, BuildPayloadArgs}, }; - use ethereum_rust_core::{ + use ethrex_core::{ types::{Block, BlockHeader}, H160, H256, }; - use ethereum_rust_storage::{EngineType, Store}; + use ethrex_storage::{EngineType, Store}; #[test] fn test_small_to_long_reorg() { diff --git a/crates/common/Cargo.toml b/crates/common/Cargo.toml index d6949029c5..57523b0057 100644 --- a/crates/common/Cargo.toml +++ b/crates/common/Cargo.toml @@ -1,13 +1,13 @@ [package] -name = "ethereum_rust-core" +name = "ethrex-core" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ethereum_rust-rlp.workspace = true -ethereum_rust-trie = { path = "../storage/trie", default-features = false } +ethrex-rlp.workspace = true +ethrex-trie = { path = "../storage/trie", default-features = false } tinyvec = "1.6.0" ethereum-types.workspace = true @@ -31,7 +31,7 @@ hex-literal.workspace = true [features] default = ["libmdbx", "c-kzg"] -libmdbx = ["ethereum_rust-trie/libmdbx"] +libmdbx = ["ethrex-trie/libmdbx"] c-kzg = ["dep:c-kzg"] [lib] diff --git a/crates/common/rlp/Cargo.toml b/crates/common/rlp/Cargo.toml index b3737055ba..34c6a9680b 100644 --- a/crates/common/rlp/Cargo.toml +++ b/crates/common/rlp/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ethereum_rust-rlp" +name = "ethrex-rlp" version.workspace = true edition.workspace = true diff --git a/crates/common/rlp/structs.rs b/crates/common/rlp/structs.rs index e497cb26bf..161e443fd7 100644 --- a/crates/common/rlp/structs.rs +++ b/crates/common/rlp/structs.rs @@ -16,9 +16,9 @@ use bytes::Bytes; /// # Examples /// /// ``` -/// # use ethereum_rust_rlp::structs::Decoder; -/// # use ethereum_rust_rlp::error::RLPDecodeError; -/// # use ethereum_rust_rlp::decode::RLPDecode; +/// # use ethrex_rlp::structs::Decoder; +/// # use ethrex_rlp::error::RLPDecodeError; +/// # use ethrex_rlp::decode::RLPDecode; /// #[derive(Debug, PartialEq, Eq)] /// struct Simple { /// pub a: u8, @@ -131,8 +131,8 @@ fn field_decode_error(field_name: &str, err: RLPDecodeError) -> RLPDecodeErro /// # Examples /// /// ``` -/// # use ethereum_rust_rlp::structs::Encoder; -/// # use ethereum_rust_rlp::encode::RLPEncode; +/// # use ethrex_rlp::structs::Encoder; +/// # use ethrex_rlp::encode::RLPEncode; /// # use bytes::BufMut; /// #[derive(Debug, PartialEq, Eq)] /// struct Simple { diff --git a/crates/common/types/account.rs b/crates/common/types/account.rs index 5b49108357..378419199e 100644 --- a/crates/common/types/account.rs +++ b/crates/common/types/account.rs @@ -1,12 +1,12 @@ use std::collections::HashMap; use bytes::Bytes; -use ethereum_rust_trie::Trie; use ethereum_types::{H256, U256}; +use ethrex_trie::Trie; use serde::{Deserialize, Serialize}; use sha3::{Digest as _, Keccak256}; -use ethereum_rust_rlp::{ +use ethrex_rlp::{ constants::RLP_NULL, decode::RLPDecode, encode::RLPEncode, diff --git a/crates/common/types/blobs_bundle.rs b/crates/common/types/blobs_bundle.rs index 1b6fa0b95f..9748924766 100644 --- a/crates/common/types/blobs_bundle.rs +++ b/crates/common/types/blobs_bundle.rs @@ -11,7 +11,7 @@ use crate::{ #[cfg(feature = "c-kzg")] use c_kzg::{ethereum_kzg_settings, KzgCommitment, KzgProof, KzgSettings}; -use ethereum_rust_rlp::{ +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError, diff --git a/crates/common/types/block.rs b/crates/common/types/block.rs index ba62613141..bbd2acd3b4 100644 --- a/crates/common/types/block.rs +++ b/crates/common/types/block.rs @@ -7,14 +7,14 @@ use crate::{ Address, H256, U256, }; use bytes::Bytes; -use ethereum_rust_rlp::{ +use ethereum_types::Bloom; +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError, structs::{Decoder, Encoder}, }; -use ethereum_rust_trie::Trie; -use ethereum_types::Bloom; +use ethrex_trie::Trie; use keccak_hash::keccak; use serde::{Deserialize, Serialize}; diff --git a/crates/common/types/fork_id.rs b/crates/common/types/fork_id.rs index a44795b356..25681cc876 100644 --- a/crates/common/types/fork_id.rs +++ b/crates/common/types/fork_id.rs @@ -1,5 +1,5 @@ use crc32fast::Hasher; -use ethereum_rust_rlp::{ +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError, diff --git a/crates/common/types/genesis.rs b/crates/common/types/genesis.rs index f729f63b1b..21ed59b0ec 100644 --- a/crates/common/types/genesis.rs +++ b/crates/common/types/genesis.rs @@ -1,11 +1,11 @@ use bytes::Bytes; -use ethereum_rust_trie::Trie; use ethereum_types::{Address, Bloom, H256, U256}; +use ethrex_trie::Trie; use serde::{Deserialize, Serialize}; use sha3::{Digest, Keccak256}; use std::collections::HashMap; -use ethereum_rust_rlp::encode::RLPEncode; +use ethrex_rlp::encode::RLPEncode; use super::{ compute_receipts_root, compute_transactions_root, compute_withdrawals_root, AccountState, diff --git a/crates/common/types/receipt.rs b/crates/common/types/receipt.rs index d70d5bad98..e0e8882446 100644 --- a/crates/common/types/receipt.rs +++ b/crates/common/types/receipt.rs @@ -1,11 +1,11 @@ use bytes::Bytes; -use ethereum_rust_rlp::{ +use ethereum_types::{Address, Bloom, BloomInput, H256}; +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError, structs::{Decoder, Encoder}, }; -use ethereum_types::{Address, Bloom, BloomInput, H256}; use serde::{Deserialize, Serialize}; use super::TxType; diff --git a/crates/common/types/transaction.rs b/crates/common/types/transaction.rs index e1ea3fefb1..95fea476f0 100644 --- a/crates/common/types/transaction.rs +++ b/crates/common/types/transaction.rs @@ -9,7 +9,7 @@ use serde::{ser::SerializeStruct, Deserialize, Serialize}; pub use serde_impl::{AccessListEntry, GenericTransaction}; use sha3::{Digest, Keccak256}; -use ethereum_rust_rlp::{ +use ethrex_rlp::{ constants::RLP_NULL, decode::{get_rlp_bytes_item_payload, is_encoded_as_bytes, RLPDecode}, encode::{PayloadRLPEncode, RLPEncode}, diff --git a/crates/l2/Cargo.toml b/crates/l2/Cargo.toml index 87c0eed7f8..7e7766a1f2 100644 --- a/crates/l2/Cargo.toml +++ b/crates/l2/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ethereum_rust-l2" +name = "ethrex-l2" version = "0.1.0" edition = "2021" @@ -13,13 +13,13 @@ tracing.workspace = true serde.workspace = true serde_json.workspace = true ethereum-types.workspace = true -ethereum_rust-core.workspace = true -ethereum_rust-rlp.workspace = true -ethereum_rust-rpc.workspace = true -ethereum_rust-blockchain.workspace = true -ethereum_rust-storage.workspace = true -ethereum_rust-vm.workspace = true -ethereum_rust-dev = { path = "../../crates/blockchain/dev" } +ethrex-core.workspace = true +ethrex-rlp.workspace = true +ethrex-rpc.workspace = true +ethrex-blockchain.workspace = true +ethrex-storage.workspace = true +ethrex-vm.workspace = true +ethrex-dev = { path = "../../crates/blockchain/dev" } hex.workspace = true bytes.workspace = true jsonwebtoken.workspace = true @@ -33,7 +33,7 @@ sha2 = "0.10.8" risc0-zkvm = { version = "1.1.2" } [dev-dependencies] -ethereum_rust-sdk = { path = "./sdk" } +ethrex-sdk = { path = "./sdk" } rand = "0.8.5" diff --git a/crates/l2/Dockerfile b/crates/l2/Dockerfile index 6aae7e37c7..52da2edadb 100644 --- a/crates/l2/Dockerfile +++ b/crates/l2/Dockerfile @@ -9,7 +9,7 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* RUN cargo install cargo-chef -WORKDIR /ethereum_rust +WORKDIR /ethrex FROM chef AS planner COPY . . @@ -17,7 +17,7 @@ COPY . . RUN cargo chef prepare --recipe-path recipe.json FROM chef AS builder -COPY --from=planner /ethereum_rust/recipe.json recipe.json +COPY --from=planner /ethrex/recipe.json recipe.json # Build dependencies only, these remained cached RUN cargo chef cook --release --recipe-path recipe.json @@ -27,6 +27,6 @@ RUN cargo build --release --features l2 FROM ubuntu:24.04 WORKDIR /usr/local/bin -COPY --from=builder ethereum_rust/target/release/ethereum_rust . +COPY --from=builder ethrex/target/release/ethrex . EXPOSE 1729 -ENTRYPOINT [ "./ethereum_rust" ] +ENTRYPOINT [ "./ethrex" ] diff --git a/crates/l2/Makefile b/crates/l2/Makefile index 6e5ac1ea35..54f011bd1e 100644 --- a/crates/l2/Makefile +++ b/crates/l2/Makefile @@ -17,21 +17,21 @@ clean: clean-contract-deps ## ๐Ÿงน Cleans the localnet restart: restart-local-l1 deploy-l1 restart-l2 ## ๐Ÿ”„ Restarts the localnet cli: ## ๐Ÿ› ๏ธ Installs the L2 Lambda ethrex CLI - cargo install --path ${ETHEREUM_RUST_PATH}/cmd/ethereum_rust_l2/ --force + cargo install --path ${ethrex_PATH}/cmd/ethrex_l2/ --force # Variables -ETHEREUM_RUST_PATH=$(shell pwd)/../.. -ETHEREUM_RUST_BIN_PATH=$(ETHEREUM_RUST_PATH)/target/release/ethereum_rust -ETHEREUM_RUST_DEV_DOCKER_COMPOSE_PATH=$(ETHEREUM_RUST_PATH)/crates/blockchain/dev/docker-compose-dev.yaml -ETHEREUM_RUST_L2_DOCKER_COMPOSE_PATH=./docker-compose-l2.yaml +ethrex_PATH=$(shell pwd)/../.. +ethrex_BIN_PATH=$(ethrex_PATH)/target/release/ethrex +ethrex_DEV_DOCKER_COMPOSE_PATH=$(ethrex_PATH)/crates/blockchain/dev/docker-compose-dev.yaml +ethrex_L2_DOCKER_COMPOSE_PATH=./docker-compose-l2.yaml -ETHEREUM_RUST_L2_CONTRACTS_PATH=./contracts +ethrex_L2_CONTRACTS_PATH=./contracts L1_RPC_URL=http://localhost:8545 L1_PRIVATE_KEY=0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b74924 -ETHEREUM_RUST_L2_DEV_LIBMDBX=dev_ethereum_rust_l2 -ETHEREUM_RUST_L1_DEV_LIBMDBX=dev_ethereum_rust_l1 +ethrex_L2_DEV_LIBMDBX=dev_ethrex_l2 +ethrex_L1_DEV_LIBMDBX=dev_ethrex_l1 L1_PORT=8545 L2_PORT=1729 L1_AUTH_PORT=8551 @@ -41,24 +41,24 @@ L2_AUTH_PORT=8552 # Local L1 init-local-l1: ## ๐Ÿš€ Initializes an L1 Lambda ethrex Client with Docker (Used with make init) - docker compose -f ${ETHEREUM_RUST_DEV_DOCKER_COMPOSE_PATH} up -d - + docker compose -f ${ethrex_DEV_DOCKER_COMPOSE_PATH} up -d + init-l1: ## ๐Ÿš€ Initializes an L1 Lambda ethrex Client - cargo run --release --manifest-path ../../Cargo.toml --bin ethereum_rust --features dev -- \ + cargo run --release --manifest-path ../../Cargo.toml --bin ethrex --features dev -- \ --network ${L1_GENESIS_FILE_PATH} \ --http.port ${L1_PORT} \ --http.addr 0.0.0.0 \ --authrpc.port ${L1_AUTH_PORT} \ - --datadir ${ETHEREUM_RUST_L1_DEV_LIBMDBX} + --datadir ${ethrex_L1_DEV_LIBMDBX} down-local-l1: ## ๐Ÿ›‘ Shuts down the L1 Lambda ethrex Client - docker compose -f ${ETHEREUM_RUST_DEV_DOCKER_COMPOSE_PATH} down + docker compose -f ${ethrex_DEV_DOCKER_COMPOSE_PATH} down docker compose -f docker-compose-l2.yaml down restart-local-l1: down-local-l1 init-local-l1 ## ๐Ÿ”„ Restarts the L1 Lambda ethrex Client rm_dev_libmdbx_l1: ## ๐Ÿ›‘ Removes the Libmdbx DB used by the L1 - cargo run --release --manifest-path ../../Cargo.toml --bin ethereum_rust -- removedb --datadir ${ETHEREUM_RUST_L1_DEV_LIBMDBX} + cargo run --release --manifest-path ../../Cargo.toml --bin ethrex -- removedb --datadir ${ethrex_L1_DEV_LIBMDBX} # Contracts @@ -69,37 +69,37 @@ clean-contract-deps: ## ๐Ÿงน Cleans the dependencies for the L1 contracts. restart-contract-deps: clean-contract-deps ## ๐Ÿ”„ Restarts the dependencies for the L1 contracts. deploy-l1: ## ๐Ÿ“œ Deploys the L1 contracts - DEPLOYER_CONTRACTS_PATH=contracts cargo run --release --bin ethereum_rust_l2_l1_deployer --manifest-path ${ETHEREUM_RUST_L2_CONTRACTS_PATH}/Cargo.toml + DEPLOYER_CONTRACTS_PATH=contracts cargo run --release --bin ethrex_l2_l1_deployer --manifest-path ${ethrex_L2_CONTRACTS_PATH}/Cargo.toml # L2 init-l2: ## ๐Ÿš€ Initializes an L2 Lambda ethrex Client - cargo run --release --manifest-path ../../Cargo.toml --bin ethereum_rust --features l2 -- \ + cargo run --release --manifest-path ../../Cargo.toml --bin ethrex --features l2 -- \ --network ${L2_GENESIS_FILE_PATH} \ --http.port ${L2_PORT} \ --http.addr 0.0.0.0 \ --authrpc.port ${L2_AUTH_PORT} \ - --datadir ${ETHEREUM_RUST_L2_DEV_LIBMDBX} + --datadir ${ethrex_L2_DEV_LIBMDBX} down-l2: ## ๐Ÿ›‘ Shuts down the L2 Lambda ethrex Client - pkill -f ethereum_rust || exit 0 + pkill -f ethrex || exit 0 restart-l2: down-l2 init-l2 ## ๐Ÿ”„ Restarts the L2 Lambda ethrex Client init-l2-prover: ## ๐Ÿš€ Initializes the Prover - cargo run --release --features build_zkvm --manifest-path ../../Cargo.toml --bin ethereum_rust_prover + cargo run --release --features build_zkvm --manifest-path ../../Cargo.toml --bin ethrex_prover init-l2-prover-gpu: ## ๐Ÿš€ Initializes the Prover with GPU support - cargo run --release --features "build_zkvm,gpu" --manifest-path ../../Cargo.toml --bin ethereum_rust_prover + cargo run --release --features "build_zkvm,gpu" --manifest-path ../../Cargo.toml --bin ethrex_prover rm_dev_libmdbx_l2: ## ๐Ÿ›‘ Removes the Libmdbx DB used by the L2 - cargo run --release --manifest-path ../../Cargo.toml --bin ethereum_rust -- removedb --datadir ${ETHEREUM_RUST_L2_DEV_LIBMDBX} + cargo run --release --manifest-path ../../Cargo.toml --bin ethrex -- removedb --datadir ${ethrex_L2_DEV_LIBMDBX} # CI Testing test: - docker compose -f ${ETHEREUM_RUST_L2_DOCKER_COMPOSE_PATH} down - docker compose -f ${ETHEREUM_RUST_L2_DOCKER_COMPOSE_PATH} up -d --build + docker compose -f ${ethrex_L2_DOCKER_COMPOSE_PATH} down + docker compose -f ${ethrex_L2_DOCKER_COMPOSE_PATH} up -d --build BRIDGE_ADDRESS=$$(grep 'L1_WATCHER_BRIDGE_ADDRESS' .env | cut -d= -f2) ON_CHAIN_PROPOSER_ADDRESS=$$(grep 'COMMITTER_ON_CHAIN_PROPOSER_ADDRESS' .env | cut -d= -f2) cargo test --release testito -- --nocapture - docker compose -f ${ETHEREUM_RUST_L2_DOCKER_COMPOSE_PATH} down + docker compose -f ${ethrex_L2_DOCKER_COMPOSE_PATH} down diff --git a/crates/l2/contracts/Cargo.toml b/crates/l2/contracts/Cargo.toml index 76df9717f9..ea5a655107 100644 --- a/crates/l2/contracts/Cargo.toml +++ b/crates/l2/contracts/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ethereum_rust_l2-deployer" +name = "ethrex_l2-deployer" version = "0.1.0" edition = "2021" @@ -17,9 +17,9 @@ colored = "2.1.0" lazy_static = "1.5.0" tracing.workspace = true -ethereum_rust-l2 = { path = "../../l2" } -ethereum_rust-core = { path = "../../common" } +ethrex-l2 = { path = "../../l2" } +ethrex-core = { path = "../../common" } [[bin]] -name = "ethereum_rust_l2_l1_deployer" +name = "ethrex_l2_l1_deployer" path = "./deployer.rs" diff --git a/crates/l2/contracts/Dockerfile b/crates/l2/contracts/Dockerfile index 2334fd52be..d743f0d2ea 100644 --- a/crates/l2/contracts/Dockerfile +++ b/crates/l2/contracts/Dockerfile @@ -9,18 +9,18 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* RUN cargo install cargo-chef -WORKDIR /ethereum_rust +WORKDIR /ethrex FROM chef AS planner COPY . . # Determine the crates that need to be built from dependencies -RUN cargo chef prepare --bin ethereum_rust_l2_l1_deployer --recipe-path recipe.json +RUN cargo chef prepare --bin ethrex_l2_l1_deployer --recipe-path recipe.json FROM chef AS builder -COPY --from=planner /ethereum_rust/recipe.json recipe.json +COPY --from=planner /ethrex/recipe.json recipe.json # Build dependencies only, these remained cached -RUN cargo chef cook --release --recipe-path recipe.json --manifest-path crates/l2/contracts/Cargo.toml --bin ethereum_rust_l2_l1_deployer +RUN cargo chef cook --release --recipe-path recipe.json --manifest-path crates/l2/contracts/Cargo.toml --bin ethrex_l2_l1_deployer COPY . . RUN cargo build --release --manifest-path crates/l2/contracts/Cargo.toml @@ -32,7 +32,7 @@ RUN apt-get update && apt-get -y install git gnupg software-properties-common RUN add-apt-repository ppa:ethereum/ethereum RUN apt-get update && apt-get -y install solc -COPY --from=builder ethereum_rust/target/release/ethereum_rust_l2_l1_deployer . +COPY --from=builder ethrex/target/release/ethrex_l2_l1_deployer . EXPOSE 1729 -ENTRYPOINT [ "./ethereum_rust_l2_l1_deployer" ] +ENTRYPOINT [ "./ethrex_l2_l1_deployer" ] diff --git a/crates/l2/contracts/deployer.rs b/crates/l2/contracts/deployer.rs index 602bd21b39..66de5adf3b 100644 --- a/crates/l2/contracts/deployer.rs +++ b/crates/l2/contracts/deployer.rs @@ -1,11 +1,11 @@ use bytes::Bytes; use colored::Colorize; -use ethereum_rust_core::types::{GAS_LIMIT_ADJUSTMENT_FACTOR, GAS_LIMIT_MINIMUM}; -use ethereum_rust_l2::utils::{ +use ethereum_types::{Address, H160, H256}; +use ethrex_core::types::{GAS_LIMIT_ADJUSTMENT_FACTOR, GAS_LIMIT_MINIMUM}; +use ethrex_l2::utils::{ config::{read_env_as_lines, read_env_file, write_env}, eth_client::{eth_sender::Overrides, EthClient}, }; -use ethereum_types::{Address, H160, H256}; use keccak_hash::keccak; use secp256k1::SecretKey; use spinoff::{spinner, spinners, Color, Spinner}; diff --git a/crates/l2/docker-compose-l2.yaml b/crates/l2/docker-compose-l2.yaml index a434e3ab3e..a0871823cf 100644 --- a/crates/l2/docker-compose-l2.yaml +++ b/crates/l2/docker-compose-l2.yaml @@ -5,7 +5,7 @@ services: contract_deployer: platform: linux/amd64 container_name: contract_deployer - image: ethereum_rust_l2_contract_deployer + image: ethrex_l2_contract_deployer build: context: ../../ args: @@ -17,17 +17,17 @@ services: env_file: - .env environment: - - ETH_RPC_URL=http://ethereum_rust_l1:8545 + - ETH_RPC_URL=http://ethrex_l1:8545 - DEPLOYER_CONTRACTS_PATH=/contracts - ENV_FILE=/.env depends_on: - - ethereum_rust + - ethrex restart: on-failure:3 - ethereum_rust_l2: + ethrex_l2: restart: always - container_name: ethereum_rust_l2 - image: "ethereum_rust_l2" + container_name: ethrex_l2 + image: "ethrex_l2" build: context: ../../ dockerfile: ./crates/l2/Dockerfile @@ -35,7 +35,7 @@ services: - 127.0.0.1:1729:1729 - 3000:3000 environment: - - ETH_RPC_URL=http://ethereum_rust_l1:8545 + - ETH_RPC_URL=http://ethrex_l1:8545 - ENV_FILE=/.env volumes: - ../../test_data/genesis-l2.json:/genesis-l2.json diff --git a/crates/l2/docs/README.md b/crates/l2/docs/README.md index 9ff7918c21..d92f09df69 100644 --- a/crates/l2/docs/README.md +++ b/crates/l2/docs/README.md @@ -19,7 +19,7 @@ Configuration is done through env vars. A detailed list is available in each par Load tests are available via L2 CLI. The test take a list of private keys and send a bunch of transactions from each of them to some address. To run them, use the following command: ```bash -cargo run --bin ethereum_rust_l2 -- test load --path +cargo run --bin ethrex_l2 -- test load --path ``` The path should point to a plain text file containing a list of private keys, one per line. Those account must be funded on the L2 network. Use `--help` to see more available options. diff --git a/crates/l2/docs/overview.md b/crates/l2/docs/overview.md index 706e7fda5a..47bb2bdf0a 100644 --- a/crates/l2/docs/overview.md +++ b/crates/l2/docs/overview.md @@ -23,7 +23,7 @@ Below some answers to these questions, along with an overview of all the moving Now that general purpose `zkVM`s exist, most people have little trouble with the idea that you can prove execution. Just take the usual EVM code you wrote in Rust, compile to some `zkVM` target instead and you're mostly done. You can now prove it. -What's usually less clear is how you prove state. Let's say we want to prove a new L2 block that was just built. Running the `ethereum_rust` `execute_block` function on a Rust `zkVM` does the trick, but that only proves that you ran the VM correctly on **some** previous state/block. How do you know it was the actual previous state of the L2 and not some other, modified one? +What's usually less clear is how you prove state. Let's say we want to prove a new L2 block that was just built. Running the `ethrex` `execute_block` function on a Rust `zkVM` does the trick, but that only proves that you ran the VM correctly on **some** previous state/block. How do you know it was the actual previous state of the L2 and not some other, modified one? In other words, how do you ensure that: @@ -36,7 +36,7 @@ To solve this, we do what we always do: instead of having the actual previous st The flow for the prover is then roughly as follows: - Take as public input the previous block commitment and the next (output) block commitment. -- Execute the current block to prove its execution is valid. Here "execution" means more than just transaction execution; there's also header validation, transaction validation, etc. (essentially all the logic `ethereum_rust` needs to follow when executing and adding a new block to the chain). +- Execute the current block to prove its execution is valid. Here "execution" means more than just transaction execution; there's also header validation, transaction validation, etc. (essentially all the logic `ethrex` needs to follow when executing and adding a new block to the chain). - For every storage slot read, present and verify a merkle path from it to the previous state root (i.e. previous block commitment). - For every storage slot written, present and verify a merkle path from it to the next state root (i.e. next block commitment). @@ -65,7 +65,7 @@ Detailed documentation on the state diffs spec [here](./state_diffs.md). ### How do we prevent the sequencer from publishing the wrong state diffs? -Once again, state diffs have to be part of the public input. With them, the prover can show that they are equal to the ones returned by the VM after executing the block. As always, the actual state diffs are not part of the public input, but **their hash** is, so the size is a fixed 32 bytes. This hash is then part of the block commitment. The prover then assures us that the given state diff hash is correct (i.e. it exactly corresponds to the changes in state of the executed block). +Once again, state diffs have to be part of the public input. With them, the prover can show that they are equal to the ones returned by the VM after executing the block. As always, the actual state diffs are not part of the public input, but **their hash** is, so the size is a fixed 32 bytes. This hash is then part of the block commitment. The prover then assures us that the given state diff hash is correct (i.e. it exactly corresponds to the changes in state of the executed block). There's still a problem however: the L1 contract needs to have the actual state diff for data availability, not just the hash. This is sent as part of calldata of the `commit` transaction (actually later as a blob, we'll get to that), so the sequencer could in theory send the wrong state diff. To make sure this can't happen, the L1 contract hashes it to make sure that it matches the actual state diff hash that is included as part of the public input. @@ -85,7 +85,7 @@ This is important. If you recall, the way the L1 ensured that the state diff pub The solution is through a [proof of equivalence](https://ethresear.ch/t/easy-proof-of-equivalence-between-multiple-polynomial-commitment-schemes-to-the-same-data/8188) between polynomial commitment schemes. The idea is as follows: proofs of equivalence allow you to show that two (polynomial) commitments point to the same underlying data. In our case, we have two commitments: -- The state diff commitment calculated by the sequencer/prover. +- The state diff commitment calculated by the sequencer/prover. - The KZG commitment of the blob sent on the commit transaction (recall that the blob should just be the state diff). If we turn the first one into a polynomial commitment, we can take a random evaluation point through Fiat Shamir and prove that it evaluates to the same value as the KZG blob commitment at that point. The `commit` transaction then sends the blob commitment and, through the point evaluation precompile, verifies that the given blob evaluates to that same value. If it does, the underlying blob is indeed the correct state diff. diff --git a/crates/l2/docs/prover.md b/crates/l2/docs/prover.md index 3b9f889dc0..35d70a117d 100644 --- a/crates/l2/docs/prover.md +++ b/crates/l2/docs/prover.md @@ -20,7 +20,7 @@ ## What -The prover consists of two main components: handling incoming proving data from the `L2 proposer`, specifically the `prover_server` component, and the `zkVM`. The `prover_client` is responsible for this first part, while the `zkVM` serves as a RISC-V emulator executing code specified in `crates/l2/prover/zkvm/interface/guest/src`. +The prover consists of two main components: handling incoming proving data from the `L2 proposer`, specifically the `prover_server` component, and the `zkVM`. The `prover_client` is responsible for this first part, while the `zkVM` serves as a RISC-V emulator executing code specified in `crates/l2/prover/zkvm/interface/guest/src`. Before the `zkVM` code (or guest), there is a directory called `interface`, which indicates that we access the `zkVM` through the "interface" crate. In summary, the `prover_client` manages the inputs from the `prover_server` and then "calls" the `zkVM` to perform the proving process and generate the `groth16` ZK proof. @@ -116,7 +116,7 @@ make perf_gpu Two servers are required: one for the `prover` and another for the `proposer`. If you run both components on the same machine, the `prover` may consume all available resources, leading to potential stuttering or performance issues for the `proposer`/`node`. 1. `prover`/`zkvm` → prover with gpu, make sure to have all the required dependencies described at the beginning of [Gpu Mode](#gpu-mode) section. - 1. `cd lambda_ethereum_rust/crates/l2` + 1. `cd lambda_ethrex/crates/l2` 2. `cp .example.env` and change the `PROVER_CLIENT_PROVER_SERVER_ENDPOINT` with the ip of the other server. The env variables needed are: @@ -131,7 +131,7 @@ Finally, to start the `prover_client`/`zkvm`, run: - `make init-l2-prover-gpu` 2. ย `proposer` → this server just needs rust installed. - 1. `cd lambda_ethereum_rust/crates/l2` + 1. `cd lambda_ethrex/crates/l2` 2. `cp .example.env` and change the addresses and the following fields: - `PROVER_SERVER_LISTEN_IP=0.0.0.0`ย → used to handle the tcp communication with the other server. - The `COMMITTER` and `PROVER_SERVER_VERIFIER` must be different accounts, the `DEPLOYER_ADDRESS` as well as the `L1_WATCHER` may be the same account used by the `COMMITTER` diff --git a/crates/l2/proposer/errors.rs b/crates/l2/proposer/errors.rs index cde973838a..bf469f701d 100644 --- a/crates/l2/proposer/errors.rs +++ b/crates/l2/proposer/errors.rs @@ -1,9 +1,9 @@ use crate::utils::{config::errors::ConfigError, eth_client::errors::EthClientError}; -use ethereum_rust_core::types::BlobsBundleError; -use ethereum_rust_dev::utils::engine_client::errors::EngineClientError; -use ethereum_rust_storage::error::StoreError; -use ethereum_rust_vm::EvmError; use ethereum_types::FromStrRadixErr; +use ethrex_core::types::BlobsBundleError; +use ethrex_dev::utils::engine_client::errors::EngineClientError; +use ethrex_storage::error::StoreError; +use ethrex_vm::EvmError; #[derive(Debug, thiserror::Error)] pub enum L1WatcherError { diff --git a/crates/l2/proposer/l1_committer.rs b/crates/l2/proposer/l1_committer.rs index a42c4ea086..a07eb7d187 100644 --- a/crates/l2/proposer/l1_committer.rs +++ b/crates/l2/proposer/l1_committer.rs @@ -10,17 +10,17 @@ use crate::{ }, }; use bytes::Bytes; -use ethereum_rust_blockchain::constants::TX_GAS_COST; -use ethereum_rust_core::{ +use ethrex_blockchain::constants::TX_GAS_COST; +use ethrex_core::{ types::{ blobs_bundle, BlobsBundle, Block, EIP1559Transaction, GenericTransaction, PrivilegedL2Transaction, PrivilegedTxType, Transaction, TxKind, }, Address, H256, U256, }; -use ethereum_rust_rpc::types::transaction::WrappedEIP4844Transaction; -use ethereum_rust_storage::Store; -use ethereum_rust_vm::{evm_state, execute_block, get_state_transitions}; +use ethrex_rpc::types::transaction::WrappedEIP4844Transaction; +use ethrex_storage::Store; +use ethrex_vm::{evm_state, execute_block, get_state_transitions}; use keccak_hash::keccak; use secp256k1::SecretKey; use sha2::{Digest, Sha256}; diff --git a/crates/l2/proposer/l1_watcher.rs b/crates/l2/proposer/l1_watcher.rs index ed3aaa8fe5..1bfdef6bec 100644 --- a/crates/l2/proposer/l1_watcher.rs +++ b/crates/l2/proposer/l1_watcher.rs @@ -6,12 +6,12 @@ use crate::{ }, }; use bytes::Bytes; -use ethereum_rust_blockchain::{constants::TX_GAS_COST, mempool}; -use ethereum_rust_core::types::PrivilegedTxType; -use ethereum_rust_core::types::{Signable, Transaction}; -use ethereum_rust_rpc::types::receipt::RpcLog; -use ethereum_rust_storage::Store; use ethereum_types::{Address, BigEndianHash, H256, U256}; +use ethrex_blockchain::{constants::TX_GAS_COST, mempool}; +use ethrex_core::types::PrivilegedTxType; +use ethrex_core::types::{Signable, Transaction}; +use ethrex_rpc::types::receipt::RpcLog; +use ethrex_storage::Store; use secp256k1::SecretKey; use std::{cmp::min, ops::Mul, time::Duration}; use tokio::time::sleep; diff --git a/crates/l2/proposer/mod.rs b/crates/l2/proposer/mod.rs index e146eaeb74..5c6c435c93 100644 --- a/crates/l2/proposer/mod.rs +++ b/crates/l2/proposer/mod.rs @@ -1,8 +1,8 @@ use crate::utils::config::{proposer::ProposerConfig, read_env_file}; use errors::ProposerError; -use ethereum_rust_dev::utils::engine_client::{config::EngineApiConfig, errors::EngineClientError}; -use ethereum_rust_storage::Store; use ethereum_types::{Address, H256}; +use ethrex_dev::utils::engine_client::{config::EngineApiConfig, errors::EngineClientError}; +use ethrex_storage::Store; use tracing::{info, warn}; pub mod l1_committer; @@ -64,7 +64,7 @@ impl Proposer { } pub async fn start(&self, head_block_hash: H256) -> Result<(), ProposerError> { - ethereum_rust_dev::block_producer::start_block_producer( + ethrex_dev::block_producer::start_block_producer( self.engine_config.rpc_url.clone(), std::fs::read(&self.engine_config.jwt_path).unwrap().into(), head_block_hash, diff --git a/crates/l2/proposer/prover_server.rs b/crates/l2/proposer/prover_server.rs index 0190dd7ef4..f69b76ee26 100644 --- a/crates/l2/proposer/prover_server.rs +++ b/crates/l2/proposer/prover_server.rs @@ -1,5 +1,5 @@ -use ethereum_rust_storage::Store; -use ethereum_rust_vm::execution_db::ExecutionDB; +use ethrex_storage::Store; +use ethrex_vm::execution_db::ExecutionDB; use keccak_hash::keccak; use secp256k1::SecretKey; use serde::{Deserialize, Serialize}; @@ -16,7 +16,7 @@ use tokio::{ }; use tracing::{debug, error, info, warn}; -use ethereum_rust_core::{ +use ethrex_core::{ types::{Block, BlockHeader, EIP1559Transaction}, Address, H256, }; diff --git a/crates/l2/prover/Cargo.toml b/crates/l2/prover/Cargo.toml index 3c93e46b59..e3274f200b 100644 --- a/crates/l2/prover/Cargo.toml +++ b/crates/l2/prover/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ethereum_rust-prover" +name = "ethrex-prover" version.workspace = true edition.workspace = true @@ -14,19 +14,19 @@ tracing-subscriber = { workspace = true, features = ["env-filter"] } tracing.workspace = true hex.workspace = true -# ethereum_rust -ethereum_rust-core.workspace = true -ethereum_rust-vm.workspace = true -ethereum_rust-rlp.workspace = true +# ethrex +ethrex-core.workspace = true +ethrex-vm.workspace = true +ethrex-rlp.workspace = true # l2 -ethereum_rust-l2.workspace = true +ethrex-l2.workspace = true # risc0 zkvm_interface = { path = "./zkvm/interface", default-features = false } risc0-zkvm = { version = "1.1.2" } -# revm (this dep is temporary, should be replaced with ethereum_rust-vm after ExecutionDB is completely integrated into the L1) +# revm (this dep is temporary, should be replaced with ethrex-vm after ExecutionDB is completely integrated into the L1) revm = { version = "14.0.3", features = [ "std", "serde", @@ -34,16 +34,16 @@ revm = { version = "14.0.3", features = [ ], default-features = false } [dev-dependencies] -ethereum_rust-vm.workspace = true -ethereum_rust-storage.workspace = true -ethereum_rust-blockchain.workspace = true +ethrex-vm.workspace = true +ethrex-storage.workspace = true +ethrex-blockchain.workspace = true [lib] -name = "ethereum_rust_prover_lib" +name = "ethrex_prover_lib" path = "src/lib.rs" [[bin]] -name = "ethereum_rust_prover" +name = "ethrex_prover" path = "src/main.rs" [features] diff --git a/crates/l2/prover/src/lib.rs b/crates/l2/prover/src/lib.rs index 8e81668f6b..ee528391a5 100644 --- a/crates/l2/prover/src/lib.rs +++ b/crates/l2/prover/src/lib.rs @@ -1,7 +1,7 @@ pub mod prover; pub mod prover_client; -use ethereum_rust_l2::utils::config::prover_client::ProverClientConfig; +use ethrex_l2::utils::config::prover_client::ProverClientConfig; use tracing::warn; pub async fn init_client(config: ProverClientConfig) { diff --git a/crates/l2/prover/src/main.rs b/crates/l2/prover/src/main.rs index 403c65d048..7c99f88bb2 100644 --- a/crates/l2/prover/src/main.rs +++ b/crates/l2/prover/src/main.rs @@ -1,5 +1,5 @@ -use ethereum_rust_l2::utils::config::{prover_client::ProverClientConfig, read_env_file}; -use ethereum_rust_prover_lib::init_client; +use ethrex_l2::utils::config::{prover_client::ProverClientConfig, read_env_file}; +use ethrex_prover_lib::init_client; use tracing::{self, debug, warn, Level}; diff --git a/crates/l2/prover/src/prover.rs b/crates/l2/prover/src/prover.rs index 05e8fc90be..45328188d8 100644 --- a/crates/l2/prover/src/prover.rs +++ b/crates/l2/prover/src/prover.rs @@ -6,12 +6,12 @@ use zkvm_interface::methods::{ZKVM_PROGRAM_ELF, ZKVM_PROGRAM_ID}; use risc0_zkvm::{default_prover, ExecutorEnv, ExecutorEnvBuilder, ProverOpts}; -use ethereum_rust_core::types::Receipt; -use ethereum_rust_l2::{ +use ethrex_core::types::Receipt; +use ethrex_l2::{ proposer::prover_server::ProverInputData, utils::config::prover_client::ProverClientConfig, }; -use ethereum_rust_rlp::encode::RLPEncode; -use ethereum_rust_vm::execution_db::ExecutionDB; +use ethrex_rlp::encode::RLPEncode; +use ethrex_vm::execution_db::ExecutionDB; // The order of variables in this structure should match the order in which they were // committed in the zkVM, with each variable represented by a field. diff --git a/crates/l2/prover/src/prover_client.rs b/crates/l2/prover/src/prover_client.rs index 21626b9ac6..8c297109cf 100644 --- a/crates/l2/prover/src/prover_client.rs +++ b/crates/l2/prover/src/prover_client.rs @@ -7,7 +7,7 @@ use std::{ use tokio::time::sleep; use tracing::{debug, error, info, warn}; -use ethereum_rust_l2::{ +use ethrex_l2::{ proposer::prover_server::{ProofData, ProverInputData}, utils::config::prover_client::ProverClientConfig, }; diff --git a/crates/l2/prover/tests/perf_zkvm.rs b/crates/l2/prover/tests/perf_zkvm.rs index b3c83396e8..27299a842b 100644 --- a/crates/l2/prover/tests/perf_zkvm.rs +++ b/crates/l2/prover/tests/perf_zkvm.rs @@ -1,11 +1,11 @@ use std::path::Path; use tracing::info; -use ethereum_rust_blockchain::add_block; -use ethereum_rust_l2::proposer::prover_server::ProverInputData; -use ethereum_rust_prover_lib::prover::Prover; -use ethereum_rust_storage::{EngineType, Store}; -use ethereum_rust_vm::execution_db::ExecutionDB; +use ethrex_blockchain::add_block; +use ethrex_l2::proposer::prover_server::ProverInputData; +use ethrex_prover_lib::prover::Prover; +use ethrex_storage::{EngineType, Store}; +use ethrex_vm::execution_db::ExecutionDB; #[tokio::test] async fn test_performance_zkvm() { @@ -20,13 +20,11 @@ async fn test_performance_zkvm() { let store = Store::new("memory", EngineType::InMemory).expect("Failed to create Store"); - let genesis = ethereum_rust_l2::utils::test_data_io::read_genesis_file( - genesis_file_path.to_str().unwrap(), - ); + let genesis = + ethrex_l2::utils::test_data_io::read_genesis_file(genesis_file_path.to_str().unwrap()); store.add_initial_state(genesis.clone()).unwrap(); - let blocks = - ethereum_rust_l2::utils::test_data_io::read_chain_file(chain_file_path.to_str().unwrap()); + let blocks = ethrex_l2::utils::test_data_io::read_chain_file(chain_file_path.to_str().unwrap()); info!("Number of blocks to insert: {}", blocks.len()); for block in &blocks { diff --git a/crates/l2/prover/zkvm/interface/Cargo.toml b/crates/l2/prover/zkvm/interface/Cargo.toml index 2516c10050..3e89bdf335 100644 --- a/crates/l2/prover/zkvm/interface/Cargo.toml +++ b/crates/l2/prover/zkvm/interface/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" serde = { version = "1.0", default-features = false, features = ["derive"] } thiserror = "1.0.64" -ethereum_rust-storage = { path = "../../../../storage/store" } +ethrex-storage = { path = "../../../../storage/store" } # revm revm = { version = "14.0.3", features = [ diff --git a/crates/l2/prover/zkvm/interface/guest/Cargo.toml b/crates/l2/prover/zkvm/interface/guest/Cargo.toml index 1d1b5616f1..19a0c440ab 100644 --- a/crates/l2/prover/zkvm/interface/guest/Cargo.toml +++ b/crates/l2/prover/zkvm/interface/guest/Cargo.toml @@ -8,10 +8,10 @@ edition = "2021" [dependencies] risc0-zkvm = { version = "1.1.2", default-features = false, features = ["std"] } -ethereum_rust-core = { path = "../../../../../common", default-features = false } -ethereum_rust-rlp = { path = "../../../../../common/rlp" } -ethereum_rust-vm = { path = "../../../../../vm", default-features = false } -ethereum_rust-blockchain = { path = "../../../../../blockchain", default-features = false } +ethrex-core = { path = "../../../../../common", default-features = false } +ethrex-rlp = { path = "../../../../../common/rlp" } +ethrex-vm = { path = "../../../../../vm", default-features = false } +ethrex-blockchain = { path = "../../../../../blockchain", default-features = false } [build-dependencies] ## cc version ^1.1.31 breaks the compilation. diff --git a/crates/l2/prover/zkvm/interface/guest/src/main.rs b/crates/l2/prover/zkvm/interface/guest/src/main.rs index 12f6081345..425729ff7f 100644 --- a/crates/l2/prover/zkvm/interface/guest/src/main.rs +++ b/crates/l2/prover/zkvm/interface/guest/src/main.rs @@ -1,9 +1,9 @@ -use ethereum_rust_rlp::{decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError}; +use ethrex_rlp::{decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError}; use risc0_zkvm::guest::env; -use ethereum_rust_blockchain::{validate_block, validate_gas_used}; -use ethereum_rust_core::types::{Block, BlockHeader}; -use ethereum_rust_vm::{execute_block, execution_db::ExecutionDB, get_state_transitions, EvmState}; +use ethrex_blockchain::{validate_block, validate_gas_used}; +use ethrex_core::types::{Block, BlockHeader}; +use ethrex_vm::{execute_block, execution_db::ExecutionDB, get_state_transitions, EvmState}; fn main() { let (block, execution_db, parent_header) = read_inputs().expect("failed to read inputs"); diff --git a/crates/l2/sdk/Cargo.toml b/crates/l2/sdk/Cargo.toml index 76f61c4a83..c4c937e097 100644 --- a/crates/l2/sdk/Cargo.toml +++ b/crates/l2/sdk/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "ethereum_rust-sdk" +name = "ethrex-sdk" version.workspace = true edition.workspace = true [dependencies] -ethereum_rust-l2.workspace = true -ethereum_rust-core.workspace = true -ethereum_rust-rpc.workspace = true +ethrex-l2.workspace = true +ethrex-core.workspace = true +ethrex-rpc.workspace = true ethereum-types.workspace = true tokio.workspace = true @@ -16,5 +16,5 @@ secp256k1.workspace = true itertools = "0.13.0" [lib] -name = "ethereum_rust_l2_sdk" +name = "ethrex_l2_sdk" path = "src/sdk.rs" diff --git a/crates/l2/sdk/src/sdk.rs b/crates/l2/sdk/src/sdk.rs index 145a9cf477..ee7d472a5e 100644 --- a/crates/l2/sdk/src/sdk.rs +++ b/crates/l2/sdk/src/sdk.rs @@ -1,5 +1,6 @@ -use ethereum_rust_core::types::{PrivilegedTxType, Transaction}; -use ethereum_rust_l2::utils::{ +use ethereum_types::{Address, H160, H256, U256}; +use ethrex_core::types::{PrivilegedTxType, Transaction}; +use ethrex_l2::utils::{ eth_client::{ errors::{EthClientError, GetTransactionReceiptError}, eth_sender::Overrides, @@ -7,8 +8,7 @@ use ethereum_rust_l2::utils::{ }, merkle_tree::merkle_proof, }; -use ethereum_rust_rpc::types::{block::BlockBodyWrapper, receipt::RpcReceipt}; -use ethereum_types::{Address, H160, H256, U256}; +use ethrex_rpc::types::{block::BlockBodyWrapper, receipt::RpcReceipt}; use itertools::Itertools; use keccak_hash::keccak; use secp256k1::SecretKey; diff --git a/crates/l2/tests/tests.rs b/crates/l2/tests/tests.rs index 081f73b390..a4b53931b6 100644 --- a/crates/l2/tests/tests.rs +++ b/crates/l2/tests/tests.rs @@ -1,6 +1,6 @@ use bytes::Bytes; -use ethereum_rust_l2::utils::eth_client::{eth_sender::Overrides, EthClient}; use ethereum_types::{Address, H160, U256}; +use ethrex_l2::utils::eth_client::{eth_sender::Overrides, EthClient}; use keccak_hash::H256; use secp256k1::SecretKey; use std::{str::FromStr, time::Duration}; @@ -59,7 +59,7 @@ async fn testito() { println!("Depositing funds from L1 to L2"); let deposit_value = U256::from(1000000000000000000000u128); - let deposit_tx = ethereum_rust_l2_sdk::deposit( + let deposit_tx = ethrex_l2_sdk::deposit( deposit_value, l1_rich_wallet_address(), l1_rich_wallet_private_key(), @@ -71,7 +71,7 @@ async fn testito() { println!("Waiting for deposit transaction receipt"); let _deposit_tx_receipt = - ethereum_rust_l2_sdk::wait_for_transaction_receipt(deposit_tx, ð_client, 5).await; + ethrex_l2_sdk::wait_for_transaction_receipt(deposit_tx, ð_client, 5).await; // 3. Check balances on L1 and L2 @@ -131,7 +131,7 @@ async fn testito() { .unwrap(); assert!(l2_random_account_initial_balance.is_zero()); let transfer_value = U256::from(10000000000u128); - let transfer_tx = ethereum_rust_l2_sdk::transfer( + let transfer_tx = ethrex_l2_sdk::transfer( transfer_value, l1_rich_wallet_address(), random_account_address, @@ -141,7 +141,7 @@ async fn testito() { .await .unwrap(); let _transfer_tx_receipt = - ethereum_rust_l2_sdk::wait_for_transaction_receipt(transfer_tx, &proposer_client, 30).await; + ethrex_l2_sdk::wait_for_transaction_receipt(transfer_tx, &proposer_client, 30).await; // 5. Check balances on L2 @@ -176,7 +176,7 @@ async fn testito() { println!("Withdrawing funds from L2 to L1"); let withdraw_value = U256::from(100000000000000000000u128); - let withdraw_tx = ethereum_rust_l2_sdk::withdraw( + let withdraw_tx = ethrex_l2_sdk::withdraw( withdraw_value, l1_rich_wallet_address(), l1_rich_wallet_private_key(), @@ -185,7 +185,7 @@ async fn testito() { .await .unwrap(); let withdraw_tx_receipt = - ethereum_rust_l2_sdk::wait_for_transaction_receipt(withdraw_tx, &proposer_client, 30).await; + ethrex_l2_sdk::wait_for_transaction_receipt(withdraw_tx, &proposer_client, 30).await; // 7. Check balances on L1 and L2 @@ -240,7 +240,7 @@ async fn testito() { std::thread::sleep(Duration::from_secs(2)); } - let claim_tx = ethereum_rust_l2_sdk::claim_withdraw( + let claim_tx = ethrex_l2_sdk::claim_withdraw( withdraw_tx, withdraw_value, l1_rich_wallet_address(), @@ -252,7 +252,7 @@ async fn testito() { .unwrap(); let _claim_tx_receipt = - ethereum_rust_l2_sdk::wait_for_transaction_receipt(claim_tx, ð_client, 15).await; + ethrex_l2_sdk::wait_for_transaction_receipt(claim_tx, ð_client, 15).await; // 9. Check balances on L1 and L2 diff --git a/crates/l2/utils/eth_client/errors.rs b/crates/l2/utils/eth_client/errors.rs index baa8853328..99287d03fe 100644 --- a/crates/l2/utils/eth_client/errors.rs +++ b/crates/l2/utils/eth_client/errors.rs @@ -1,4 +1,4 @@ -use ethereum_rust_rpc::utils::RpcRequest; +use ethrex_rpc::utils::RpcRequest; #[derive(Debug, thiserror::Error)] pub enum EthClientError { diff --git a/crates/l2/utils/eth_client/eth_sender.rs b/crates/l2/utils/eth_client/eth_sender.rs index 16969aeb65..e8c38e5d73 100644 --- a/crates/l2/utils/eth_client/eth_sender.rs +++ b/crates/l2/utils/eth_client/eth_sender.rs @@ -3,10 +3,10 @@ use crate::utils::eth_client::{ EthClient, RpcResponse, }; use bytes::Bytes; -use ethereum_rust_core::types::{GenericTransaction, TxKind}; -use ethereum_rust_rlp::encode::RLPEncode; -use ethereum_rust_rpc::utils::{RpcRequest, RpcRequestId}; use ethereum_types::{Address, U256}; +use ethrex_core::types::{GenericTransaction, TxKind}; +use ethrex_rlp::encode::RLPEncode; +use ethrex_rpc::utils::{RpcRequest, RpcRequestId}; use keccak_hash::{keccak, H256}; use secp256k1::SecretKey; use serde_json::json; diff --git a/crates/l2/utils/eth_client/mod.rs b/crates/l2/utils/eth_client/mod.rs index 63e676ebd2..229befe996 100644 --- a/crates/l2/utils/eth_client/mod.rs +++ b/crates/l2/utils/eth_client/mod.rs @@ -6,12 +6,13 @@ use errors::{ GetTransactionReceiptError, SendRawTransactionError, }; use eth_sender::Overrides; -use ethereum_rust_core::types::{ +use ethereum_types::{Address, H256, U256}; +use ethrex_core::types::{ BlobsBundle, EIP1559Transaction, EIP4844Transaction, GenericTransaction, PrivilegedL2Transaction, PrivilegedTxType, Signable, TxKind, TxType, }; -use ethereum_rust_rlp::encode::RLPEncode; -use ethereum_rust_rpc::{ +use ethrex_rlp::encode::RLPEncode; +use ethrex_rpc::{ types::{ block::RpcBlock, receipt::{RpcLog, RpcReceipt}, @@ -19,7 +20,6 @@ use ethereum_rust_rpc::{ }, utils::{RpcErrorResponse, RpcRequest, RpcRequestId, RpcSuccessResponse}, }; -use ethereum_types::{Address, H256, U256}; use keccak_hash::keccak; use reqwest::Client; use secp256k1::SecretKey; @@ -629,15 +629,15 @@ impl EthClient { #[derive(Serialize, Deserialize, Debug)] #[serde(rename_all = "camelCase")] pub struct GetTransactionByHashTransaction { - #[serde(default, with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(default, with = "ethrex_core::serde_utils::u64::hex_str")] pub chain_id: u64, - #[serde(default, with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(default, with = "ethrex_core::serde_utils::u64::hex_str")] pub nonce: u64, - #[serde(default, with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(default, with = "ethrex_core::serde_utils::u64::hex_str")] pub max_priority_fee_per_gas: u64, - #[serde(default, with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(default, with = "ethrex_core::serde_utils::u64::hex_str")] pub max_fee_per_gas: u64, - #[serde(default, with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(default, with = "ethrex_core::serde_utils::u64::hex_str")] pub gas_limit: u64, #[serde(default)] pub to: Address, @@ -651,9 +651,9 @@ pub struct GetTransactionByHashTransaction { pub r#type: TxType, #[serde(default)] pub signature_y_parity: bool, - #[serde(default, with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(default, with = "ethrex_core::serde_utils::u64::hex_str")] pub signature_r: u64, - #[serde(default, with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(default, with = "ethrex_core::serde_utils::u64::hex_str")] pub signature_s: u64, #[serde(default)] pub block_number: U256, @@ -663,6 +663,6 @@ pub struct GetTransactionByHashTransaction { pub from: Address, #[serde(default)] pub hash: H256, - #[serde(default, with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(default, with = "ethrex_core::serde_utils::u64::hex_str")] pub transaction_index: u64, } diff --git a/crates/l2/utils/test_data_io.rs b/crates/l2/utils/test_data_io.rs index dcc7833cac..782b0b7e0c 100644 --- a/crates/l2/utils/test_data_io.rs +++ b/crates/l2/utils/test_data_io.rs @@ -1,6 +1,6 @@ -use ethereum_rust_core::types::{Block, Genesis}; -use ethereum_rust_rlp::{decode::RLPDecode, encode::RLPEncode}; -use ethereum_rust_storage::Store; +use ethrex_core::types::{Block, Genesis}; +use ethrex_rlp::{decode::RLPDecode, encode::RLPEncode}; +use ethrex_storage::Store; use tracing::info; use std::{ @@ -9,13 +9,13 @@ use std::{ path::PathBuf, }; -// From cmd/ethereum_rust +// From cmd/ethrex pub fn read_chain_file(chain_rlp_path: &str) -> Vec { let chain_file = File::open(chain_rlp_path).expect("Failed to open chain rlp file"); _chain_file(chain_file).expect("Failed to decode chain rlp file") } -// From cmd/ethereum_rust +// From cmd/ethrex pub fn read_genesis_file(genesis_file_path: &str) -> Genesis { let genesis_file = std::fs::File::open(genesis_file_path).expect("Failed to open genesis file"); _genesis_file(genesis_file).expect("Failed to decode genesis file") @@ -51,7 +51,7 @@ pub fn generate_rlp( Ok(()) } -// From cmd/ethereum_rust/decode.rs +// From cmd/ethrex/decode.rs fn _chain_file(file: File) -> Result, Box> { let mut chain_rlp_reader = BufReader::new(file); let mut buf = vec![]; @@ -65,7 +65,7 @@ fn _chain_file(file: File) -> Result, Box> { Ok(blocks) } -// From cmd/ethereum_rust/decode.rs +// From cmd/ethrex/decode.rs fn _genesis_file(file: File) -> Result { let genesis_reader = BufReader::new(file); serde_json::from_reader(genesis_reader) diff --git a/crates/networking/p2p/Cargo.toml b/crates/networking/p2p/Cargo.toml index 55661aa8bd..95fd9c7004 100644 --- a/crates/networking/p2p/Cargo.toml +++ b/crates/networking/p2p/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "ethereum_rust-net" +name = "ethrex-net" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ethereum_rust-core.workspace = true -ethereum_rust-rlp.workspace = true -ethereum_rust-storage.workspace = true +ethrex-core.workspace = true +ethrex-rlp.workspace = true +ethrex-storage.workspace = true tracing.workspace = true tokio.workspace = true diff --git a/crates/networking/p2p/README.md b/crates/networking/p2p/README.md index 39030074b7..9a21874169 100644 --- a/crates/networking/p2p/README.md +++ b/crates/networking/p2p/README.md @@ -19,7 +19,7 @@ At startup, the discovery server launches three concurrent tokio tasks: Before starting these tasks, we run a [startup](#startup) process to connect to an array of initial nodes. -Before diving into what each task does, first, we need to understand how we are storing our nodes. Nodes are stored in an in-memory matrix which we call a [Kademlia table](https://github.com/lambdaclass/ethereum_rust/blob/main/crates/net/kademlia.rs#L20-L23), though it isn't really a Kademlia table as we don't thoroughly follow the spec but we take it as a reference, you can read more [here](https://en.wikipedia.org/wiki/Kademlia). This table holds: +Before diving into what each task does, first, we need to understand how we are storing our nodes. Nodes are stored in an in-memory matrix which we call a [Kademlia table](https://github.com/lambdaclass/ethrex/blob/main/crates/net/kademlia.rs#L20-L23), though it isn't really a Kademlia table as we don't thoroughly follow the spec but we take it as a reference, you can read more [here](https://en.wikipedia.org/wiki/Kademlia). This table holds: - Our `node_id`: `node_id`s are derived from the public key. They are the 64 bytes starting from index 1 of the encoded pub key. - A vector of 256 `bucket`s which holds: @@ -46,7 +46,7 @@ Before starting the server, we do a startup where we connect to an array of seed - Inserting them into our table - Pinging them to notify our presence, so they acknowledge us. -This startup is far from being completed. The current state allows us to do basic tests and connections. Later, we want to do a real startup by first trying to connect to those nodes we were previously connected. For that, we'd need to store nodes on the database. If those nodes aren't enough to fill our table, then we also ping some bootnodes, which could be hardcoded or received through the cli. Current issues are opened regarding [startup](https://github.com/lambdaclass/ethereum_rust/issues/398) and [nodes db](https://github.com/lambdaclass/ethereum_rust/issues/454). +This startup is far from being completed. The current state allows us to do basic tests and connections. Later, we want to do a real startup by first trying to connect to those nodes we were previously connected. For that, we'd need to store nodes on the database. If those nodes aren't enough to fill our table, then we also ping some bootnodes, which could be hardcoded or received through the cli. Current issues are opened regarding [startup](https://github.com/lambdaclass/ethrex/issues/398) and [nodes db](https://github.com/lambdaclass/ethrex/issues/454). ### Listen loop @@ -55,8 +55,8 @@ The listen loop handles messages sent to our socket. The spec defines 6 types of - **Ping**: Responds with a `pong` message. If the peer is not in our table we add it, if the corresponding bucket is already filled then we add it as a replacement for that bucket. If it was inserted we send a `ping from our end to get an endpoint proof. - **Pong**: Verifies that the `pong` corresponds to a previously sent `ping`, if so we mark the peer as proven. - **FindNodes**: Responds with a `neighbors` message that contains as many as the 16 closest nodes from the given target. A target is a pubkey provided by the peer in the message. The response can't be sent in one packet as it might exceed the discv4 max packet size. So we split it into different packets. -- **Neighbors**: First we verify that we have sent the corresponding `find_node` message. If so, we receive the peers, store them, and ping them. Also, every [`find_node` request](https://github.com/lambdaclass/ethereum_rust/blob/229ca0b316a79403412a917d04e3b95f579c56c7/crates/net/discv4.rs#L305-L314) may have a [tokio `Sender`](https://docs.rs/tokio/latest/tokio/sync/mpsc/struct.Sender.html) attached, if that is the case, we forward the nodes from the message through the channel. This becomes useful when waiting for a `find_node` response, [something we do in the lookups](https://github.com/lambdaclass/ethereum_rust/blob/229ca0b316a79403412a917d04e3b95f579c56c7/crates/net/net.rs#L517-L570). -- **ENRRequest**: currently not implemented see [here](https://github.com/lambdaclass/ethereum_rust/issues/432). +- **Neighbors**: First we verify that we have sent the corresponding `find_node` message. If so, we receive the peers, store them, and ping them. Also, every [`find_node` request](https://github.com/lambdaclass/ethrex/blob/229ca0b316a79403412a917d04e3b95f579c56c7/crates/net/discv4.rs#L305-L314) may have a [tokio `Sender`](https://docs.rs/tokio/latest/tokio/sync/mpsc/struct.Sender.html) attached, if that is the case, we forward the nodes from the message through the channel. This becomes useful when waiting for a `find_node` response, [something we do in the lookups](https://github.com/lambdaclass/ethrex/blob/229ca0b316a79403412a917d04e3b95f579c56c7/crates/net/net.rs#L517-L570). +- **ENRRequest**: currently not implemented see [here](https://github.com/lambdaclass/ethrex/issues/432). - **ENRResponse**: same as above. ### Re-validations @@ -103,7 +103,7 @@ Finally, here is an example of how you could build a network and see how they co We'll have three nodes: `a`, `b`, and `c`, we'll start `a`, then `b` setting `a` as a bootnode, and finally we'll start `c` with `b` as bootnode we should see that `c` connects to both `a` and `b` and so all the network should be connected. **node a**: -`cargo run --bin ethereum_rust --network test_data/kurtosis.json` +`cargo run --bin ethrex --network test_data/kurtosis.json` We get the `enode` by querying the node_info: `curl http://localhost:8545 \ @@ -115,7 +115,7 @@ We get the `enode` by querying the node_info: We start a new server passing the `node_a` `enode` as bootnodes ```bash -cargo run --bin ethereum_rust --network ./test_data/kurtosis.json --bootnodes=`NODE_A_ENODE` \ +cargo run --bin ethrex --network ./test_data/kurtosis.json --bootnodes=`NODE_A_ENODE` \ --authrpc.port=8552 --http.port=8546 --p2p.port=30305 --discovery.port=3036 ``` @@ -123,7 +123,7 @@ cargo run --bin ethereum_rust --network ./test_data/kurtosis.json --bootnodes=`N Finally, with `node_c` we connect to `node_b`. When the lookup runs, `node_c` should end up connecting to `node_a`: ```bash - cargo run --bin ethereum_rust --network ./test_data/kurtosis.json --bootnodes=`NODE_B_ENODE`" \ + cargo run --bin ethrex --network ./test_data/kurtosis.json --bootnodes=`NODE_B_ENODE`" \ --authrpc.port=8553 --http.port=8547 --p2p.port=30308 --discovery.port=30310 ``` diff --git a/crates/networking/p2p/bootnode.rs b/crates/networking/p2p/bootnode.rs index 0a0bbf2f8c..c4caed177a 100644 --- a/crates/networking/p2p/bootnode.rs +++ b/crates/networking/p2p/bootnode.rs @@ -1,4 +1,4 @@ -use ethereum_rust_core::H512; +use ethrex_core::H512; use std::{net::SocketAddr, num::ParseIntError, str::FromStr}; #[derive(Debug, Clone, PartialEq, Eq, Copy)] @@ -12,7 +12,7 @@ impl FromStr for BootNode { /// Takes a str with the format "enode://nodeID@IPaddress:port" and /// parses it to a BootNode // TODO: fix it to support different UDP and TCP ports, according to - // https://github.com/lambdaclass/lambda_ethereum_rust/issues/905 + // https://github.com/lambdaclass/lambda_ethrex/issues/905 fn from_str(input: &str) -> Result { // TODO: error handling let node_id = H512::from_str(&input[8..136]).expect("Failed to parse node id"); diff --git a/crates/networking/p2p/discv4.rs b/crates/networking/p2p/discv4.rs index 9a76bd5109..692c640661 100644 --- a/crates/networking/p2p/discv4.rs +++ b/crates/networking/p2p/discv4.rs @@ -2,8 +2,8 @@ use std::time::{Duration, SystemTime, UNIX_EPOCH}; use crate::types::{Endpoint, Node, NodeRecord}; use bytes::BufMut; -use ethereum_rust_core::{H256, H512, H520}; -use ethereum_rust_rlp::{ +use ethrex_core::{H256, H512, H520}; +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError, @@ -509,7 +509,7 @@ impl RLPEncode for ENRResponseMessage { mod tests { use super::*; use bytes::Bytes; - use ethereum_rust_core::{H256, H264}; + use ethrex_core::{H256, H264}; use std::fmt::Write; use std::net::IpAddr; use std::num::ParseIntError; diff --git a/crates/networking/p2p/kademlia.rs b/crates/networking/p2p/kademlia.rs index 26578a540e..94b6650012 100644 --- a/crates/networking/p2p/kademlia.rs +++ b/crates/networking/p2p/kademlia.rs @@ -2,7 +2,7 @@ use crate::{ discv4::{time_now_unix, FindNodeRequest}, types::Node, }; -use ethereum_rust_core::{H256, H512, U256}; +use ethrex_core::{H256, H512, U256}; use sha3::{Digest, Keccak256}; use tokio::sync::mpsc::UnboundedSender; diff --git a/crates/networking/p2p/net.rs b/crates/networking/p2p/net.rs index 9b027fa928..540124bbb6 100644 --- a/crates/networking/p2p/net.rs +++ b/crates/networking/p2p/net.rs @@ -10,8 +10,8 @@ use discv4::{ get_expiration, is_expired, time_now_unix, time_since_in_hs, FindNodeMessage, Message, NeighborsMessage, Packet, PingMessage, PongMessage, }; -use ethereum_rust_core::{H256, H512}; -use ethereum_rust_storage::Store; +use ethrex_core::{H256, H512}; +use ethrex_storage::Store; use k256::{ ecdsa::SigningKey, elliptic_curve::{sec1::ToEncodedPoint, PublicKey}, @@ -345,7 +345,7 @@ async fn discovery_startup( ip: bootnode.socket_address.ip(), udp_port: bootnode.socket_address.port(), // TODO: udp port can differ from tcp port. - // see https://github.com/lambdaclass/lambda_ethereum_rust/issues/905 + // see https://github.com/lambdaclass/lambda_ethrex/issues/905 tcp_port: bootnode.socket_address.port(), node_id: bootnode.node_id, }); @@ -844,7 +844,7 @@ pub fn node_id_from_signing_key(signer: &SigningKey) -> H512 { #[cfg(test)] mod tests { use super::*; - use ethereum_rust_storage::EngineType; + use ethrex_storage::EngineType; use kademlia::bucket_number; use rand::rngs::OsRng; use std::{ diff --git a/crates/networking/p2p/rlpx/connection.rs b/crates/networking/p2p/rlpx/connection.rs index b319f09c8c..d988679efe 100644 --- a/crates/networking/p2p/rlpx/connection.rs +++ b/crates/networking/p2p/rlpx/connection.rs @@ -28,9 +28,9 @@ use super::{ utils::{ecdh_xchng, pubkey2id}, }; use aes::cipher::KeyIvInit; -use ethereum_rust_core::{H256, H512}; -use ethereum_rust_rlp::decode::RLPDecode; -use ethereum_rust_storage::Store; +use ethrex_core::{H256, H512}; +use ethrex_rlp::decode::RLPDecode; +use ethrex_storage::Store; use k256::{ ecdsa::{RecoveryId, Signature, SigningKey, VerifyingKey}, PublicKey, SecretKey, @@ -278,7 +278,7 @@ impl RLPxConnection { // We ignore received Pong messages } // Implmenent Status vaidations - // https://github.com/lambdaclass/lambda_ethereum_rust/issues/420 + // https://github.com/lambdaclass/lambda_ethrex/issues/420 Message::Status(_) if !peer_supports_eth => { info!("Received Status"); // TODO: Check peer's status message. diff --git a/crates/networking/p2p/rlpx/error.rs b/crates/networking/p2p/rlpx/error.rs index a3b6efa465..bc8ca31b47 100644 --- a/crates/networking/p2p/rlpx/error.rs +++ b/crates/networking/p2p/rlpx/error.rs @@ -1,5 +1,5 @@ -use ethereum_rust_rlp::error::{RLPDecodeError, RLPEncodeError}; -use ethereum_rust_storage::error::StoreError; +use ethrex_rlp::error::{RLPDecodeError, RLPEncodeError}; +use ethrex_storage::error::StoreError; use thiserror::Error; use tokio::sync::broadcast::error::RecvError; diff --git a/crates/networking/p2p/rlpx/eth/backend.rs b/crates/networking/p2p/rlpx/eth/backend.rs index cc51bd8f2f..718d20057a 100644 --- a/crates/networking/p2p/rlpx/eth/backend.rs +++ b/crates/networking/p2p/rlpx/eth/backend.rs @@ -1,5 +1,5 @@ -use ethereum_rust_core::{types::ForkId, U256}; -use ethereum_rust_storage::Store; +use ethrex_core::{types::ForkId, U256}; +use ethrex_storage::Store; use crate::rlpx::error::RLPxError; diff --git a/crates/networking/p2p/rlpx/eth/blocks.rs b/crates/networking/p2p/rlpx/eth/blocks.rs index 1ec932c0cc..4d50374c06 100644 --- a/crates/networking/p2p/rlpx/eth/blocks.rs +++ b/crates/networking/p2p/rlpx/eth/blocks.rs @@ -3,14 +3,14 @@ use crate::rlpx::{ utils::{snappy_compress, snappy_decompress}, }; use bytes::BufMut; -use ethereum_rust_core::types::{BlockBody, BlockHash, BlockHeader, BlockNumber}; -use ethereum_rust_rlp::{ +use ethrex_core::types::{BlockBody, BlockHash, BlockHeader, BlockNumber}; +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::{RLPDecodeError, RLPEncodeError}, structs::{Decoder, Encoder}, }; -use ethereum_rust_storage::Store; +use ethrex_storage::Store; use tracing::error; pub const HASH_FIRST_BYTE_DECODER: u8 = 160; @@ -303,7 +303,7 @@ impl RLPxMessage for BlockBodies { #[cfg(test)] mod tests { - use ethereum_rust_core::types::BlockHash; + use ethrex_core::types::BlockHash; use crate::rlpx::{ eth::blocks::{BlockBodies, GetBlockBodies, GetBlockHeaders}, diff --git a/crates/networking/p2p/rlpx/eth/receipts.rs b/crates/networking/p2p/rlpx/eth/receipts.rs index 0eae0af0a7..0ec74af352 100644 --- a/crates/networking/p2p/rlpx/eth/receipts.rs +++ b/crates/networking/p2p/rlpx/eth/receipts.rs @@ -3,8 +3,8 @@ use crate::rlpx::{ utils::{snappy_compress, snappy_decompress}, }; use bytes::BufMut; -use ethereum_rust_core::types::{BlockHash, Receipt}; -use ethereum_rust_rlp::{ +use ethrex_core::types::{BlockHash, Receipt}; +use ethrex_rlp::{ error::{RLPDecodeError, RLPEncodeError}, structs::{Decoder, Encoder}, }; @@ -86,7 +86,7 @@ impl RLPxMessage for Receipts { #[cfg(test)] mod tests { - use ethereum_rust_core::types::{BlockHash, Receipt}; + use ethrex_core::types::{BlockHash, Receipt}; use crate::rlpx::{ eth::receipts::{GetReceipts, Receipts}, diff --git a/crates/networking/p2p/rlpx/eth/status.rs b/crates/networking/p2p/rlpx/eth/status.rs index b0e21bbf8e..f39c36dcfd 100644 --- a/crates/networking/p2p/rlpx/eth/status.rs +++ b/crates/networking/p2p/rlpx/eth/status.rs @@ -3,11 +3,11 @@ use crate::rlpx::{ utils::{snappy_compress, snappy_decompress}, }; use bytes::BufMut; -use ethereum_rust_core::{ +use ethrex_core::{ types::{BlockHash, ForkId}, U256, }; -use ethereum_rust_rlp::{ +use ethrex_rlp::{ error::{RLPDecodeError, RLPEncodeError}, structs::{Decoder, Encoder}, }; diff --git a/crates/networking/p2p/rlpx/eth/transactions.rs b/crates/networking/p2p/rlpx/eth/transactions.rs index d40e85dec6..8ad8c627cb 100644 --- a/crates/networking/p2p/rlpx/eth/transactions.rs +++ b/crates/networking/p2p/rlpx/eth/transactions.rs @@ -1,6 +1,6 @@ use bytes::BufMut; -use ethereum_rust_core::{types::Transaction, H256}; -use ethereum_rust_rlp::{ +use ethrex_core::{types::Transaction, H256}; +use ethrex_rlp::{ error::{RLPDecodeError, RLPEncodeError}, structs::{Decoder, Encoder}, }; @@ -218,7 +218,7 @@ impl RLPxMessage for PooledTransactions { #[cfg(test)] mod tests { - use ethereum_rust_core::{types::Transaction, H256}; + use ethrex_core::{types::Transaction, H256}; use crate::rlpx::{ eth::transactions::{GetPooledTransactions, PooledTransactions}, diff --git a/crates/networking/p2p/rlpx/frame.rs b/crates/networking/p2p/rlpx/frame.rs index 0480c5e8d6..f766f8e4d0 100644 --- a/crates/networking/p2p/rlpx/frame.rs +++ b/crates/networking/p2p/rlpx/frame.rs @@ -2,8 +2,8 @@ use aes::{ cipher::{BlockEncrypt as _, KeyInit as _, StreamCipher as _}, Aes256Enc, }; -use ethereum_rust_core::H128; -use ethereum_rust_rlp::encode::RLPEncode as _; +use ethrex_core::H128; +use ethrex_rlp::encode::RLPEncode as _; use sha3::Digest as _; use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; diff --git a/crates/networking/p2p/rlpx/handshake.rs b/crates/networking/p2p/rlpx/handshake.rs index 87caa00388..91ea09d414 100644 --- a/crates/networking/p2p/rlpx/handshake.rs +++ b/crates/networking/p2p/rlpx/handshake.rs @@ -1,7 +1,7 @@ use crate::rlpx::utils::{ecdh_xchng, id2pubkey, kdf, pubkey2id, sha256, sha256_hmac}; use aes::cipher::{KeyIvInit, StreamCipher}; -use ethereum_rust_core::{Signature, H128, H256, H512}; -use ethereum_rust_rlp::{ +use ethrex_core::{Signature, H128, H256, H512}; +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError, @@ -320,7 +320,7 @@ impl RLPDecode for AckMessage { mod tests { use std::str::FromStr; - use ethereum_rust_core::H256; + use ethrex_core::H256; use hex_literal::hex; use k256::SecretKey; diff --git a/crates/networking/p2p/rlpx/message.rs b/crates/networking/p2p/rlpx/message.rs index 6415d74e4c..d44f1b4ca0 100644 --- a/crates/networking/p2p/rlpx/message.rs +++ b/crates/networking/p2p/rlpx/message.rs @@ -1,5 +1,5 @@ use bytes::BufMut; -use ethereum_rust_rlp::error::{RLPDecodeError, RLPEncodeError}; +use ethrex_rlp::error::{RLPDecodeError, RLPEncodeError}; use std::fmt::Display; use super::eth::blocks::{BlockBodies, BlockHeaders, GetBlockBodies, GetBlockHeaders}; @@ -11,7 +11,7 @@ use super::snap::{ StorageRanges, TrieNodes, }; -use ethereum_rust_rlp::encode::RLPEncode; +use ethrex_rlp::encode::RLPEncode; pub trait RLPxMessage: Sized { fn encode(&self, buf: &mut dyn BufMut) -> Result<(), RLPEncodeError>; diff --git a/crates/networking/p2p/rlpx/p2p.rs b/crates/networking/p2p/rlpx/p2p.rs index 70573c021b..fdc752a838 100644 --- a/crates/networking/p2p/rlpx/p2p.rs +++ b/crates/networking/p2p/rlpx/p2p.rs @@ -1,6 +1,6 @@ use bytes::BufMut; -use ethereum_rust_core::H512; -use ethereum_rust_rlp::{ +use ethrex_core::H512; +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::{RLPDecodeError, RLPEncodeError}, diff --git a/crates/networking/p2p/rlpx/snap.rs b/crates/networking/p2p/rlpx/snap.rs index abec6c9f16..2c76437900 100644 --- a/crates/networking/p2p/rlpx/snap.rs +++ b/crates/networking/p2p/rlpx/snap.rs @@ -3,11 +3,11 @@ use super::{ utils::{snappy_compress, snappy_decompress}, }; use bytes::{BufMut, Bytes}; -use ethereum_rust_core::{ +use ethrex_core::{ types::{AccountState, EMPTY_KECCACK_HASH, EMPTY_TRIE_HASH}, H256, U256, }; -use ethereum_rust_rlp::{ +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::{RLPDecodeError, RLPEncodeError}, diff --git a/crates/networking/p2p/rlpx/utils.rs b/crates/networking/p2p/rlpx/utils.rs index 348932401e..6efe31d59d 100644 --- a/crates/networking/p2p/rlpx/utils.rs +++ b/crates/networking/p2p/rlpx/utils.rs @@ -1,5 +1,5 @@ -use ethereum_rust_core::H512; -use ethereum_rust_rlp::error::{RLPDecodeError, RLPEncodeError}; +use ethrex_core::H512; +use ethrex_rlp::error::{RLPDecodeError, RLPEncodeError}; use k256::{ elliptic_curve::sec1::{FromEncodedPoint, ToEncodedPoint}, EncodedPoint, PublicKey, SecretKey, diff --git a/crates/networking/p2p/snap.rs b/crates/networking/p2p/snap.rs index fefd7374b0..4981019547 100644 --- a/crates/networking/p2p/snap.rs +++ b/crates/networking/p2p/snap.rs @@ -1,6 +1,6 @@ use bytes::Bytes; -use ethereum_rust_rlp::encode::RLPEncode; -use ethereum_rust_storage::{error::StoreError, Store}; +use ethrex_rlp::encode::RLPEncode; +use ethrex_storage::{error::StoreError, Store}; use crate::rlpx::{ error::RLPxError, @@ -157,9 +157,9 @@ pub fn process_trie_nodes_request( mod tests { use std::str::FromStr; - use ethereum_rust_core::{types::AccountState, BigEndianHash, H256}; - use ethereum_rust_rlp::{decode::RLPDecode, encode::RLPEncode}; - use ethereum_rust_storage::EngineType; + use ethrex_core::{types::AccountState, BigEndianHash, H256}; + use ethrex_rlp::{decode::RLPDecode, encode::RLPEncode}; + use ethrex_storage::EngineType; use crate::rlpx::snap::AccountStateSlim; diff --git a/crates/networking/p2p/types.rs b/crates/networking/p2p/types.rs index c44397a631..583f943a91 100644 --- a/crates/networking/p2p/types.rs +++ b/crates/networking/p2p/types.rs @@ -1,6 +1,6 @@ use bytes::{BufMut, Bytes}; -use ethereum_rust_core::H512; -use ethereum_rust_rlp::{ +use ethrex_core::H512; +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError, diff --git a/crates/networking/rpc/Cargo.toml b/crates/networking/rpc/Cargo.toml index f461c4033c..a694b8243e 100644 --- a/crates/networking/rpc/Cargo.toml +++ b/crates/networking/rpc/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "ethereum_rust-rpc" +name = "ethrex-rpc" version = "0.1.0" edition = "2021" @@ -13,12 +13,12 @@ tokio.workspace = true bytes.workspace = true tracing.workspace = true tracing-subscriber.workspace = true -ethereum_rust-core.workspace = true -ethereum_rust-storage.workspace = true -ethereum_rust-vm.workspace = true -ethereum_rust-blockchain.workspace = true -ethereum_rust-net.workspace = true -ethereum_rust-rlp.workspace = true +ethrex-core.workspace = true +ethrex-storage.workspace = true +ethrex-vm.workspace = true +ethrex-blockchain.workspace = true +ethrex-net.workspace = true +ethrex-rlp.workspace = true hex.workspace = true axum-extra = { version = "0.9.3", features = ["typed-header"] } jsonwebtoken.workspace = true diff --git a/crates/networking/rpc/admin/mod.rs b/crates/networking/rpc/admin/mod.rs index 1891f0e1ab..53311de945 100644 --- a/crates/networking/rpc/admin/mod.rs +++ b/crates/networking/rpc/admin/mod.rs @@ -1,6 +1,6 @@ -use ethereum_rust_core::types::ChainConfig; -use ethereum_rust_net::types::Node; -use ethereum_rust_storage::Store; +use ethrex_core::types::ChainConfig; +use ethrex_net::types::Node; +use ethrex_storage::Store; use serde::Serialize; use serde_json::Value; use std::collections::HashMap; @@ -41,7 +41,7 @@ pub fn node_info(storage: Store, local_node: Node) -> Result { let node_info = NodeInfo { enode: enode_url, id: hex::encode(local_node.node_id), - name: "ethereum_rust/0.1.0/rust1.80".to_string(), + name: "ethrex/0.1.0/rust1.80".to_string(), ip: local_node.ip.to_string(), ports: Ports { discovery: local_node.udp_port, diff --git a/crates/networking/rpc/engine/exchange_transition_config.rs b/crates/networking/rpc/engine/exchange_transition_config.rs index 7d0faa2f1c..751b1ad49b 100644 --- a/crates/networking/rpc/engine/exchange_transition_config.rs +++ b/crates/networking/rpc/engine/exchange_transition_config.rs @@ -1,4 +1,4 @@ -use ethereum_rust_core::{serde_utils, H256}; +use ethrex_core::{serde_utils, H256}; use serde::{Deserialize, Serialize}; use serde_json::Value; use tracing::{info, warn}; diff --git a/crates/networking/rpc/engine/fork_choice.rs b/crates/networking/rpc/engine/fork_choice.rs index 78b7f7e892..a6bd6c1e16 100644 --- a/crates/networking/rpc/engine/fork_choice.rs +++ b/crates/networking/rpc/engine/fork_choice.rs @@ -1,4 +1,4 @@ -use ethereum_rust_blockchain::{ +use ethrex_blockchain::{ error::{ChainError, InvalidForkChoice}, fork_choice::apply_fork_choice, latest_canonical_block_hash, diff --git a/crates/networking/rpc/engine/payload.rs b/crates/networking/rpc/engine/payload.rs index b85188b7d8..f0d351e9da 100644 --- a/crates/networking/rpc/engine/payload.rs +++ b/crates/networking/rpc/engine/payload.rs @@ -1,8 +1,8 @@ -use ethereum_rust_blockchain::add_block; -use ethereum_rust_blockchain::error::ChainError; -use ethereum_rust_blockchain::payload::build_payload; -use ethereum_rust_core::types::Fork; -use ethereum_rust_core::{H256, U256}; +use ethrex_blockchain::add_block; +use ethrex_blockchain::error::ChainError; +use ethrex_blockchain::payload::build_payload; +use ethrex_core::types::Fork; +use ethrex_core::{H256, U256}; use serde_json::Value; use tracing::{error, info, warn}; diff --git a/crates/networking/rpc/eth/account.rs b/crates/networking/rpc/eth/account.rs index 76e2965704..94f880da33 100644 --- a/crates/networking/rpc/eth/account.rs +++ b/crates/networking/rpc/eth/account.rs @@ -1,4 +1,4 @@ -use ethereum_rust_blockchain::mempool; +use ethrex_blockchain::mempool; use serde_json::Value; use tracing::info; @@ -6,7 +6,7 @@ use crate::types::account_proof::{AccountProof, StorageProof}; use crate::types::block_identifier::{BlockIdentifierOrHash, BlockTag}; use crate::RpcApiContext; use crate::{utils::RpcErr, RpcHandler}; -use ethereum_rust_core::{Address, BigEndianHash, H256, U256}; +use ethrex_core::{Address, BigEndianHash, H256, U256}; pub struct GetBalanceRequest { pub address: Address, diff --git a/crates/networking/rpc/eth/block.rs b/crates/networking/rpc/eth/block.rs index 74295d090e..fe014cc799 100644 --- a/crates/networking/rpc/eth/block.rs +++ b/crates/networking/rpc/eth/block.rs @@ -1,5 +1,5 @@ -use ethereum_rust_blockchain::find_parent_header; -use ethereum_rust_rlp::encode::RLPEncode; +use ethrex_blockchain::find_parent_header; +use ethrex_rlp::encode::RLPEncode; use serde_json::Value; use tracing::info; @@ -12,14 +12,14 @@ use crate::{ utils::RpcErr, RpcApiContext, RpcHandler, }; -use ethereum_rust_core::{ +use ethrex_core::{ types::{ calculate_base_fee_per_blob_gas, Block, BlockBody, BlockHash, BlockHeader, BlockNumber, Receipt, }, U256, }; -use ethereum_rust_storage::Store; +use ethrex_storage::Store; pub struct GetBlockByNumberRequest { pub block: BlockIdentifier, diff --git a/crates/networking/rpc/eth/fee_market.rs b/crates/networking/rpc/eth/fee_market.rs index e1b8cf663c..ea01ce6125 100644 --- a/crates/networking/rpc/eth/fee_market.rs +++ b/crates/networking/rpc/eth/fee_market.rs @@ -1,12 +1,12 @@ -use ethereum_rust_blockchain::constants::MAX_BLOB_GAS_PER_BLOCK; -use ethereum_rust_core::types::{Block, Transaction}; +use ethrex_blockchain::constants::MAX_BLOB_GAS_PER_BLOCK; +use ethrex_core::types::{Block, Transaction}; use serde::Serialize; use serde_json::Value; use tracing::info; use crate::{types::block_identifier::BlockIdentifier, utils::RpcErr, RpcApiContext, RpcHandler}; -use ethereum_rust_core::types::calculate_base_fee_per_blob_gas; -use ethereum_rust_storage::Store; +use ethrex_core::types::calculate_base_fee_per_blob_gas; +use ethrex_storage::Store; #[derive(Clone, Debug)] pub struct FeeHistoryRequest { diff --git a/crates/networking/rpc/eth/filter.rs b/crates/networking/rpc/eth/filter.rs index c0e6018fda..0a7027dfd9 100644 --- a/crates/networking/rpc/eth/filter.rs +++ b/crates/networking/rpc/eth/filter.rs @@ -2,8 +2,8 @@ // - Manually testing the behaviour deploying contracts on the Sepolia test network. // - Go-Ethereum, specifically: https://github.com/ethereum/go-ethereum/blob/368e16f39d6c7e5cce72a92ec289adbfbaed4854/eth/filters/filter.go // - Ethereum's reference: https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_newfilter -use ethereum_rust_core::types::BlockNumber; -use ethereum_rust_storage::Store; +use ethrex_core::types::BlockNumber; +use ethrex_storage::Store; use std::{ collections::HashMap, sync::{Arc, Mutex}, @@ -67,7 +67,7 @@ impl NewFilterRequest { pub fn handle( &self, - storage: ethereum_rust_storage::Store, + storage: ethrex_storage::Store, filters: ActiveFilters, ) -> Result { let from = self @@ -141,7 +141,7 @@ impl DeleteFilterRequest { pub fn handle( &self, - _storage: ethereum_rust_storage::Store, + _storage: ethrex_storage::Store, filters: ActiveFilters, ) -> Result { let mut active_filters_guard = filters.lock().unwrap_or_else(|mut poisoned_guard| { @@ -158,7 +158,7 @@ impl DeleteFilterRequest { pub fn stateful_call( req: &RpcRequest, - storage: ethereum_rust_storage::Store, + storage: ethrex_storage::Store, filters: ActiveFilters, ) -> Result { let request = Self::parse(&req.params)?; @@ -185,7 +185,7 @@ impl FilterChangesRequest { } pub fn handle( &self, - storage: ethereum_rust_storage::Store, + storage: ethrex_storage::Store, filters: ActiveFilters, ) -> Result { let Some(latest_block_num) = storage.get_latest_block_number()? else { @@ -242,7 +242,7 @@ impl FilterChangesRequest { } pub fn stateful_call( req: &RpcRequest, - storage: ethereum_rust_storage::Store, + storage: ethrex_storage::Store, filters: ActiveFilters, ) -> Result { let request = Self::parse(&req.params)?; @@ -272,8 +272,8 @@ mod tests { types::block_identifier::BlockIdentifier, utils::{test_utils::example_p2p_node, RpcRequest}, }; - use ethereum_rust_core::types::Genesis; - use ethereum_rust_storage::{EngineType, Store}; + use ethrex_core::types::Genesis; + use ethrex_storage::{EngineType, Store}; use serde_json::{json, Value}; use test_utils::TEST_GENESIS; diff --git a/crates/networking/rpc/eth/gas_price.rs b/crates/networking/rpc/eth/gas_price.rs index c35c5f2416..cba06811fe 100644 --- a/crates/networking/rpc/eth/gas_price.rs +++ b/crates/networking/rpc/eth/gas_price.rs @@ -1,4 +1,4 @@ -use ethereum_rust_blockchain::constants::MIN_GAS_LIMIT; +use ethrex_blockchain::constants::MIN_GAS_LIMIT; use tracing::error; use crate::utils::RpcErr; @@ -107,15 +107,15 @@ mod tests { RpcApiContext, RpcHandler, }; use bytes::Bytes; - use ethereum_rust_core::{ + use ethrex_core::{ types::{ Block, BlockBody, BlockHeader, EIP1559Transaction, Genesis, LegacyTransaction, Transaction, TxKind, }, Address, Bloom, H256, U256, }; - use ethereum_rust_net::types::Node; - use ethereum_rust_storage::{EngineType, Store}; + use ethrex_net::types::Node; + use ethrex_storage::{EngineType, Store}; use hex_literal::hex; use serde_json::json; use std::{net::Ipv4Addr, str::FromStr}; diff --git a/crates/networking/rpc/eth/logs.rs b/crates/networking/rpc/eth/logs.rs index b45034e70b..72eb0aed60 100644 --- a/crates/networking/rpc/eth/logs.rs +++ b/crates/networking/rpc/eth/logs.rs @@ -6,8 +6,8 @@ use crate::{ types::{block_identifier::BlockIdentifier, receipt::RpcLog}, RpcApiContext, RpcErr, RpcHandler, }; -use ethereum_rust_core::{H160, H256}; -use ethereum_rust_storage::Store; +use ethrex_core::{H160, H256}; +use ethrex_storage::Store; use serde::Deserialize; use serde_json::Value; use std::collections::HashSet; diff --git a/crates/networking/rpc/eth/transaction.rs b/crates/networking/rpc/eth/transaction.rs index 2727e0e8b3..efa7ec8e79 100644 --- a/crates/networking/rpc/eth/transaction.rs +++ b/crates/networking/rpc/eth/transaction.rs @@ -7,16 +7,16 @@ use crate::{ utils::RpcErr, RpcApiContext, RpcHandler, }; -use ethereum_rust_core::{ +use ethrex_core::{ types::{AccessListEntry, BlockHash, BlockHeader, BlockNumber, GenericTransaction, TxKind}, H256, U256, }; -use ethereum_rust_blockchain::mempool; -use ethereum_rust_rlp::encode::RLPEncode; -use ethereum_rust_storage::Store; +use ethrex_blockchain::mempool; +use ethrex_rlp::encode::RLPEncode; +use ethrex_storage::Store; -use ethereum_rust_vm::{evm_state, ExecutionResult, SpecId}; +use ethrex_vm::{evm_state, ExecutionResult, SpecId}; use serde::Serialize; use serde_json::Value; @@ -68,7 +68,7 @@ pub struct AccessListResult { access_list: Vec, #[serde(skip_serializing_if = "Option::is_none")] error: Option, - #[serde(with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(with = "ethrex_core::serde_utils::u64::hex_str")] gas_used: u64, } @@ -233,7 +233,7 @@ impl RpcHandler for GetTransactionByHashRequest { _ => return Ok(Value::Null), }; - let transaction: ethereum_rust_core::types::Transaction = + let transaction: ethrex_core::types::Transaction = match storage.get_transaction_by_location(block_hash, index)? { Some(transaction) => transaction, _ => return Ok(Value::Null), @@ -319,7 +319,7 @@ impl RpcHandler for CreateAccessListRequest { _ => return Ok(Value::Null), }; // Run transaction and obtain access list - let (gas_used, access_list, error) = match ethereum_rust_vm::create_access_list( + let (gas_used, access_list, error) = match ethrex_vm::create_access_list( &self.transaction, &header, &mut evm_state(context.storage, header.compute_block_hash()), @@ -449,8 +449,7 @@ impl RpcHandler for EstimateGasRequest { } }; - let spec_id = - ethereum_rust_vm::spec_id(&storage.get_chain_config()?, block_header.timestamp); + let spec_id = ethrex_vm::spec_id(&storage.get_chain_config()?, block_header.timestamp); // If the transaction is a plain value transfer, short circuit estimation. if let TxKind::Call(address) = transaction.to { @@ -548,7 +547,7 @@ fn simulate_tx( storage: Store, spec_id: SpecId, ) -> Result { - match ethereum_rust_vm::simulate_tx_from_generic( + match ethrex_vm::simulate_tx_from_generic( transaction, block_header, &mut evm_state(storage, block_header.compute_block_hash()), diff --git a/crates/networking/rpc/rpc.rs b/crates/networking/rpc/rpc.rs index 645386c291..d8382aa385 100644 --- a/crates/networking/rpc/rpc.rs +++ b/crates/networking/rpc/rpc.rs @@ -56,8 +56,8 @@ pub mod utils; mod web3; use axum::extract::State; -use ethereum_rust_net::types::Node; -use ethereum_rust_storage::Store; +use ethrex_net::types::Node; +use ethrex_storage::Store; #[derive(Debug, Clone)] pub struct RpcApiContext { @@ -301,8 +301,8 @@ where mod tests { use super::*; use crate::utils::test_utils::example_p2p_node; - use ethereum_rust_core::types::{ChainConfig, Genesis}; - use ethereum_rust_storage::EngineType; + use ethrex_core::types::{ChainConfig, Genesis}; + use ethrex_storage::EngineType; use std::fs::File; use std::io::BufReader; @@ -329,7 +329,7 @@ mod tests { let result = map_http_requests(&request, context); let rpc_response = rpc_response(request.id, result); let expected_response = to_rpc_response_success_value( - r#"{"jsonrpc":"2.0","id":1,"result":{"enode":"enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@127.0.0.1:30303","id":"d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666","ip":"127.0.0.1","name":"ethereum_rust/0.1.0/rust1.80","ports":{"discovery":30303,"listener":30303},"protocols":{"eth":{"chainId":3151908,"homesteadBlock":0,"daoForkBlock":null,"daoForkSupport":false,"eip150Block":0,"eip155Block":0,"eip158Block":0,"byzantiumBlock":0,"constantinopleBlock":0,"petersburgBlock":0,"istanbulBlock":0,"muirGlacierBlock":null,"berlinBlock":0,"londonBlock":0,"arrowGlacierBlock":null,"grayGlacierBlock":null,"mergeNetsplitBlock":0,"shanghaiTime":0,"cancunTime":0,"pragueTime":1718232101,"verkleTime":null,"terminalTotalDifficulty":0,"terminalTotalDifficultyPassed":true}}}}"#, + r#"{"jsonrpc":"2.0","id":1,"result":{"enode":"enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@127.0.0.1:30303","id":"d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666","ip":"127.0.0.1","name":"ethrex/0.1.0/rust1.80","ports":{"discovery":30303,"listener":30303},"protocols":{"eth":{"chainId":3151908,"homesteadBlock":0,"daoForkBlock":null,"daoForkSupport":false,"eip150Block":0,"eip155Block":0,"eip158Block":0,"byzantiumBlock":0,"constantinopleBlock":0,"petersburgBlock":0,"istanbulBlock":0,"muirGlacierBlock":null,"berlinBlock":0,"londonBlock":0,"arrowGlacierBlock":null,"grayGlacierBlock":null,"mergeNetsplitBlock":0,"shanghaiTime":0,"cancunTime":0,"pragueTime":1718232101,"verkleTime":null,"terminalTotalDifficulty":0,"terminalTotalDifficultyPassed":true}}}}"#, ); assert_eq!(rpc_response.to_string(), expected_response.to_string()) } diff --git a/crates/networking/rpc/types/account_proof.rs b/crates/networking/rpc/types/account_proof.rs index 332026b30b..ed0ca8cdfc 100644 --- a/crates/networking/rpc/types/account_proof.rs +++ b/crates/networking/rpc/types/account_proof.rs @@ -1,4 +1,4 @@ -use ethereum_rust_core::{serde_utils, Address, H256, U256}; +use ethrex_core::{serde_utils, Address, H256, U256}; use serde::{ser::SerializeSeq, Serialize, Serializer}; #[derive(Debug, Serialize)] diff --git a/crates/networking/rpc/types/block.rs b/crates/networking/rpc/types/block.rs index 54a3076105..25ec4a78e3 100644 --- a/crates/networking/rpc/types/block.rs +++ b/crates/networking/rpc/types/block.rs @@ -1,10 +1,10 @@ use super::transaction::RpcTransaction; -use ethereum_rust_core::{ +use ethrex_core::{ serde_utils, types::{Block, BlockBody, BlockHash, BlockHeader, BlockNumber, Withdrawal}, H256, U256, }; -use ethereum_rust_rlp::encode::RLPEncode; +use ethrex_rlp::encode::RLPEncode; use serde::{Deserialize, Serialize}; @@ -101,7 +101,7 @@ impl FullBlockBody { mod test { use bytes::Bytes; - use ethereum_rust_core::{ + use ethrex_core::{ types::{EIP1559Transaction, Transaction, TxKind}, Address, Bloom, H256, U256, }; diff --git a/crates/networking/rpc/types/block_identifier.rs b/crates/networking/rpc/types/block_identifier.rs index 5e59db0673..b74963820a 100644 --- a/crates/networking/rpc/types/block_identifier.rs +++ b/crates/networking/rpc/types/block_identifier.rs @@ -1,7 +1,7 @@ use std::{fmt::Display, str::FromStr}; -use ethereum_rust_core::types::{BlockHash, BlockHeader, BlockNumber}; -use ethereum_rust_storage::{error::StoreError, Store}; +use ethrex_core::types::{BlockHash, BlockHeader, BlockNumber}; +use ethrex_storage::{error::StoreError, Store}; use serde::Deserialize; use serde_json::Value; diff --git a/crates/networking/rpc/types/fork_choice.rs b/crates/networking/rpc/types/fork_choice.rs index 86189038ad..4cfcf2bd35 100644 --- a/crates/networking/rpc/types/fork_choice.rs +++ b/crates/networking/rpc/types/fork_choice.rs @@ -1,5 +1,5 @@ use super::payload::PayloadStatus; -use ethereum_rust_core::{serde_utils, types::Withdrawal, Address, H256}; +use ethrex_core::{serde_utils, types::Withdrawal, Address, H256}; use serde::{Deserialize, Serialize}; #[derive(Debug, Deserialize, Serialize)] diff --git a/crates/networking/rpc/types/payload.rs b/crates/networking/rpc/types/payload.rs index b1abb57cb0..b35825039d 100644 --- a/crates/networking/rpc/types/payload.rs +++ b/crates/networking/rpc/types/payload.rs @@ -1,8 +1,8 @@ use bytes::Bytes; -use ethereum_rust_rlp::error::RLPDecodeError; +use ethrex_rlp::error::RLPDecodeError; use serde::{Deserialize, Serialize}; -use ethereum_rust_core::{ +use ethrex_core::{ serde_utils, types::{ compute_transactions_root, compute_withdrawals_root, BlobsBundle, Block, BlockBody, diff --git a/crates/networking/rpc/types/receipt.rs b/crates/networking/rpc/types/receipt.rs index 829394b0bd..7c79bc1454 100644 --- a/crates/networking/rpc/types/receipt.rs +++ b/crates/networking/rpc/types/receipt.rs @@ -1,10 +1,10 @@ -use ethereum_rust_blockchain::constants::GAS_PER_BLOB; -use ethereum_rust_core::{ +use ethrex_blockchain::constants::GAS_PER_BLOB; +use ethrex_core::{ serde_utils, types::{BlockHash, BlockHeader, BlockNumber, Log, Receipt, Transaction, TxKind, TxType}, Address, Bloom, Bytes, H256, }; -use ethereum_rust_vm::RevmAddress; +use ethrex_vm::RevmAddress; use serde::{Deserialize, Serialize}; @@ -138,18 +138,18 @@ impl RpcReceiptBlockInfo { #[serde(rename_all = "camelCase")] pub struct RpcReceiptTxInfo { pub transaction_hash: H256, - #[serde(with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(with = "ethrex_core::serde_utils::u64::hex_str")] pub transaction_index: u64, pub from: Address, pub to: Option
, pub contract_address: Option
, - #[serde(with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(with = "ethrex_core::serde_utils::u64::hex_str")] pub gas_used: u64, - #[serde(with = "ethereum_rust_core::serde_utils::u64::hex_str")] + #[serde(with = "ethrex_core::serde_utils::u64::hex_str")] pub effective_gas_price: u64, #[serde( skip_serializing_if = "Option::is_none", - with = "ethereum_rust_core::serde_utils::u64::hex_str_opt", + with = "ethrex_core::serde_utils::u64::hex_str_opt", default = "Option::default" )] pub blob_gas_price: Option, @@ -207,7 +207,7 @@ impl RpcReceiptTxInfo { #[cfg(test)] mod tests { use super::*; - use ethereum_rust_core::{ + use ethrex_core::{ types::{Log, TxType}, Bloom, Bytes, }; diff --git a/crates/networking/rpc/types/transaction.rs b/crates/networking/rpc/types/transaction.rs index fce3b5ff16..df4b5a29ce 100644 --- a/crates/networking/rpc/types/transaction.rs +++ b/crates/networking/rpc/types/transaction.rs @@ -1,4 +1,4 @@ -use ethereum_rust_core::{ +use ethrex_core::{ serde_utils, types::{ BlobsBundle, BlockHash, BlockNumber, EIP1559Transaction, EIP2930Transaction, @@ -6,7 +6,7 @@ use ethereum_rust_core::{ }, Address, H256, }; -use ethereum_rust_rlp::{ +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError, diff --git a/crates/networking/rpc/utils.rs b/crates/networking/rpc/utils.rs index 3fd23c2daa..4ea572ed13 100644 --- a/crates/networking/rpc/utils.rs +++ b/crates/networking/rpc/utils.rs @@ -1,10 +1,10 @@ -use ethereum_rust_storage::error::StoreError; -use ethereum_rust_vm::EvmError; +use ethrex_storage::error::StoreError; +use ethrex_vm::EvmError; use serde::{Deserialize, Serialize}; use serde_json::Value; use crate::authentication::AuthenticationError; -use ethereum_rust_blockchain::error::MempoolError; +use ethrex_blockchain::error::MempoolError; #[derive(Debug, Deserialize)] pub enum RpcErr { @@ -246,9 +246,9 @@ pub fn parse_json_hex(hex: &serde_json::Value) -> Result { pub mod test_utils { use std::{net::SocketAddr, str::FromStr}; - use ethereum_rust_core::H512; - use ethereum_rust_net::types::Node; - use ethereum_rust_storage::{EngineType, Store}; + use ethrex_core::H512; + use ethrex_net::types::Node; + use ethrex_storage::{EngineType, Store}; use crate::start_api; diff --git a/crates/networking/rpc/web3/mod.rs b/crates/networking/rpc/web3/mod.rs index e5e628ec12..1bbad96902 100644 --- a/crates/networking/rpc/web3/mod.rs +++ b/crates/networking/rpc/web3/mod.rs @@ -1,8 +1,8 @@ -use ethereum_rust_storage::Store; +use ethrex_storage::Store; use serde_json::Value; use crate::utils::{RpcErr, RpcRequest}; pub fn client_version(_req: &RpcRequest, _store: Store) -> Result { - Ok(Value::String("ethereum_rust@0.1.0".to_owned())) + Ok(Value::String("ethrex@0.1.0".to_owned())) } diff --git a/crates/storage/store/Cargo.toml b/crates/storage/store/Cargo.toml index 92c8422e35..94cb2b178d 100644 --- a/crates/storage/store/Cargo.toml +++ b/crates/storage/store/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "ethereum_rust-storage" +name = "ethrex-storage" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ethereum_rust-rlp.workspace = true -ethereum_rust-core = { path = "../../common", default-features = false } -ethereum_rust-trie = { path = "../../storage/trie", default-features = false } +ethrex-rlp.workspace = true +ethrex-core = { path = "../../common", default-features = false } +ethrex-trie = { path = "../../storage/trie", default-features = false } ethereum-types = "0.14.1" anyhow = "1.0.86" @@ -25,8 +25,8 @@ libmdbx = { workspace = true, optional = true } default = ["libmdbx"] libmdbx = [ "dep:libmdbx", - "ethereum_rust-trie/libmdbx", - "ethereum_rust-core/libmdbx", + "ethrex-trie/libmdbx", + "ethrex-core/libmdbx", ] [dev-dependencies] diff --git a/crates/storage/store/engines/api.rs b/crates/storage/store/engines/api.rs index ce1c898b9f..cca2e7333f 100644 --- a/crates/storage/store/engines/api.rs +++ b/crates/storage/store/engines/api.rs @@ -1,12 +1,12 @@ use bytes::Bytes; -use ethereum_rust_core::types::{ +use ethereum_types::{H256, U256}; +use ethrex_core::types::{ Block, BlockBody, BlockHash, BlockHeader, BlockNumber, ChainConfig, Index, Receipt, Transaction, }; -use ethereum_types::{H256, U256}; use std::{fmt::Debug, panic::RefUnwindSafe}; use crate::error::StoreError; -use ethereum_rust_trie::Trie; +use ethrex_trie::Trie; pub trait StoreEngine: Debug + Send + Sync + RefUnwindSafe { /// Add block header diff --git a/crates/storage/store/engines/in_memory.rs b/crates/storage/store/engines/in_memory.rs index afaff9cfaf..4d4ed4dbb9 100644 --- a/crates/storage/store/engines/in_memory.rs +++ b/crates/storage/store/engines/in_memory.rs @@ -1,10 +1,10 @@ use crate::error::StoreError; use bytes::Bytes; -use ethereum_rust_core::types::{ +use ethereum_types::{H256, U256}; +use ethrex_core::types::{ Block, BlockBody, BlockHash, BlockHeader, BlockNumber, ChainConfig, Index, Receipt, }; -use ethereum_rust_trie::{InMemoryTrieDB, Trie}; -use ethereum_types::{H256, U256}; +use ethrex_trie::{InMemoryTrieDB, Trie}; use std::{ collections::HashMap, fmt::Debug, diff --git a/crates/storage/store/engines/libmdbx.rs b/crates/storage/store/engines/libmdbx.rs index 5b4bfa8174..52b28e803d 100644 --- a/crates/storage/store/engines/libmdbx.rs +++ b/crates/storage/store/engines/libmdbx.rs @@ -6,13 +6,13 @@ use crate::rlp::{ }; use anyhow::Result; use bytes::Bytes; -use ethereum_rust_core::types::{ +use ethereum_types::{H256, U256}; +use ethrex_core::types::{ Block, BlockBody, BlockHash, BlockHeader, BlockNumber, ChainConfig, Index, Receipt, Transaction, }; -use ethereum_rust_rlp::decode::RLPDecode; -use ethereum_rust_rlp::encode::RLPEncode; -use ethereum_rust_trie::{LibmdbxDupsortTrieDB, LibmdbxTrieDB, Trie}; -use ethereum_types::{H256, U256}; +use ethrex_rlp::decode::RLPDecode; +use ethrex_rlp::encode::RLPEncode; +use ethrex_trie::{LibmdbxDupsortTrieDB, LibmdbxTrieDB, Trie}; use libmdbx::orm::{Decodable, Encodable, Table}; use libmdbx::{ dupsort, diff --git a/crates/storage/store/error.rs b/crates/storage/store/error.rs index ce8b8f335b..61687f543e 100644 --- a/crates/storage/store/error.rs +++ b/crates/storage/store/error.rs @@ -1,5 +1,5 @@ -use ethereum_rust_rlp::error::RLPDecodeError; -use ethereum_rust_trie::TrieError; +use ethrex_rlp::error::RLPDecodeError; +use ethrex_trie::TrieError; use thiserror::Error; // TODO improve errors diff --git a/crates/storage/store/rlp.rs b/crates/storage/store/rlp.rs index 7d2aca7d3b..50991db8e8 100644 --- a/crates/storage/store/rlp.rs +++ b/crates/storage/store/rlp.rs @@ -1,12 +1,12 @@ use std::marker::PhantomData; use bytes::Bytes; -use ethereum_rust_core::{ +use ethereum_types::U256; +use ethrex_core::{ types::{Block, BlockBody, BlockHash, BlockHeader, Receipt}, H256, }; -use ethereum_rust_rlp::{decode::RLPDecode, encode::RLPEncode}; -use ethereum_types::U256; +use ethrex_rlp::{decode::RLPDecode, encode::RLPEncode}; #[cfg(feature = "libmdbx")] use libmdbx::orm::{Decodable, Encodable}; diff --git a/crates/storage/store/storage.rs b/crates/storage/store/storage.rs index 862763b3fb..96073c4851 100644 --- a/crates/storage/store/storage.rs +++ b/crates/storage/store/storage.rs @@ -4,15 +4,15 @@ use self::engines::libmdbx::Store as LibmdbxStore; use self::error::StoreError; use bytes::Bytes; use engines::api::StoreEngine; -use ethereum_rust_core::types::{ +use ethereum_types::{Address, H256, U256}; +use ethrex_core::types::{ code_hash, AccountInfo, AccountState, BlobsBundle, Block, BlockBody, BlockHash, BlockHeader, BlockNumber, ChainConfig, Genesis, GenesisAccount, Index, MempoolTransaction, Receipt, Transaction, TxType, EMPTY_TRIE_HASH, }; -use ethereum_rust_rlp::decode::RLPDecode; -use ethereum_rust_rlp::encode::RLPEncode; -use ethereum_rust_trie::Trie; -use ethereum_types::{Address, H256, U256}; +use ethrex_rlp::decode::RLPDecode; +use ethrex_rlp::encode::RLPEncode; +use ethrex_trie::Trie; use sha3::{Digest as _, Keccak256}; use std::collections::HashMap; use std::fmt::Debug; @@ -915,12 +915,12 @@ mod tests { use std::{fs, panic, str::FromStr}; use bytes::Bytes; - use ethereum_rust_core::{ + use ethereum_types::{H256, U256}; + use ethrex_core::{ types::{Transaction, TxType, BYTES_PER_BLOB}, Bloom, }; - use ethereum_rust_rlp::decode::RLPDecode; - use ethereum_types::{H256, U256}; + use ethrex_rlp::decode::RLPDecode; use super::*; diff --git a/crates/storage/trie/Cargo.toml b/crates/storage/trie/Cargo.toml index 114f052be3..a9069e4889 100644 --- a/crates/storage/trie/Cargo.toml +++ b/crates/storage/trie/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "ethereum_rust-trie" +name = "ethrex-trie" version.workspace = true edition.workspace = true [dependencies] -ethereum_rust-rlp.workspace = true +ethrex-rlp.workspace = true ethereum-types = "0.14.1" anyhow = "1.0.86" diff --git a/crates/storage/trie/error.rs b/crates/storage/trie/error.rs index 433da4ccd5..fe3bbfd37c 100644 --- a/crates/storage/trie/error.rs +++ b/crates/storage/trie/error.rs @@ -1,4 +1,4 @@ -use ethereum_rust_rlp::error::RLPDecodeError; +use ethrex_rlp::error::RLPDecodeError; use thiserror::Error; #[derive(Debug, Error)] diff --git a/crates/storage/trie/nibbles.rs b/crates/storage/trie/nibbles.rs index 369e7c97a3..6b7a91d3c8 100644 --- a/crates/storage/trie/nibbles.rs +++ b/crates/storage/trie/nibbles.rs @@ -1,6 +1,6 @@ use std::cmp; -use ethereum_rust_rlp::{ +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError, diff --git a/crates/storage/trie/node.rs b/crates/storage/trie/node.rs index d24ccb49ea..92c634a46a 100644 --- a/crates/storage/trie/node.rs +++ b/crates/storage/trie/node.rs @@ -5,8 +5,8 @@ mod leaf; use std::array; pub use branch::BranchNode; -use ethereum_rust_rlp::{decode::decode_bytes, error::RLPDecodeError, structs::Decoder}; use ethereum_types::H256; +use ethrex_rlp::{decode::decode_bytes, error::RLPDecodeError, structs::Decoder}; pub use extension::ExtensionNode; pub use leaf::LeafNode; diff --git a/crates/storage/trie/node/branch.rs b/crates/storage/trie/node/branch.rs index 0b42455afb..83b95b541a 100644 --- a/crates/storage/trie/node/branch.rs +++ b/crates/storage/trie/node/branch.rs @@ -1,4 +1,4 @@ -use ethereum_rust_rlp::structs::Encoder; +use ethrex_rlp::structs::Encoder; use crate::{error::TrieError, nibbles::Nibbles, node_hash::NodeHash, state::TrieState, ValueRLP}; diff --git a/crates/storage/trie/node/extension.rs b/crates/storage/trie/node/extension.rs index ae1bd8c5c8..a104716cf4 100644 --- a/crates/storage/trie/node/extension.rs +++ b/crates/storage/trie/node/extension.rs @@ -1,4 +1,4 @@ -use ethereum_rust_rlp::structs::Encoder; +use ethrex_rlp::structs::Encoder; use crate::error::TrieError; use crate::nibbles::Nibbles; diff --git a/crates/storage/trie/node/leaf.rs b/crates/storage/trie/node/leaf.rs index 969bd4bea4..f27cedfb58 100644 --- a/crates/storage/trie/node/leaf.rs +++ b/crates/storage/trie/node/leaf.rs @@ -1,4 +1,4 @@ -use ethereum_rust_rlp::structs::Encoder; +use ethrex_rlp::structs::Encoder; use crate::{ error::TrieError, nibbles::Nibbles, node::BranchNode, node_hash::NodeHash, state::TrieState, diff --git a/crates/storage/trie/node_hash.rs b/crates/storage/trie/node_hash.rs index 655e986472..e4a6397edf 100644 --- a/crates/storage/trie/node_hash.rs +++ b/crates/storage/trie/node_hash.rs @@ -1,5 +1,5 @@ -use ethereum_rust_rlp::{decode::RLPDecode, encode::RLPEncode}; use ethereum_types::H256; +use ethrex_rlp::{decode::RLPDecode, encode::RLPEncode}; #[cfg(feature = "libmdbx")] use libmdbx::orm::{Decodable, Encodable}; use sha3::{Digest, Keccak256}; @@ -123,9 +123,7 @@ impl RLPEncode for NodeHash { } impl RLPDecode for NodeHash { - fn decode_unfinished( - rlp: &[u8], - ) -> Result<(Self, &[u8]), ethereum_rust_rlp::error::RLPDecodeError> { + fn decode_unfinished(rlp: &[u8]) -> Result<(Self, &[u8]), ethrex_rlp::error::RLPDecodeError> { let (hash, rest): (Vec, &[u8]); (hash, rest) = RLPDecode::decode_unfinished(rlp)?; let hash = NodeHash::from(hash); diff --git a/crates/storage/trie/rlp.rs b/crates/storage/trie/rlp.rs index 13eff2282e..5e8a139c0a 100644 --- a/crates/storage/trie/rlp.rs +++ b/crates/storage/trie/rlp.rs @@ -1,6 +1,6 @@ // Contains RLP encoding and decoding implementations for Trie Nodes // This encoding is only used to store the nodes in the DB, it is not the encoding used for hash computation -use ethereum_rust_rlp::{ +use ethrex_rlp::{ decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError, diff --git a/crates/storage/trie/state.rs b/crates/storage/trie/state.rs index 213e3716d5..be42925e98 100644 --- a/crates/storage/trie/state.rs +++ b/crates/storage/trie/state.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use crate::error::TrieError; -use ethereum_rust_rlp::{decode::RLPDecode, encode::RLPEncode}; +use ethrex_rlp::{decode::RLPDecode, encode::RLPEncode}; use super::db::TrieDB; diff --git a/crates/storage/trie/trie.rs b/crates/storage/trie/trie.rs index c063dcf26a..389bb5e7a5 100644 --- a/crates/storage/trie/trie.rs +++ b/crates/storage/trie/trie.rs @@ -7,10 +7,11 @@ mod rlp; mod state; #[cfg(test)] mod test_utils; + mod trie_iter; mod verify_range; -use ethereum_rust_rlp::constants::RLP_NULL; use ethereum_types::H256; +use ethrex_rlp::constants::RLP_NULL; use nibbles::Nibbles; use node::Node; use node_hash::NodeHash; diff --git a/crates/vm/Cargo.toml b/crates/vm/Cargo.toml index 616712a439..a9892ef84a 100644 --- a/crates/vm/Cargo.toml +++ b/crates/vm/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "ethereum_rust-vm" +name = "ethrex-vm" version = "0.1.0" edition = "2021" [dependencies] -ethereum_rust-core = { path = "../common", default-features = false } -ethereum_rust-storage = { path = "../storage/store", default-features = false } -ethereum_rust-levm = { path = "./levm", optional = true } -ethereum_rust-trie = { path = "../storage/trie", default-features = false } -ethereum_rust-rlp = { path = "../common/rlp", default-features = false } +ethrex-core = { path = "../common", default-features = false } +ethrex-storage = { path = "../storage/store", default-features = false } +ethrex-levm = { path = "./levm", optional = true } +ethrex-trie = { path = "../storage/trie", default-features = false } +ethrex-rlp = { path = "../common/rlp", default-features = false } revm = { version = "14.0.3", features = [ "serde", "std", @@ -42,8 +42,8 @@ default = ["libmdbx", "c-kzg", "blst"] l2 = [] c-kzg = ["revm/c-kzg"] blst = ["revm/blst"] -libmdbx = ["ethereum_rust-storage/default", "ethereum_rust-core/libmdbx"] -levm = ["ethereum_rust-levm"] +libmdbx = ["ethrex-storage/default", "ethrex-core/libmdbx"] +levm = ["ethrex-levm"] [profile.test] opt-level = 3 diff --git a/crates/vm/db.rs b/crates/vm/db.rs index 216cfb51a1..d015ffa625 100644 --- a/crates/vm/db.rs +++ b/crates/vm/db.rs @@ -1,5 +1,5 @@ -use ethereum_rust_core::{types::BlockHash, Address as CoreAddress, H256 as CoreH256}; -use ethereum_rust_storage::{error::StoreError, Store}; +use ethrex_core::{types::BlockHash, Address as CoreAddress, H256 as CoreH256}; +use ethrex_storage::{error::StoreError, Store}; use revm::primitives::{ AccountInfo as RevmAccountInfo, Address as RevmAddress, Bytecode as RevmBytecode, Bytes as RevmBytes, B256 as RevmB256, U256 as RevmU256, @@ -12,11 +12,11 @@ pub struct StoreWrapper { cfg_if::cfg_if! { if #[cfg(feature = "levm")] { - use ethereum_rust_core::{U256 as CoreU256}; - use ethereum_rust_levm::db::Database as LevmDatabase; + use ethrex_core::{U256 as CoreU256}; + use ethrex_levm::db::Database as LevmDatabase; impl LevmDatabase for StoreWrapper { - fn get_account_info(&self, address: CoreAddress) -> ethereum_rust_levm::account::AccountInfo { + fn get_account_info(&self, address: CoreAddress) -> ethrex_levm::account::AccountInfo { let acc_info = self .store .get_account_info_by_hash(self.block_hash, address) @@ -29,7 +29,7 @@ cfg_if::cfg_if! { .unwrap() .unwrap_or_default(); - ethereum_rust_levm::account::AccountInfo { + ethrex_levm::account::AccountInfo { balance: acc_info.balance, nonce: acc_info.nonce, bytecode: acc_code, diff --git a/crates/vm/errors.rs b/crates/vm/errors.rs index 82ba7c646f..a2635b5f6b 100644 --- a/crates/vm/errors.rs +++ b/crates/vm/errors.rs @@ -1,7 +1,7 @@ -use ethereum_rust_core::types::BlockHash; -use ethereum_rust_storage::error::StoreError; -use ethereum_rust_trie::TrieError; use ethereum_types::H160; +use ethrex_core::types::BlockHash; +use ethrex_storage::error::StoreError; +use ethrex_trie::TrieError; use revm::primitives::{ result::EVMError as RevmError, Address as RevmAddress, B256 as RevmB256, U256 as RevmU256, }; diff --git a/crates/vm/execution_db.rs b/crates/vm/execution_db.rs index 2b70b8ce4d..af859d73eb 100644 --- a/crates/vm/execution_db.rs +++ b/crates/vm/execution_db.rs @@ -1,13 +1,13 @@ use std::collections::HashMap; -use ethereum_rust_core::{ +use ethereum_types::{Address, H160, U256}; +use ethrex_core::{ types::{AccountState, Block, ChainConfig}, H256, }; -use ethereum_rust_rlp::encode::RLPEncode; -use ethereum_rust_storage::{hash_address, hash_key, Store}; -use ethereum_rust_trie::Trie; -use ethereum_types::{Address, H160, U256}; +use ethrex_rlp::encode::RLPEncode; +use ethrex_storage::{hash_address, hash_key, Store}; +use ethrex_trie::Trie; use revm::{ primitives::{ AccountInfo as RevmAccountInfo, Address as RevmAddress, Bytecode as RevmBytecode, diff --git a/crates/vm/execution_result.rs b/crates/vm/execution_result.rs index 1914b7939d..9f0d370862 100644 --- a/crates/vm/execution_result.rs +++ b/crates/vm/execution_result.rs @@ -1,6 +1,6 @@ use bytes::Bytes; -use ethereum_rust_core::Address; -use ethereum_rust_core::{types::Log, H256}; +use ethrex_core::Address; +use ethrex_core::{types::Log, H256}; use revm::primitives::result::Output as RevmOutput; use revm::primitives::result::SuccessReason as RevmSuccessReason; use revm::primitives::ExecutionResult as RevmExecutionResult; diff --git a/crates/vm/levm/Cargo.toml b/crates/vm/levm/Cargo.toml index 827c28636c..3635db5937 100644 --- a/crates/vm/levm/Cargo.toml +++ b/crates/vm/levm/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "ethereum_rust-levm" +name = "ethrex-levm" version.workspace = true edition.workspace = true [dependencies] -ethereum_rust-core.workspace = true -ethereum_rust-rlp.workspace = true +ethrex-core.workspace = true +ethrex-rlp.workspace = true bytes.workspace = true sha3 = "0.10.8" diff --git a/crates/vm/levm/Makefile b/crates/vm/levm/Makefile index 316dd74a12..b2947f2245 100644 --- a/crates/vm/levm/Makefile +++ b/crates/vm/levm/Makefile @@ -6,7 +6,7 @@ help: ## ๐Ÿ“š Show help for each of the Makefile recipes @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' test: ## ๐Ÿงช Runs all tests except Ethereum tests - cargo test -p ethereum_rust-levm + cargo test -p ethrex-levm lint: ## ๐Ÿงน Linter check cargo clippy --all-targets --all-features -- -D warnings diff --git a/crates/vm/levm/bench/revm_comparison/Cargo.toml b/crates/vm/levm/bench/revm_comparison/Cargo.toml index a97b97b81a..59e2c04312 100644 --- a/crates/vm/levm/bench/revm_comparison/Cargo.toml +++ b/crates/vm/levm/bench/revm_comparison/Cargo.toml @@ -8,7 +8,7 @@ name = "revm_comparison" path = "src/lib.rs" [dependencies] -ethereum_rust-levm = { path = "../../" } +ethrex-levm = { path = "../../" } hex = "0.4.3" revm = "9.0.0" bytes = "1.8.0" diff --git a/crates/vm/levm/bench/revm_comparison/src/lib.rs b/crates/vm/levm/bench/revm_comparison/src/lib.rs index fa88a29936..1a224d4bd1 100644 --- a/crates/vm/levm/bench/revm_comparison/src/lib.rs +++ b/crates/vm/levm/bench/revm_comparison/src/lib.rs @@ -1,5 +1,5 @@ use bytes::Bytes; -use ethereum_rust_levm::{call_frame::CallFrame, errors::TxResult, utils::new_vm_with_bytecode}; +use ethrex_levm::{call_frame::CallFrame, errors::TxResult, utils::new_vm_with_bytecode}; use revm::{ db::BenchmarkDB, primitives::{address, Bytecode, TransactTo}, diff --git a/crates/vm/levm/src/account.rs b/crates/vm/levm/src/account.rs index 558d131bf1..da8872a924 100644 --- a/crates/vm/levm/src/account.rs +++ b/crates/vm/levm/src/account.rs @@ -3,7 +3,7 @@ use crate::{ errors::{InternalError, VMError}, }; use bytes::Bytes; -use ethereum_rust_core::{H256, U256}; +use ethrex_core::{H256, U256}; use keccak_hash::keccak; use std::collections::HashMap; diff --git a/crates/vm/levm/src/call_frame.rs b/crates/vm/levm/src/call_frame.rs index 28535a27fd..0602e26da3 100644 --- a/crates/vm/levm/src/call_frame.rs +++ b/crates/vm/levm/src/call_frame.rs @@ -5,7 +5,7 @@ use crate::{ opcodes::Opcode, }; use bytes::Bytes; -use ethereum_rust_core::{types::Log, Address, U256}; +use ethrex_core::{types::Log, Address, U256}; use std::collections::HashMap; /// [EIP-1153]: https://eips.ethereum.org/EIPS/eip-1153#reference-implementation diff --git a/crates/vm/levm/src/constants.rs b/crates/vm/levm/src/constants.rs index 8984a66730..6b07e6e874 100644 --- a/crates/vm/levm/src/constants.rs +++ b/crates/vm/levm/src/constants.rs @@ -1,4 +1,4 @@ -use ethereum_rust_core::{H256, U256}; +use ethrex_core::{H256, U256}; pub const SUCCESS_FOR_CALL: i32 = 1; pub const REVERT_FOR_CALL: i32 = 0; @@ -27,7 +27,7 @@ pub const MAX_CREATE_CODE_SIZE: usize = 2 * MAX_CODE_SIZE; pub const INVALID_CONTRACT_PREFIX: u8 = 0xef; pub mod create_opcode { - use ethereum_rust_core::U256; + use ethrex_core::U256; pub const INIT_CODE_WORD_COST: U256 = U256([2, 0, 0, 0]); pub const CODE_DEPOSIT_COST: U256 = U256([200, 0, 0, 0]); diff --git a/crates/vm/levm/src/db.rs b/crates/vm/levm/src/db.rs index f1b124550f..d9abe76813 100644 --- a/crates/vm/levm/src/db.rs +++ b/crates/vm/levm/src/db.rs @@ -2,7 +2,7 @@ use crate::{ account::{Account, AccountInfo, StorageSlot}, errors::{InternalError, VMError}, }; -use ethereum_rust_core::{Address, H256, U256}; +use ethrex_core::{Address, H256, U256}; use std::collections::HashMap; pub trait Database { diff --git a/crates/vm/levm/src/environment.rs b/crates/vm/levm/src/environment.rs index 0f5f91ab0d..3e57703f22 100644 --- a/crates/vm/levm/src/environment.rs +++ b/crates/vm/levm/src/environment.rs @@ -1,5 +1,5 @@ use crate::constants::TX_BASE_COST; -use ethereum_rust_core::{Address, H256, U256}; +use ethrex_core::{Address, H256, U256}; #[derive(Debug, Default, Clone)] pub struct Environment { diff --git a/crates/vm/levm/src/errors.rs b/crates/vm/levm/src/errors.rs index e7c8742189..b6bad188c0 100644 --- a/crates/vm/levm/src/errors.rs +++ b/crates/vm/levm/src/errors.rs @@ -1,6 +1,6 @@ use crate::account::Account; use bytes::Bytes; -use ethereum_rust_core::{types::Log, Address}; +use ethrex_core::{types::Log, Address}; use std::collections::HashMap; use thiserror; diff --git a/crates/vm/levm/src/gas_cost.rs b/crates/vm/levm/src/gas_cost.rs index 5b1e31a47e..75cdc321e7 100644 --- a/crates/vm/levm/src/gas_cost.rs +++ b/crates/vm/levm/src/gas_cost.rs @@ -6,7 +6,7 @@ use crate::{ }; use bytes::Bytes; /// Contains the gas costs of the EVM instructions (in wei) -use ethereum_rust_core::U256; +use ethrex_core::U256; // Opcodes cost pub const ADD: U256 = U256([3, 0, 0, 0]); diff --git a/crates/vm/levm/src/memory.rs b/crates/vm/levm/src/memory.rs index 6c7b9d1a02..2eab4ada7c 100644 --- a/crates/vm/levm/src/memory.rs +++ b/crates/vm/levm/src/memory.rs @@ -2,7 +2,7 @@ use crate::{ constants::{MEMORY_EXPANSION_QUOTIENT, WORD_SIZE}, errors::{InternalError, OutOfGasError, VMError}, }; -use ethereum_rust_core::U256; +use ethrex_core::U256; #[derive(Debug, Clone, Default, PartialEq)] pub struct Memory { diff --git a/crates/vm/levm/src/opcode_handlers/arithmetic.rs b/crates/vm/levm/src/opcode_handlers/arithmetic.rs index 3ab87d4706..975392dc19 100644 --- a/crates/vm/levm/src/opcode_handlers/arithmetic.rs +++ b/crates/vm/levm/src/opcode_handlers/arithmetic.rs @@ -5,7 +5,7 @@ use crate::{ opcode_handlers::bitwise_comparison::checked_shift_left, vm::VM, }; -use ethereum_rust_core::{U256, U512}; +use ethrex_core::{U256, U512}; // Arithmetic Operations (11) // Opcodes: ADD, SUB, MUL, DIV, SDIV, MOD, SMOD, ADDMOD, MULMOD, EXP, SIGNEXTEND diff --git a/crates/vm/levm/src/opcode_handlers/bitwise_comparison.rs b/crates/vm/levm/src/opcode_handlers/bitwise_comparison.rs index aef3fb81cf..c808124303 100644 --- a/crates/vm/levm/src/opcode_handlers/bitwise_comparison.rs +++ b/crates/vm/levm/src/opcode_handlers/bitwise_comparison.rs @@ -5,7 +5,7 @@ use crate::{ gas_cost, vm::VM, }; -use ethereum_rust_core::U256; +use ethrex_core::U256; // Comparison and Bitwise Logic Operations (14) // Opcodes: LT, GT, SLT, SGT, EQ, ISZERO, AND, OR, XOR, NOT, BYTE, SHL, SHR, SAR diff --git a/crates/vm/levm/src/opcode_handlers/block.rs b/crates/vm/levm/src/opcode_handlers/block.rs index 1b092900fe..d252b4d4a9 100644 --- a/crates/vm/levm/src/opcode_handlers/block.rs +++ b/crates/vm/levm/src/opcode_handlers/block.rs @@ -5,7 +5,7 @@ use crate::{ gas_cost, vm::{address_to_word, VM}, }; -use ethereum_rust_core::{ +use ethrex_core::{ types::{BLOB_BASE_FEE_UPDATE_FRACTION, MIN_BASE_FEE_PER_BLOB_GAS}, H256, U256, }; diff --git a/crates/vm/levm/src/opcode_handlers/environment.rs b/crates/vm/levm/src/opcode_handlers/environment.rs index a3f2c8e112..f0d7e02c8c 100644 --- a/crates/vm/levm/src/opcode_handlers/environment.rs +++ b/crates/vm/levm/src/opcode_handlers/environment.rs @@ -5,7 +5,7 @@ use crate::{ gas_cost, vm::{word_to_address, VM}, }; -use ethereum_rust_core::U256; +use ethrex_core::U256; use sha3::{Digest, Keccak256}; // Environmental Information (16) diff --git a/crates/vm/levm/src/opcode_handlers/keccak.rs b/crates/vm/levm/src/opcode_handlers/keccak.rs index 7b002e8bd3..77a11c4df3 100644 --- a/crates/vm/levm/src/opcode_handlers/keccak.rs +++ b/crates/vm/levm/src/opcode_handlers/keccak.rs @@ -4,7 +4,7 @@ use crate::{ gas_cost, vm::VM, }; -use ethereum_rust_core::U256; +use ethrex_core::U256; use sha3::{Digest, Keccak256}; // KECCAK256 (1) diff --git a/crates/vm/levm/src/opcode_handlers/logging.rs b/crates/vm/levm/src/opcode_handlers/logging.rs index 88d29a2551..8efa482680 100644 --- a/crates/vm/levm/src/opcode_handlers/logging.rs +++ b/crates/vm/levm/src/opcode_handlers/logging.rs @@ -6,7 +6,7 @@ use crate::{ vm::VM, }; use bytes::Bytes; -use ethereum_rust_core::{types::Log, H256}; +use ethrex_core::{types::Log, H256}; // Logging Operations (5) // Opcodes: LOG0 ... LOG4 diff --git a/crates/vm/levm/src/opcode_handlers/push.rs b/crates/vm/levm/src/opcode_handlers/push.rs index 39bed978b9..2a83c4c659 100644 --- a/crates/vm/levm/src/opcode_handlers/push.rs +++ b/crates/vm/levm/src/opcode_handlers/push.rs @@ -5,7 +5,7 @@ use crate::{ opcodes::Opcode, vm::VM, }; -use ethereum_rust_core::U256; +use ethrex_core::U256; // Push Operations // Opcodes: PUSH0, PUSH1 ... PUSH32 diff --git a/crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs b/crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs index bb70985d61..55b38884d7 100644 --- a/crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs +++ b/crates/vm/levm/src/opcode_handlers/stack_memory_storage_flow.rs @@ -6,7 +6,7 @@ use crate::{ gas_cost, vm::VM, }; -use ethereum_rust_core::{H256, U256}; +use ethrex_core::{H256, U256}; // Stack, Memory, Storage and Flow Operations (15) // Opcodes: POP, MLOAD, MSTORE, MSTORE8, SLOAD, SSTORE, JUMP, JUMPI, PC, MSIZE, GAS, JUMPDEST, TLOAD, TSTORE, MCOPY @@ -159,7 +159,7 @@ impl VM { } // SSTORE operation - // TODO: https://github.com/lambdaclass/lambda_ethereum_rust/issues/1087 + // TODO: https://github.com/lambdaclass/lambda_ethrex/issues/1087 pub fn op_sstore( &mut self, current_call_frame: &mut CallFrame, diff --git a/crates/vm/levm/src/opcode_handlers/system.rs b/crates/vm/levm/src/opcode_handlers/system.rs index ab42f8837e..1012a2e954 100644 --- a/crates/vm/levm/src/opcode_handlers/system.rs +++ b/crates/vm/levm/src/opcode_handlers/system.rs @@ -5,7 +5,7 @@ use crate::{ gas_cost, vm::{word_to_address, VM}, }; -use ethereum_rust_core::{types::TxKind, U256}; +use ethrex_core::{types::TxKind, U256}; // System Operations (10) // Opcodes: CREATE, CALL, CALLCODE, RETURN, DELEGATECALL, CREATE2, STATICCALL, REVERT, INVALID, SELFDESTRUCT @@ -87,7 +87,7 @@ impl VM { } // CALLCODE operation - // TODO: https://github.com/lambdaclass/lambda_ethereum_rust/issues/1086 + // TODO: https://github.com/lambdaclass/lambda_ethrex/issues/1086 pub fn op_callcode( &mut self, current_call_frame: &mut CallFrame, @@ -192,7 +192,7 @@ impl VM { } // DELEGATECALL operation - // TODO: https://github.com/lambdaclass/lambda_ethereum_rust/issues/1086 + // TODO: https://github.com/lambdaclass/lambda_ethrex/issues/1086 pub fn op_delegatecall( &mut self, current_call_frame: &mut CallFrame, @@ -260,7 +260,7 @@ impl VM { } // STATICCALL operation - // TODO: https://github.com/lambdaclass/lambda_ethereum_rust/issues/1086 + // TODO: https://github.com/lambdaclass/lambda_ethrex/issues/1086 pub fn op_staticcall( &mut self, current_call_frame: &mut CallFrame, @@ -328,7 +328,7 @@ impl VM { } // CREATE operation - // TODO: https://github.com/lambdaclass/lambda_ethereum_rust/issues/1086 + // TODO: https://github.com/lambdaclass/lambda_ethrex/issues/1086 pub fn op_create( &mut self, current_call_frame: &mut CallFrame, @@ -357,7 +357,7 @@ impl VM { } // CREATE2 operation - // TODO: https://github.com/lambdaclass/lambda_ethereum_rust/issues/1086 + // TODO: https://github.com/lambdaclass/lambda_ethrex/issues/1086 pub fn op_create2( &mut self, current_call_frame: &mut CallFrame, diff --git a/crates/vm/levm/src/operations.rs b/crates/vm/levm/src/operations.rs index 5f36d17f56..03e99f91a2 100644 --- a/crates/vm/levm/src/operations.rs +++ b/crates/vm/levm/src/operations.rs @@ -3,7 +3,7 @@ use crate::{ opcodes::Opcode, }; use bytes::Bytes; -use ethereum_rust_core::U256; +use ethrex_core::U256; #[derive(Debug, PartialEq, Eq, Clone)] pub enum Operation { diff --git a/crates/vm/levm/src/utils.rs b/crates/vm/levm/src/utils.rs index dd8a037d49..56dc716fe4 100644 --- a/crates/vm/levm/src/utils.rs +++ b/crates/vm/levm/src/utils.rs @@ -7,7 +7,7 @@ use crate::{ vm::VM, }; use bytes::Bytes; -use ethereum_rust_core::{types::TxKind, Address, U256}; +use ethrex_core::{types::TxKind, Address, U256}; use std::{collections::HashMap, sync::Arc}; pub fn ops_to_bytecode(operations: &[Operation]) -> Result { diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 1fc4a19531..f3041fbbfd 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -12,9 +12,9 @@ use crate::{ opcodes::Opcode, }; use bytes::Bytes; -use ethereum_rust_core::{types::TxKind, Address, H256, U256}; -use ethereum_rust_rlp; -use ethereum_rust_rlp::encode::RLPEncode; +use ethrex_core::{types::TxKind, Address, H256, U256}; +use ethrex_rlp; +use ethrex_rlp::encode::RLPEncode; use keccak_hash::keccak; use sha3::{Digest, Keccak256}; use std::{ @@ -25,7 +25,7 @@ use std::{ pub type Storage = HashMap; #[derive(Debug, Clone, Default)] -// TODO: https://github.com/lambdaclass/ethereum_rust/issues/604 +// TODO: https://github.com/lambdaclass/ethrex/issues/604 pub struct Substate { // accessed addresses and storage keys are considered WARM // pub accessed_addresses: HashSet
, @@ -151,7 +151,7 @@ impl VM { }) } } - // TODO: https://github.com/lambdaclass/lambda_ethereum_rust/issues/1088 + // TODO: https://github.com/lambdaclass/lambda_ethrex/issues/1088 } pub fn execute(&mut self, current_call_frame: &mut CallFrame) -> TransactionReport { @@ -600,7 +600,7 @@ impl VM { )) } - // TODO: Improve and test REVERT behavior for XCALL opcodes. Issue: https://github.com/lambdaclass/lambda_ethereum_rust/issues/1061 + // TODO: Improve and test REVERT behavior for XCALL opcodes. Issue: https://github.com/lambdaclass/lambda_ethrex/issues/1061 #[allow(clippy::too_many_arguments)] pub fn generic_call( &mut self, @@ -782,7 +782,7 @@ impl VM { /// Common behavior for CREATE and CREATE2 opcodes /// /// Could be used for CREATE type transactions - // TODO: Improve and test REVERT behavior for CREATE. Issue: https://github.com/lambdaclass/lambda_ethereum_rust/issues/1061 + // TODO: Improve and test REVERT behavior for CREATE. Issue: https://github.com/lambdaclass/lambda_ethrex/issues/1061 pub fn create( &mut self, value_in_wei_to_send: U256, diff --git a/crates/vm/levm/tests/edge_case_tests.rs b/crates/vm/levm/tests/edge_case_tests.rs index 4cb8bb4228..99b198d051 100644 --- a/crates/vm/levm/tests/edge_case_tests.rs +++ b/crates/vm/levm/tests/edge_case_tests.rs @@ -1,6 +1,6 @@ use bytes::Bytes; -use ethereum_rust_core::U256; -use ethereum_rust_levm::{ +use ethrex_core::U256; +use ethrex_levm::{ operations::Operation, utils::{new_vm_with_bytecode, new_vm_with_ops}, }; diff --git a/crates/vm/levm/tests/tests.rs b/crates/vm/levm/tests/tests.rs index cb2e640488..06fef1b978 100644 --- a/crates/vm/levm/tests/tests.rs +++ b/crates/vm/levm/tests/tests.rs @@ -2,8 +2,8 @@ #![allow(clippy::unwrap_used)] use bytes::Bytes; -use ethereum_rust_core::{types::TxKind, Address, H256, U256}; -use ethereum_rust_levm::{ +use ethrex_core::{types::TxKind, Address, H256, U256}; +use ethrex_levm::{ account::Account, constants::*, db::{Cache, Db}, diff --git a/crates/vm/vm.rs b/crates/vm/vm.rs index fde940ad43..89d9e24fe5 100644 --- a/crates/vm/vm.rs +++ b/crates/vm/vm.rs @@ -9,14 +9,14 @@ use db::StoreWrapper; use execution_db::ExecutionDB; use std::cmp::min; -use ethereum_rust_core::{ +use ethrex_core::{ types::{ AccountInfo, Block, BlockHash, BlockHeader, ChainConfig, Fork, GenericTransaction, PrivilegedTxType, Receipt, Transaction, TxKind, Withdrawal, GWEI_TO_WEI, INITIAL_BASE_FEE, }, Address, BigEndianHash, H256, U256, }; -use ethereum_rust_storage::{error::StoreError, AccountUpdate, Store}; +use ethrex_storage::{error::StoreError, AccountUpdate, Store}; use lazy_static::lazy_static; use revm::{ db::{states::bundle_state::BundleRetention, AccountState, AccountStatus}, @@ -79,14 +79,14 @@ impl From for EvmState { cfg_if::cfg_if! { if #[cfg(feature = "levm")] { - use ethereum_rust_levm::{ + use ethrex_levm::{ db::{Cache, Database as LevmDatabase}, errors::{TransactionReport, TxResult, VMError}, vm::VM, Environment, }; use std::{collections::HashMap, sync::Arc}; - use ethereum_rust_core::types::code_hash; + use ethrex_core::types::code_hash; /// Executes all transactions in a block and returns their receipts. pub fn execute_block( @@ -116,7 +116,7 @@ cfg_if::cfg_if! { transaction.tx_type(), matches!(result.result, TxResult::Success), cumulative_gas_used, - // TODO: https://github.com/lambdaclass/lambda_ethereum_rust/issues/1089 + // TODO: https://github.com/lambdaclass/lambda_ethrex/issues/1089 vec![], ); receipts.push(receipt); diff --git a/test_data/network_params.yaml b/test_data/network_params.yaml index f15c36bd2b..6e251057b1 100644 --- a/test_data/network_params.yaml +++ b/test_data/network_params.yaml @@ -1,5 +1,5 @@ participants: - - el_type: ethereumrust + - el_type: ethrex cl_type: lighthouse validator_count: 32 - el_type: geth @@ -20,4 +20,4 @@ assertoor_params: run_block_proposal_check: false run_blob_transaction_test: true tests: - - 'https://raw.githubusercontent.com/lambdaclass/lambda_ethereum_rust/refs/heads/main/test_data/el-stability-check.yml' + - 'https://raw.githubusercontent.com/lambdaclass/lambda_ethrex/refs/heads/main/test_data/el-stability-check.yml'