├── crates ├── l2 │ ├── errors.rs │ ├── storage │ │ ├── .gitignore │ │ └── src │ │ │ ├── store_db │ │ │ └── mod.rs │ │ │ ├── lib.rs │ │ │ └── error.rs │ ├── .tool-versions │ ├── tee │ │ ├── quote-gen │ │ │ ├── .gitignore │ │ │ ├── Makefile │ │ │ └── Cargo.toml │ │ └── contracts │ │ │ ├── .gitignore │ │ │ ├── README.md │ │ │ └── assets │ │ │ └── platform_ca.hex │ ├── contracts │ │ ├── .gitignore │ │ └── src │ │ │ ├── example │ │ │ ├── Counter.sol │ │ │ └── L2ERC20.sol │ │ │ ├── l2 │ │ │ ├── interfaces │ │ │ │ ├── IERC20L2.sol │ │ │ │ ├── IFeeToken.sol │ │ │ │ └── IFeeTokenRegistry.sol │ │ │ ├── Messenger.sol │ │ │ ├── FeeTokenRegistry.sol │ │ │ └── L2Upgradeable.sol │ │ │ └── l1 │ │ │ └── interfaces │ │ │ ├── ITDXVerifier.sol │ │ │ └── ISP1Verifier.sol │ ├── based │ │ ├── mod.rs │ │ └── sequencer_state.rs │ ├── utils │ │ ├── mod.rs │ │ └── parse.rs │ ├── sdk │ │ ├── contract_utils │ │ │ ├── src │ │ │ │ └── lib.rs │ │ │ └── Cargo.toml │ │ └── Cargo.toml │ ├── networking │ │ └── rpc │ │ │ ├── l2 │ │ │ └── mod.rs │ │ │ ├── lib.rs │ │ │ └── Cargo.toml │ ├── .gitignore │ ├── common │ │ ├── src │ │ │ ├── lib.rs │ │ │ └── calldata.rs │ │ └── Cargo.toml │ ├── monitor │ │ └── mod.rs │ ├── prover │ │ └── src │ │ │ ├── guest_program │ │ │ └── src │ │ │ │ ├── methods.rs │ │ │ │ ├── risc0 │ │ │ │ ├── NOTICE │ │ │ │ └── src │ │ │ │ │ └── main.rs │ │ │ │ ├── sp1 │ │ │ │ └── src │ │ │ │ │ └── main.rs │ │ │ │ ├── openvm │ │ │ │ ├── src │ │ │ │ │ └── main.rs │ │ │ │ ├── openvm_init.rs │ │ │ │ └── Cargo.toml │ │ │ │ └── zisk │ │ │ │ └── src │ │ │ │ └── main.rs │ │ │ └── config.rs │ ├── l2.rs │ ├── build.rs │ ├── docker-compose-l2-store.overrides.yaml │ ├── docker-compose-l2-tdx.yaml │ └── docker-compose-l2-web3signer.yaml ├── vm │ ├── levm │ │ ├── tests │ │ │ └── lib.rs │ │ ├── runner │ │ │ ├── src │ │ │ │ └── lib.rs │ │ │ ├── code_example.txt │ │ │ ├── mnemonics_example.txt │ │ │ ├── initcode_example.txt │ │ │ ├── .gitignore │ │ │ ├── Cargo.toml │ │ │ └── input_example.json │ │ ├── bench │ │ │ └── revm_comparison │ │ │ │ ├── .gitignore │ │ │ │ ├── src │ │ │ │ ├── lib.rs │ │ │ │ └── revm_bench.rs │ │ │ │ ├── contracts │ │ │ │ ├── ManyHashes.sol │ │ │ │ ├── erc20 │ │ │ │ │ ├── ERC20Mint.sol │ │ │ │ │ ├── ERC20Transfer.sol │ │ │ │ │ ├── lib │ │ │ │ │ │ ├── IERC20Metadata.sol │ │ │ │ │ │ └── Context.sol │ │ │ │ │ └── ERC20ApprovalTransfer.sol │ │ │ │ ├── FibonacciRecursive.sol │ │ │ │ ├── Fibonacci.sol │ │ │ │ ├── FactorialRecursive.sol │ │ │ │ ├── Factorial.sol │ │ │ │ └── BubbleSort.sol │ │ │ │ └── Cargo.toml │ │ ├── .gitignore │ │ └── src │ │ │ ├── hooks │ │ │ ├── mod.rs │ │ │ ├── hook.rs │ │ │ └── backup_hook.rs │ │ │ ├── opcode_handlers │ │ │ ├── mod.rs │ │ │ ├── exchange.rs │ │ │ ├── dup.rs │ │ │ └── keccak.rs │ │ │ ├── lib.rs │ │ │ └── db │ │ │ └── mod.rs │ ├── lib.rs │ ├── db.rs │ └── Cargo.toml ├── common │ ├── config │ │ ├── lib.rs │ │ └── Cargo.toml │ ├── crypto │ │ ├── lib.rs │ │ ├── blake2f │ │ │ └── x86_64.rs │ │ └── Cargo.toml │ ├── types │ │ ├── l2.rs │ │ ├── mod.rs │ │ ├── payload.rs │ │ └── l2 │ │ │ ├── batch.rs │ │ │ └── balance_diff.rs │ ├── rlp │ │ ├── constants.rs │ │ ├── rlp.rs │ │ ├── Cargo.toml │ │ └── error.rs │ ├── trie │ │ ├── Makefile │ │ ├── README.md │ │ ├── rkyv_utils.rs │ │ └── Cargo.toml │ ├── common.rs │ ├── evm.rs │ └── errors.rs ├── blockchain │ ├── dev │ │ ├── dev.rs │ │ └── Cargo.toml │ └── metrics │ │ ├── l2 │ │ ├── mod.rs │ │ └── api.rs │ │ └── Cargo.toml ├── storage │ ├── clippy.toml │ ├── backend │ │ └── mod.rs │ ├── lib.rs │ ├── Cargo.toml │ └── rlp.rs ├── networking │ ├── rpc │ │ ├── debug │ │ │ └── mod.rs │ │ ├── types │ │ │ ├── mod.rs │ │ │ └── account_proof.rs │ │ ├── clients │ │ │ ├── mod.rs │ │ │ └── beacon │ │ │ │ └── errors.rs │ │ ├── eth │ │ │ └── mod.rs │ │ ├── net │ │ │ └── mod.rs │ │ └── lib.rs │ └── p2p │ │ ├── rlpx │ │ ├── eth │ │ │ ├── eth68 │ │ │ │ └── mod.rs │ │ │ ├── eth69 │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ └── status.rs │ │ ├── connection │ │ │ └── mod.rs │ │ ├── mod.rs │ │ └── l2 │ │ │ └── mod.rs │ │ ├── discv4 │ │ ├── mod.rs │ │ └── codec.rs │ │ └── p2p.rs └── concurrency │ └── Cargo.toml ├── clippy.toml ├── tooling ├── ef_tests │ ├── state │ │ ├── .gitignore │ │ ├── .fixtures_url │ │ ├── lib.rs │ │ └── tests │ │ │ └── all.rs │ ├── state_v2 │ │ ├── src │ │ │ ├── lib.rs │ │ │ ├── modules │ │ │ │ ├── mod.rs │ │ │ │ └── error.rs │ │ │ └── main.rs │ │ ├── .gitignore │ │ ├── Makefile │ │ └── Cargo.toml │ └── blockchain │ │ ├── lib.rs │ │ ├── .fixtures_url │ │ ├── README.md │ │ └── Cargo.toml ├── log_analysis │ ├── .gitignore │ ├── Makefile │ └── README.md ├── migrations │ ├── src │ │ └── main.rs │ ├── Cargo.toml │ └── README.md ├── hive_report │ └── Cargo.toml ├── loc │ ├── Makefile │ └── Cargo.toml ├── reorgs │ ├── README.md │ └── Cargo.toml ├── load_test │ └── Cargo.toml ├── archive_sync │ └── Cargo.toml ├── l2 │ └── dev │ │ └── README.md └── import_benchmark │ └── parse_bench.py ├── .tool-versions ├── docs ├── internal │ ├── l1 │ │ ├── snap_sync.md │ │ ├── img │ │ │ ├── geth-dashboard.png │ │ │ └── nethermind-dashboard.png │ │ ├── sorted_trie_insert │ │ │ ├── NaiveInsertionExample1.png │ │ │ ├── SortedInsertionScenario1.png │ │ │ ├── SortedInsertionScenario2.png │ │ │ └── SortedInsertionScenario3.png │ │ └── transactions_tradeoffs.md │ └── l2 │ │ └── README.md ├── l2 │ ├── interacting │ │ ├── l2_hub.md │ │ ├── maintain_sequencer.md │ │ ├── blockscout.md │ │ ├── README.md │ │ ├── wallet.md │ │ ├── deploy_contracts.md │ │ └── deposit.md │ ├── deployment │ │ ├── based.md │ │ ├── migrations.md │ │ ├── prover │ │ │ ├── README.md │ │ │ ├── tee.md │ │ │ └── multi-prover.md │ │ └── README.md │ ├── img │ │ ├── execw_case1.png │ │ ├── execw_case2.png │ │ ├── shared_bridge.png │ │ ├── l2_p2p_diagram.png │ │ ├── challenges_to_leaders.png │ │ ├── leader_election_process.png │ │ ├── aligned_mode_proof_sender.png │ │ └── aligned_mode_proof_verifier.png │ ├── bench │ │ └── img │ │ │ ├── ethrex_trie_hashing.png │ │ │ ├── risc0_trie_hashing.png │ │ │ ├── ethrex_trie_flamegraph.png │ │ │ ├── risc0_trie_flamegraph.png │ │ │ ├── after_initial_hash_caching.png │ │ │ ├── before_initial_hash_caching.png │ │ │ └── initial_hash_caching_prove_time.png │ ├── architecture │ │ ├── README.md │ │ └── components.md │ └── introduction.md ├── getting-started │ ├── installation │ │ ├── package_manager.md │ │ └── README.md │ └── hardware_requirements.md ├── developers │ ├── l1 │ │ ├── img │ │ │ ├── threads.png │ │ │ ├── uptime.png │ │ │ ├── block_time.png │ │ │ ├── gas_used.png │ │ │ ├── host_ram.png │ │ │ ├── node_cpu.png │ │ │ ├── open_fds.png │ │ │ ├── overview.png │ │ │ ├── peer_count.png │ │ │ ├── variables.png │ │ │ ├── block_height.png │ │ │ ├── datadir_size.png │ │ │ ├── ggas_per_sec.png │ │ │ ├── node_memory.png │ │ │ ├── peer_clients.png │ │ │ ├── rpc_api_row.png │ │ │ ├── consensus_fork.png │ │ │ ├── engine_api_row.png │ │ │ ├── ggas_by_block.png │ │ │ ├── peer_info_row.png │ │ │ ├── consensus_config.png │ │ │ ├── execution_client.png │ │ │ ├── open_fds_historic.png │ │ │ ├── block_building_wip.png │ │ │ ├── block_processing_row.png │ │ │ ├── host_cpu_utilization.png │ │ │ ├── slowest_rpc_methods.png │ │ │ ├── disconnections_details.png │ │ │ ├── rpc_latency_by_methods.png │ │ │ ├── rpc_success_error_rate.png │ │ │ ├── block_execution_breakdown.png │ │ │ ├── engine_latency_by_method.png │ │ │ ├── engine_latency_by_methods.png │ │ │ ├── engine_success_error_rate.png │ │ │ ├── peer_clients_distribution.png │ │ │ ├── peer_disconnection_events.png │ │ │ ├── rpc_total_time_per_method.png │ │ │ ├── process_and_server_info_row.png │ │ │ ├── rpc_request_rate_by_method.png │ │ │ ├── block_execution_breakdown.png.png │ │ │ ├── block_execution_breakdown_pie.png │ │ │ ├── engine_and_rpc_error_rates_row.png │ │ │ ├── engine_request_rate_by_method.png │ │ │ ├── engine_total_time_per_method.png │ │ │ ├── execution_vs_merkleization_diff.png │ │ │ ├── block_execution_deaggregated_by_block.png │ │ │ └── engine_and_rpc_errors_by_method_and_kind.png │ │ ├── testing │ │ │ ├── rust.md │ │ │ ├── README.md │ │ │ ├── load-tests.md │ │ │ ├── ef-tests.md │ │ │ └── assertoor.md │ │ ├── introduction.md │ │ ├── dev-mode.md │ │ ├── rocksdb-inspection.md │ │ ├── storage_api.md │ │ └── kurtosis-localnet.md │ ├── l2 │ │ ├── introduction.md │ │ └── dev-mode.md │ └── README.md ├── img │ ├── publish_release_step_1.png │ ├── publish_release_step_2.png │ ├── publish_release_step_3.png │ └── publish_release_step_4.png ├── l1 │ ├── fundamentals │ │ ├── snap_sync │ │ │ ├── FastSync-1.png │ │ │ ├── FastSync-2.png │ │ │ ├── FastSync-3.png │ │ │ ├── FastSync-4.png │ │ │ ├── Flow-SnapSync.png │ │ │ ├── SnapSyncHealing-1.png │ │ │ ├── SnapSyncLeaves-1.png │ │ │ ├── Flow-BigAccountLogic.png │ │ │ ├── Flow-DownloadAccounts.png │ │ │ ├── Flow-DownloadHeaders.png │ │ │ ├── FastSyncMembatchExample-1.png │ │ │ ├── FastSyncRetakingExample-1.png │ │ │ └── SnapSyncDownloadingStorages-1.png │ │ ├── README.md │ │ ├── databases.md │ │ └── sync_modes.md │ └── running │ │ └── README.md ├── perf_reports │ └── README.md ├── lectures.md ├── vm │ └── levm │ │ ├── debug.md │ │ └── forks.md └── crate_reviews │ └── README.md ├── rust-toolchain.toml ├── fixtures ├── blobs │ ├── 1-1.blob │ ├── 2-1.blob │ ├── 3-1.blob │ ├── 4-1.blob │ ├── 5-1.blob │ ├── 6-1.blob │ └── 7-1.blob ├── blockchain │ ├── chain.rlp │ ├── l2-loadtest.rlp │ ├── 2000-blocks.rlp │ └── l2-1k-erc20.rlp ├── hive │ └── clients.yaml ├── rsp │ └── input │ │ └── 1 │ │ └── 21272632.bin ├── keys │ ├── web3signer-key.yml │ └── private_keys_tests.txt ├── contracts │ ├── caller │ │ ├── Caller.sol │ │ └── Caller.bin │ ├── ERC20 │ │ └── ERC20.sol │ ├── load_test │ │ └── IOHeavyContract.sol │ └── deposit_spammer │ │ └── DepositSpammer.sol └── networks │ ├── hoodi.yaml │ ├── ethrex_only.yaml │ └── default.yaml ├── .github ├── config │ ├── hive │ │ └── clients.yaml │ └── assertoor │ │ ├── syncing-check.yaml │ │ ├── network_params_tx.yaml │ │ ├── network_params_blob.yaml │ │ └── network_params_ethrex_multiple_cl.yaml ├── actionlint.yaml ├── scripts │ ├── publish_loc.sh │ ├── formatter.sh │ ├── parse_test_result.sh │ └── publish_hive.sh ├── actions │ ├── free-disk │ │ └── action.yml │ ├── install-risc0 │ │ └── action.yml │ ├── setup-rust │ │ └── action.yml │ └── install-solc │ │ └── action.yml ├── pull_request_template.md ├── workflows │ ├── pr_perf_changelog.yml │ ├── pr_lint_gha.yaml │ ├── pr_perf_trie.yml │ ├── pr_perf_build_block_bench.yml │ ├── pr-main_l2_tdx_build.yaml │ └── pr-main_mdbook.yml └── CODEOWNERS ├── cmd └── ethrex │ ├── lib.rs │ ├── l2 │ └── mod.rs │ └── networks │ ├── mainnet │ └── bootnodes.json │ ├── holesky │ └── bootnodes.json │ └── sepolia │ └── bootnodes.json ├── .gitattributes ├── .cargo └── config.toml ├── metrics ├── provisioning │ ├── prometheus │ │ ├── prometheus_l1_dev.yaml │ │ └── prometheus_l2.yaml │ └── grafana │ │ ├── dashboards │ │ ├── dashboard_config_l2.yaml │ │ └── dashboard_config_l1.yaml │ │ ├── datasources │ │ ├── l1-rpc.yaml │ │ └── prometheus.yaml │ │ └── alerting │ │ └── contact_points.json ├── docker-compose-metrics-alerts.overrides.yaml ├── docker-compose-metrics-l2.overrides.yaml ├── docker-compose-metrics.yaml └── docker-compose-metrics-l1.overrides.yaml ├── .dockerignore └── benches └── Cargo.toml /crates/l2/errors.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /crates/l2/storage/.gitignore: -------------------------------------------------------------------------------- 1 | target/ 2 | -------------------------------------------------------------------------------- /crates/vm/levm/tests/lib.rs: -------------------------------------------------------------------------------- 1 | mod tests; 2 | -------------------------------------------------------------------------------- /clippy.toml: -------------------------------------------------------------------------------- 1 | allow-unwrap-in-tests = true 2 | -------------------------------------------------------------------------------- /crates/l2/.tool-versions: -------------------------------------------------------------------------------- 1 | solidity 0.8.31 2 | -------------------------------------------------------------------------------- /crates/l2/tee/quote-gen/.gitignore: -------------------------------------------------------------------------------- 1 | image.raw 2 | -------------------------------------------------------------------------------- /tooling/ef_tests/state/.gitignore: -------------------------------------------------------------------------------- 1 | Cargo.lock 2 | -------------------------------------------------------------------------------- /.tool-versions: -------------------------------------------------------------------------------- 1 | rust 1.90.0 2 | # golang 1.23.2 3 | -------------------------------------------------------------------------------- /crates/common/config/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod networks; 2 | -------------------------------------------------------------------------------- /crates/vm/levm/runner/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod input; 2 | -------------------------------------------------------------------------------- /crates/blockchain/dev/dev.rs: -------------------------------------------------------------------------------- 1 | pub mod block_producer; 2 | -------------------------------------------------------------------------------- /docs/internal/l1/snap_sync.md: -------------------------------------------------------------------------------- 1 | # Snap sync internals 2 | -------------------------------------------------------------------------------- /docs/l2/interacting/l2_hub.md: -------------------------------------------------------------------------------- 1 | # L2 Hub 2 | 3 | TDB 4 | -------------------------------------------------------------------------------- /tooling/ef_tests/state_v2/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod modules; 2 | -------------------------------------------------------------------------------- /tooling/log_analysis/.gitignore: -------------------------------------------------------------------------------- 1 | .ipynb_checkpoints 2 | -------------------------------------------------------------------------------- /crates/storage/clippy.toml: -------------------------------------------------------------------------------- 1 | allow-unwrap-in-tests = true 2 | -------------------------------------------------------------------------------- /crates/vm/levm/runner/code_example.txt: -------------------------------------------------------------------------------- 1 | 0x64000000002060ff01 2 | -------------------------------------------------------------------------------- /crates/networking/rpc/debug/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod execution_witness; 2 | -------------------------------------------------------------------------------- /crates/blockchain/metrics/l2/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod api; 2 | pub mod metrics; 3 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/.gitignore: -------------------------------------------------------------------------------- 1 | *.bin* 2 | **/*.bin* 3 | -------------------------------------------------------------------------------- /docs/l2/interacting/maintain_sequencer.md: -------------------------------------------------------------------------------- 1 | # Maintain the sequencer 2 | -------------------------------------------------------------------------------- /docs/l2/deployment/based.md: -------------------------------------------------------------------------------- 1 | # Deploying a based ethrex L2 2 | 3 | TBD 4 | -------------------------------------------------------------------------------- /docs/l2/interacting/blockscout.md: -------------------------------------------------------------------------------- 1 | # Blockscout for ethrex L2 2 | 3 | TDB 4 | -------------------------------------------------------------------------------- /crates/l2/contracts/.gitignore: -------------------------------------------------------------------------------- 1 | # Dotenv file 2 | .env 3 | 4 | # Libs 5 | lib/ 6 | -------------------------------------------------------------------------------- /crates/vm/levm/runner/mnemonics_example.txt: -------------------------------------------------------------------------------- 1 | PUSH5 0x20 2 | PUSH1 255 3 | ADD 4 | -------------------------------------------------------------------------------- /rust-toolchain.toml: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "1.90.0" 3 | profile = "default" 4 | -------------------------------------------------------------------------------- /crates/common/crypto/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod blake2f; 2 | pub mod keccak; 3 | pub mod kzg; 4 | -------------------------------------------------------------------------------- /crates/networking/p2p/rlpx/eth/eth68/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod receipts; 2 | pub mod status; 3 | -------------------------------------------------------------------------------- /crates/networking/p2p/rlpx/eth/eth69/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod receipts; 2 | pub mod status; 3 | -------------------------------------------------------------------------------- /crates/vm/levm/.gitignore: -------------------------------------------------------------------------------- 1 | *.tar.gz 2 | *.svg 3 | 4 | tests/ef/tests 5 | tmp/ 6 | target/ 7 | -------------------------------------------------------------------------------- /crates/common/types/l2.rs: -------------------------------------------------------------------------------- 1 | pub mod balance_diff; 2 | pub mod batch; 3 | pub mod fee_config; 4 | -------------------------------------------------------------------------------- /crates/networking/p2p/rlpx/connection/mod.rs: -------------------------------------------------------------------------------- 1 | mod codec; 2 | mod handshake; 3 | pub mod server; 4 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod levm_bench; 2 | pub mod revm_bench; 3 | -------------------------------------------------------------------------------- /fixtures/blobs/1-1.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/fixtures/blobs/1-1.blob -------------------------------------------------------------------------------- /fixtures/blobs/2-1.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/fixtures/blobs/2-1.blob -------------------------------------------------------------------------------- /fixtures/blobs/3-1.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/fixtures/blobs/3-1.blob -------------------------------------------------------------------------------- /fixtures/blobs/4-1.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/fixtures/blobs/4-1.blob -------------------------------------------------------------------------------- /fixtures/blobs/5-1.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/fixtures/blobs/5-1.blob -------------------------------------------------------------------------------- /fixtures/blobs/6-1.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/fixtures/blobs/6-1.blob -------------------------------------------------------------------------------- /fixtures/blobs/7-1.blob: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/fixtures/blobs/7-1.blob -------------------------------------------------------------------------------- /crates/common/rlp/constants.rs: -------------------------------------------------------------------------------- 1 | pub const RLP_NULL: u8 = 0x80; 2 | pub const RLP_EMPTY_LIST: u8 = 0xC0; 3 | -------------------------------------------------------------------------------- /crates/l2/based/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod block_fetcher; 2 | pub mod sequencer_state; 3 | pub mod state_updater; 4 | -------------------------------------------------------------------------------- /crates/l2/storage/src/store_db/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod in_memory; 2 | #[cfg(feature = "sql")] 3 | pub mod sql; 4 | -------------------------------------------------------------------------------- /docs/l2/img/execw_case1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/img/execw_case1.png -------------------------------------------------------------------------------- /docs/l2/img/execw_case2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/img/execw_case2.png -------------------------------------------------------------------------------- /.github/config/hive/clients.yaml: -------------------------------------------------------------------------------- 1 | - client: ethrex 2 | build_args: 3 | baseimage: ethrex 4 | tag: ci 5 | -------------------------------------------------------------------------------- /docs/getting-started/installation/package_manager.md: -------------------------------------------------------------------------------- 1 | # Install ethrex (package manager) 2 | 3 | Coming soon. 4 | -------------------------------------------------------------------------------- /docs/l2/img/shared_bridge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/img/shared_bridge.png -------------------------------------------------------------------------------- /fixtures/blockchain/chain.rlp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/fixtures/blockchain/chain.rlp -------------------------------------------------------------------------------- /fixtures/hive/clients.yaml: -------------------------------------------------------------------------------- 1 | - client: ethrex 2 | build_args: 3 | baseimage: ethrex 4 | tag: local 5 | -------------------------------------------------------------------------------- /crates/l2/utils/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod error; 2 | pub mod parse; 3 | pub mod state_reconstruct; 4 | pub mod test_data_io; 5 | -------------------------------------------------------------------------------- /docs/l2/img/l2_p2p_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/img/l2_p2p_diagram.png -------------------------------------------------------------------------------- /tooling/ef_tests/blockchain/lib.rs: -------------------------------------------------------------------------------- 1 | mod deserialize; 2 | pub mod fork; 3 | pub mod test_runner; 4 | pub mod types; 5 | -------------------------------------------------------------------------------- /crates/l2/sdk/contract_utils/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod compile; 2 | mod deps; 3 | 4 | pub use compile::*; 5 | pub use deps::*; 6 | -------------------------------------------------------------------------------- /crates/networking/p2p/discv4/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod codec; 2 | pub mod messages; 3 | pub mod peer_table; 4 | pub mod server; 5 | -------------------------------------------------------------------------------- /docs/developers/l1/img/threads.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/threads.png -------------------------------------------------------------------------------- /docs/developers/l1/img/uptime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/uptime.png -------------------------------------------------------------------------------- /fixtures/rsp/input/1/21272632.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/fixtures/rsp/input/1/21272632.bin -------------------------------------------------------------------------------- /crates/common/rlp/rlp.rs: -------------------------------------------------------------------------------- 1 | pub mod constants; 2 | pub mod decode; 3 | pub mod encode; 4 | pub mod error; 5 | pub mod structs; 6 | -------------------------------------------------------------------------------- /docs/developers/l1/img/block_time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/block_time.png -------------------------------------------------------------------------------- /docs/developers/l1/img/gas_used.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/gas_used.png -------------------------------------------------------------------------------- /docs/developers/l1/img/host_ram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/host_ram.png -------------------------------------------------------------------------------- /docs/developers/l1/img/node_cpu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/node_cpu.png -------------------------------------------------------------------------------- /docs/developers/l1/img/open_fds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/open_fds.png -------------------------------------------------------------------------------- /docs/developers/l1/img/overview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/overview.png -------------------------------------------------------------------------------- /docs/developers/l1/img/peer_count.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/peer_count.png -------------------------------------------------------------------------------- /docs/developers/l1/img/variables.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/variables.png -------------------------------------------------------------------------------- /docs/img/publish_release_step_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/img/publish_release_step_1.png -------------------------------------------------------------------------------- /docs/img/publish_release_step_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/img/publish_release_step_2.png -------------------------------------------------------------------------------- /docs/img/publish_release_step_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/img/publish_release_step_3.png -------------------------------------------------------------------------------- /docs/img/publish_release_step_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/img/publish_release_step_4.png -------------------------------------------------------------------------------- /docs/l2/img/challenges_to_leaders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/img/challenges_to_leaders.png -------------------------------------------------------------------------------- /fixtures/blockchain/l2-loadtest.rlp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/fixtures/blockchain/l2-loadtest.rlp -------------------------------------------------------------------------------- /docs/developers/l1/img/block_height.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/block_height.png -------------------------------------------------------------------------------- /docs/developers/l1/img/datadir_size.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/datadir_size.png -------------------------------------------------------------------------------- /docs/developers/l1/img/ggas_per_sec.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/ggas_per_sec.png -------------------------------------------------------------------------------- /docs/developers/l1/img/node_memory.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/node_memory.png -------------------------------------------------------------------------------- /docs/developers/l1/img/peer_clients.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/peer_clients.png -------------------------------------------------------------------------------- /docs/developers/l1/img/rpc_api_row.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/rpc_api_row.png -------------------------------------------------------------------------------- /docs/internal/l1/img/geth-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/internal/l1/img/geth-dashboard.png -------------------------------------------------------------------------------- /docs/l2/img/leader_election_process.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/img/leader_election_process.png -------------------------------------------------------------------------------- /docs/developers/l1/img/consensus_fork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/consensus_fork.png -------------------------------------------------------------------------------- /docs/developers/l1/img/engine_api_row.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/engine_api_row.png -------------------------------------------------------------------------------- /docs/developers/l1/img/ggas_by_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/ggas_by_block.png -------------------------------------------------------------------------------- /docs/developers/l1/img/peer_info_row.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/peer_info_row.png -------------------------------------------------------------------------------- /docs/l2/bench/img/ethrex_trie_hashing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/bench/img/ethrex_trie_hashing.png -------------------------------------------------------------------------------- /docs/l2/bench/img/risc0_trie_hashing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/bench/img/risc0_trie_hashing.png -------------------------------------------------------------------------------- /docs/l2/img/aligned_mode_proof_sender.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/img/aligned_mode_proof_sender.png -------------------------------------------------------------------------------- /tooling/ef_tests/state/.fixtures_url: -------------------------------------------------------------------------------- 1 | https://github.com/ethereum/execution-spec-tests/releases/download/v5.3.0/fixtures_develop.tar.gz 2 | -------------------------------------------------------------------------------- /cmd/ethrex/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod cli; 2 | pub mod initializers; 3 | #[cfg(feature = "l2")] 4 | pub mod l2; 5 | pub mod utils; 6 | 7 | mod decode; 8 | -------------------------------------------------------------------------------- /crates/vm/levm/runner/initcode_example.txt: -------------------------------------------------------------------------------- 1 | PUSH1 0x05 2 | PUSH1 0x0b 3 | PUSH1 0x00 4 | CODECOPY 5 | PUSH1 0x05 6 | PUSH1 0x00 7 | RETURN 8 | -------------------------------------------------------------------------------- /docs/developers/l1/img/consensus_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/consensus_config.png -------------------------------------------------------------------------------- /docs/developers/l1/img/execution_client.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/execution_client.png -------------------------------------------------------------------------------- /docs/developers/l1/img/open_fds_historic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/open_fds_historic.png -------------------------------------------------------------------------------- /docs/l2/bench/img/ethrex_trie_flamegraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/bench/img/ethrex_trie_flamegraph.png -------------------------------------------------------------------------------- /docs/l2/bench/img/risc0_trie_flamegraph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/bench/img/risc0_trie_flamegraph.png -------------------------------------------------------------------------------- /docs/l2/img/aligned_mode_proof_verifier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/img/aligned_mode_proof_verifier.png -------------------------------------------------------------------------------- /tooling/ef_tests/blockchain/.fixtures_url: -------------------------------------------------------------------------------- 1 | https://github.com/ethereum/execution-spec-tests/releases/download/v5.3.0/fixtures_develop.tar.gz 2 | -------------------------------------------------------------------------------- /tooling/ef_tests/state/lib.rs: -------------------------------------------------------------------------------- 1 | mod deserialize; 2 | pub mod parser; 3 | mod report; 4 | pub mod runner; 5 | pub mod types; 6 | mod utils; 7 | -------------------------------------------------------------------------------- /docs/developers/l1/img/block_building_wip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/block_building_wip.png -------------------------------------------------------------------------------- /docs/developers/l1/img/block_processing_row.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/block_processing_row.png -------------------------------------------------------------------------------- /docs/developers/l1/img/host_cpu_utilization.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/host_cpu_utilization.png -------------------------------------------------------------------------------- /docs/developers/l1/img/slowest_rpc_methods.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/slowest_rpc_methods.png -------------------------------------------------------------------------------- /docs/internal/l1/img/nethermind-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/internal/l1/img/nethermind-dashboard.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/FastSync-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/FastSync-1.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/FastSync-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/FastSync-2.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/FastSync-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/FastSync-3.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/FastSync-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/FastSync-4.png -------------------------------------------------------------------------------- /crates/l2/networking/rpc/l2/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod batch; 2 | pub mod execution_witness; 3 | pub mod fees; 4 | pub mod messages; 5 | pub mod transaction; 6 | -------------------------------------------------------------------------------- /crates/l2/networking/rpc/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod clients; 2 | pub mod l2; 3 | mod rpc; 4 | pub mod signer; 5 | pub mod utils; 6 | 7 | pub use rpc::start_api; 8 | -------------------------------------------------------------------------------- /docs/developers/l1/img/disconnections_details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/disconnections_details.png -------------------------------------------------------------------------------- /docs/developers/l1/img/rpc_latency_by_methods.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/rpc_latency_by_methods.png -------------------------------------------------------------------------------- /docs/developers/l1/img/rpc_success_error_rate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/rpc_success_error_rate.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/Flow-SnapSync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/Flow-SnapSync.png -------------------------------------------------------------------------------- /docs/l2/bench/img/after_initial_hash_caching.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/bench/img/after_initial_hash_caching.png -------------------------------------------------------------------------------- /docs/l2/bench/img/before_initial_hash_caching.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/bench/img/before_initial_hash_caching.png -------------------------------------------------------------------------------- /.github/actionlint.yaml: -------------------------------------------------------------------------------- 1 | self-hosted-runner: 2 | # Labels of self-hosted runner in array of strings. 3 | labels: 4 | - gpu 5 | - ethrex-sync 6 | -------------------------------------------------------------------------------- /docs/developers/l1/img/block_execution_breakdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/block_execution_breakdown.png -------------------------------------------------------------------------------- /docs/developers/l1/img/engine_latency_by_method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/engine_latency_by_method.png -------------------------------------------------------------------------------- /docs/developers/l1/img/engine_latency_by_methods.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/engine_latency_by_methods.png -------------------------------------------------------------------------------- /docs/developers/l1/img/engine_success_error_rate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/engine_success_error_rate.png -------------------------------------------------------------------------------- /docs/developers/l1/img/peer_clients_distribution.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/peer_clients_distribution.png -------------------------------------------------------------------------------- /docs/developers/l1/img/peer_disconnection_events.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/peer_disconnection_events.png -------------------------------------------------------------------------------- /docs/developers/l1/img/rpc_total_time_per_method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/rpc_total_time_per_method.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/SnapSyncHealing-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/SnapSyncHealing-1.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/SnapSyncLeaves-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/SnapSyncLeaves-1.png -------------------------------------------------------------------------------- /.github/scripts/publish_loc.sh: -------------------------------------------------------------------------------- 1 | curl -X POST $1 \ 2 | -H 'Content-Type: application/json; charset=utf-8' \ 3 | --data "$(cat tooling/loc/loc_report_slack.txt)" 4 | -------------------------------------------------------------------------------- /docs/developers/l1/img/process_and_server_info_row.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/process_and_server_info_row.png -------------------------------------------------------------------------------- /docs/developers/l1/img/rpc_request_rate_by_method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/rpc_request_rate_by_method.png -------------------------------------------------------------------------------- /docs/l2/bench/img/initial_hash_caching_prove_time.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l2/bench/img/initial_hash_caching_prove_time.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | fixtures/blockchain/2000-blocks.rlp filter=lfs diff=lfs merge=lfs -text 2 | fixtures/blockchain/l2-1k-erc20.rlp filter=lfs diff=lfs merge=lfs -text 3 | -------------------------------------------------------------------------------- /crates/l2/.gitignore: -------------------------------------------------------------------------------- 1 | .env* 2 | 3 | store/ 4 | 5 | solc_out 6 | 7 | # qpl-tool temp files 8 | out/ 9 | 10 | dev_ethrex_l2/ 11 | 12 | dev_ethrex_l1/ 13 | -------------------------------------------------------------------------------- /docs/developers/l1/img/block_execution_breakdown.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/block_execution_breakdown.png.png -------------------------------------------------------------------------------- /docs/developers/l1/img/block_execution_breakdown_pie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/block_execution_breakdown_pie.png -------------------------------------------------------------------------------- /docs/developers/l1/img/engine_and_rpc_error_rates_row.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/engine_and_rpc_error_rates_row.png -------------------------------------------------------------------------------- /docs/developers/l1/img/engine_request_rate_by_method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/engine_request_rate_by_method.png -------------------------------------------------------------------------------- /docs/developers/l1/img/engine_total_time_per_method.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/engine_total_time_per_method.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/Flow-BigAccountLogic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/Flow-BigAccountLogic.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/Flow-DownloadAccounts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/Flow-DownloadAccounts.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/Flow-DownloadHeaders.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/Flow-DownloadHeaders.png -------------------------------------------------------------------------------- /docs/perf_reports/README.md: -------------------------------------------------------------------------------- 1 | # Performance optimization reports 2 | 3 | This section includes reports on performance problems encountered and how we solved them. 4 | -------------------------------------------------------------------------------- /crates/l2/common/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod calldata; 2 | pub mod merkle_tree; 3 | pub mod messages; 4 | pub mod privileged_transactions; 5 | pub mod prover; 6 | pub mod utils; 7 | -------------------------------------------------------------------------------- /docs/developers/l1/img/execution_vs_merkleization_diff.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/execution_vs_merkleization_diff.png -------------------------------------------------------------------------------- /docs/internal/l1/sorted_trie_insert/NaiveInsertionExample1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/internal/l1/sorted_trie_insert/NaiveInsertionExample1.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/FastSyncMembatchExample-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/FastSyncMembatchExample-1.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/FastSyncRetakingExample-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/FastSyncRetakingExample-1.png -------------------------------------------------------------------------------- /crates/common/trie/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: bench build-bench 2 | 3 | build-bench: 4 | @cargo build --bench trie_bench 5 | 6 | bench: build-bench 7 | @cargo bench --bench trie_bench 8 | -------------------------------------------------------------------------------- /crates/vm/levm/runner/.gitignore: -------------------------------------------------------------------------------- 1 | code_*.txt 2 | mnemonics_*.txt 3 | input_*.json 4 | !input_example.json 5 | !code_example.txt 6 | !initcode_example.txt 7 | !mnemonics_example.txt 8 | -------------------------------------------------------------------------------- /docs/developers/l1/img/block_execution_deaggregated_by_block.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/block_execution_deaggregated_by_block.png -------------------------------------------------------------------------------- /docs/internal/l1/sorted_trie_insert/SortedInsertionScenario1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/internal/l1/sorted_trie_insert/SortedInsertionScenario1.png -------------------------------------------------------------------------------- /docs/internal/l1/sorted_trie_insert/SortedInsertionScenario2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/internal/l1/sorted_trie_insert/SortedInsertionScenario2.png -------------------------------------------------------------------------------- /docs/internal/l1/sorted_trie_insert/SortedInsertionScenario3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/internal/l1/sorted_trie_insert/SortedInsertionScenario3.png -------------------------------------------------------------------------------- /docs/l1/fundamentals/snap_sync/SnapSyncDownloadingStorages-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/l1/fundamentals/snap_sync/SnapSyncDownloadingStorages-1.png -------------------------------------------------------------------------------- /fixtures/blockchain/2000-blocks.rlp: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:98dc6d21b2f2baa36b9be9999c5df8207307ea06d510dbabfa720abf0e4ad6dd 3 | size 67422766 4 | -------------------------------------------------------------------------------- /fixtures/blockchain/l2-1k-erc20.rlp: -------------------------------------------------------------------------------- 1 | version https://git-lfs.github.com/spec/v1 2 | oid sha256:b1856840d8e0e90007134a61e60d1788ac6e5bc607c418b3862938c4ebf08ba3 3 | size 288667496 4 | -------------------------------------------------------------------------------- /crates/l2/tee/contracts/.gitignore: -------------------------------------------------------------------------------- 1 | # Libraries 2 | lib/ 3 | 4 | # Dotenv file 5 | .env 6 | .env.out 7 | 8 | # Deploy dependencies 9 | deploydeps/ 10 | automata-dcap-qpl/ 11 | -------------------------------------------------------------------------------- /crates/l2/utils/parse.rs: -------------------------------------------------------------------------------- 1 | use ethereum_types::{Address, H256}; 2 | 3 | pub fn hash_to_address(hash: H256) -> Address { 4 | Address::from_slice(&hash.as_fixed_bytes()[12..]) 5 | } 6 | -------------------------------------------------------------------------------- /docs/developers/l1/img/engine_and_rpc_errors_by_method_and_kind.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lambdaclass/ethrex/HEAD/docs/developers/l1/img/engine_and_rpc_errors_by_method_and_kind.png -------------------------------------------------------------------------------- /crates/l2/monitor/mod.rs: -------------------------------------------------------------------------------- 1 | // TODO: Handle this expects 2 | #[expect(clippy::result_large_err)] 3 | pub mod app; 4 | pub mod utils; 5 | pub mod widget; 6 | 7 | pub use app::EthrexMonitor; 8 | -------------------------------------------------------------------------------- /crates/vm/levm/src/hooks/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod backup_hook; 2 | pub mod default_hook; 3 | pub mod hook; 4 | pub mod l2_hook; 5 | 6 | pub use default_hook::DefaultHook; 7 | pub use l2_hook::L2Hook; 8 | -------------------------------------------------------------------------------- /crates/networking/rpc/types/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod account_proof; 2 | pub mod block; 3 | pub mod block_identifier; 4 | pub mod fork_choice; 5 | pub mod payload; 6 | pub mod receipt; 7 | pub mod transaction; 8 | -------------------------------------------------------------------------------- /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [target.x86_64-unknown-linux-gnu] 2 | rustflags = [ 3 | "-Ctarget-cpu=x86-64-v3", 4 | "-Ctarget-feature=+avx2,+sse2,+ssse3,+sse4.1,+sse4.2,+bmi1,+lzcnt,+pclmulqdq", 5 | ] 6 | 7 | -------------------------------------------------------------------------------- /crates/l2/storage/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod api; 2 | mod error; 3 | mod store; 4 | mod store_db; 5 | 6 | pub use error::RollupStoreError; 7 | pub use store::{EngineType as EngineTypeRollup, Store as StoreRollup}; 8 | -------------------------------------------------------------------------------- /crates/networking/rpc/clients/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod auth; 2 | pub mod beacon; 3 | pub mod eth; 4 | 5 | pub use auth::{EngineClient, errors::EngineClientError}; 6 | pub use eth::{EthClient, Overrides, errors::EthClientError}; 7 | -------------------------------------------------------------------------------- /crates/networking/p2p/rlpx/eth/mod.rs: -------------------------------------------------------------------------------- 1 | pub(crate) mod backend; 2 | pub(crate) mod blocks; 3 | mod eth68; 4 | mod eth69; 5 | pub(crate) mod receipts; 6 | pub(crate) mod status; 7 | pub(crate) mod transactions; 8 | pub(crate) mod update; 9 | -------------------------------------------------------------------------------- /tooling/ef_tests/state_v2/src/modules/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod block_runner; 2 | pub mod deserialize; 3 | pub mod error; 4 | pub mod parser; 5 | pub mod report; 6 | pub mod result_check; 7 | pub mod runner; 8 | pub mod types; 9 | pub mod utils; 10 | -------------------------------------------------------------------------------- /tooling/migrations/src/main.rs: -------------------------------------------------------------------------------- 1 | mod cli; 2 | mod utils; 3 | 4 | use crate::cli::CLI; 5 | use clap::Parser; 6 | 7 | #[tokio::main] 8 | async fn main() { 9 | let CLI { command } = CLI::parse(); 10 | 11 | command.run().await; 12 | } 13 | -------------------------------------------------------------------------------- /tooling/log_analysis/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: all deps notebook 2 | 3 | all: notebook 4 | 5 | .venv: 6 | uv venv 7 | uv pip install -r requirements.txt 8 | 9 | deps: .venv 10 | 11 | notebook: deps 12 | uv run jupyter notebook log_analysis.ipynb 13 | -------------------------------------------------------------------------------- /crates/concurrency/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-threadpool" 3 | version = "0.1.0" 4 | edition = "2024" 5 | 6 | [lib] 7 | path = "concurrency.rs" 8 | 9 | [dependencies] 10 | crossbeam.workspace = true 11 | 12 | [lints] 13 | workspace = true 14 | -------------------------------------------------------------------------------- /metrics/provisioning/prometheus/prometheus_l1_dev.yaml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 10s 3 | 4 | scrape_configs: 5 | - job_name: "ethrex L1" 6 | static_configs: 7 | # Use the name defined in the docker-compose.yaml 8 | - targets: ["ethrex:3701"] 9 | -------------------------------------------------------------------------------- /metrics/provisioning/prometheus/prometheus_l2.yaml: -------------------------------------------------------------------------------- 1 | global: 2 | scrape_interval: 5s 3 | 4 | scrape_configs: 5 | - job_name: "ethrex L2" 6 | static_configs: 7 | # Use the name defined in the docker-compose.yaml 8 | - targets: ["host.docker.internal:3702"] 9 | -------------------------------------------------------------------------------- /crates/networking/p2p/rlpx/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod connection; 2 | pub mod error; 3 | pub mod eth; 4 | pub mod initiator; 5 | #[cfg(feature = "l2")] 6 | pub mod l2; 7 | pub mod message; 8 | pub mod p2p; 9 | pub mod snap; 10 | pub mod utils; 11 | 12 | pub use message::Message; 13 | -------------------------------------------------------------------------------- /tooling/hive_report/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "hive_report" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | serde.workspace = true 10 | serde_json.workspace = true 11 | -------------------------------------------------------------------------------- /fixtures/keys/web3signer-key.yml: -------------------------------------------------------------------------------- 1 | type: "file-raw" 2 | keyType: "SECP256K1" 3 | privateKey: "0x39725efee3fb28614de3bacaffe4cc4bd8c436257e2c8bb887c4b5c4be45e76d" 4 | --- 5 | type: "file-raw" 6 | keyType: "SECP256K1" 7 | privateKey: "0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b74924" 8 | -------------------------------------------------------------------------------- /tooling/ef_tests/state_v2/.gitignore: -------------------------------------------------------------------------------- 1 | # Legacy report files (now generated in reports/ directory) 2 | ./success_report.txt 3 | ./failure_report.txt 4 | 5 | # Generated test reports directory 6 | ./reports/ 7 | 8 | # vectors is not yet part of this folder but will be soon. 9 | ./vectors 10 | -------------------------------------------------------------------------------- /docs/developers/l1/testing/rust.md: -------------------------------------------------------------------------------- 1 | # Rust tests 2 | 3 | ## Crate Specific Tests 4 | 5 | Rust unit tests that you can run like this: 6 | 7 | ```bash 8 | make test CRATE= 9 | ``` 10 | 11 | For example: 12 | 13 | ```bash 14 | make test CRATE="ethrex-blockchain" 15 | ``` 16 | 17 | 18 | -------------------------------------------------------------------------------- /.github/scripts/formatter.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # benches/formatter.sh 4 | 5 | FILE1=$1 6 | FILE2=$2 7 | 8 | cat < [!NOTE] 6 | > This section is a work in progress and will be updated with more content and examples soon. 7 | -------------------------------------------------------------------------------- /crates/networking/p2p/p2p.rs: -------------------------------------------------------------------------------- 1 | pub mod discv4; 2 | pub(crate) mod metrics; 3 | pub mod network; 4 | pub mod peer_handler; 5 | pub mod rlpx; 6 | pub(crate) mod snap; 7 | pub mod sync; 8 | pub mod sync_manager; 9 | pub mod tx_broadcaster; 10 | pub mod types; 11 | pub mod utils; 12 | 13 | pub use network::periodically_show_peer_stats; 14 | pub use network::start_network; 15 | -------------------------------------------------------------------------------- /docs/developers/l1/testing/README.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | The ethrex project runs several suites of tests to ensure proper protocol implementation 4 | 5 | ## Table of contents 6 | 7 | - [Ethereum Foundation Tests](./ef-tests.md) 8 | - [Hive Tests](./hive.md) 9 | - [Assertoor](./assertoor.md) 10 | - [Rust Unit Tests](./rust.md) 11 | - [Load Tests](./load-tests.md) 12 | -------------------------------------------------------------------------------- /crates/l2/tee/contracts/README.md: -------------------------------------------------------------------------------- 1 | # Deployment 2 | 3 | You can use `make deploy-deps` to deploy the dependencies and `make deploy` to deploy the main contract. 4 | 5 | # Dependencies 6 | 7 | A compiled version ([for reproducibility](https://github.com/daimo-eth/p256-verifier/issues/46)) of [p256-verifier](https://github.com/daimo-eth/p256-verifier) is included as assets/p256.hex 8 | -------------------------------------------------------------------------------- /cmd/ethrex/l2/mod.rs: -------------------------------------------------------------------------------- 1 | mod initializers; 2 | 3 | pub mod command; 4 | pub mod deployer; 5 | pub mod options; 6 | 7 | pub use command::L2Command; 8 | pub use initializers::{init_l2, init_tracing}; 9 | pub use options::{ 10 | BlockProducerOptions, CommitterOptions, EthOptions, Options as L2Options, 11 | ProofCoordinatorOptions, SequencerOptions, WatcherOptions, 12 | }; 13 | -------------------------------------------------------------------------------- /docs/l1/fundamentals/databases.md: -------------------------------------------------------------------------------- 1 | # Databases 2 | 3 | Ethrex uses a versioning system to ensure we don't run on invalid data if we restart the node after a breaking change to the DB structure. This system consists of a `STORE_SCHEMA_VERSION` constant, defined in `crates/storage/lib.rs` that must be increased after any breaking change and that is checked every time we start the node. 4 | -------------------------------------------------------------------------------- /tooling/loc/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: loc loc-stats loc-detailed loc-compare-detailed 2 | 3 | loc: 4 | cargo run 5 | 6 | loc-stats: 7 | if [ "$(QUIET)" = "true" ]; then \ 8 | cargo run --quiet -- --summary;\ 9 | else \ 10 | cargo run -- --summary;\ 11 | fi 12 | 13 | loc-detailed: 14 | cargo run -- --detailed 15 | 16 | loc-compare-detailed: 17 | cargo run -- --compare-detailed 18 | -------------------------------------------------------------------------------- /crates/l2/prover/src/config.rs: -------------------------------------------------------------------------------- 1 | use serde::Deserialize; 2 | use url::Url; 3 | 4 | use crate::backend::Backend; 5 | 6 | #[derive(Deserialize, Debug)] 7 | pub struct ProverConfig { 8 | pub backend: Backend, 9 | pub proof_coordinators: Vec, 10 | pub proving_time_ms: u64, 11 | #[cfg(all(feature = "sp1", feature = "gpu"))] 12 | pub sp1_server: Option, 13 | } 14 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/contracts/ManyHashes.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.17; 3 | 4 | contract ManyHashes { 5 | function Benchmark(uint256 n) external pure returns (bytes32 result) { 6 | result = bytes32(0); 7 | for (uint256 i = 0; i < n; i++) { 8 | result = keccak256(abi.encodePacked(i)); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /crates/common/common.rs: -------------------------------------------------------------------------------- 1 | pub use ethereum_types::*; 2 | pub mod constants; 3 | pub mod serde_utils; 4 | pub mod types; 5 | pub use bytes::Bytes; 6 | pub mod base64; 7 | pub use ethrex_trie::{TrieLogger, TrieWitness}; 8 | pub mod errors; 9 | pub mod evm; 10 | pub mod fd_limit; 11 | pub mod genesis_utils; 12 | pub mod rkyv_utils; 13 | pub mod tracing; 14 | pub mod utils; 15 | 16 | pub use errors::EcdsaError; 17 | -------------------------------------------------------------------------------- /metrics/provisioning/grafana/datasources/l1-rpc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | datasources: 4 | - name: "L1 RPC" 5 | type: "yesoreyeram-infinity-datasource" 6 | typeName: "Infinity" 7 | uid: "l1-rpc" 8 | access: "proxy" 9 | url: "${L1_RPC_URL}" 10 | isDefault: false 11 | jsonData: 12 | global_queries: [] 13 | readOnly: false 14 | editable: true 15 | basicAuth: false 16 | -------------------------------------------------------------------------------- /tooling/loc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "loc" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | tokei = "12.1.2" 10 | serde.workspace = true 11 | serde_json.workspace = true 12 | clap.workspace = true 13 | clap_complete.workspace = true 14 | colored = "2.1.0" 15 | spinoff = "0.8.0" 16 | prettytable = "0.10.0" 17 | -------------------------------------------------------------------------------- /crates/networking/p2p/rlpx/eth/status.rs: -------------------------------------------------------------------------------- 1 | pub use super::eth68::status::StatusMessage68; 2 | pub use super::eth69::status::StatusMessage69; 3 | use ethrex_common::types::{BlockHash, ForkId}; 4 | 5 | pub trait StatusMessage { 6 | fn get_network_id(&self) -> u64; 7 | 8 | fn get_eth_version(&self) -> u8; 9 | 10 | fn get_fork_id(&self) -> ForkId; 11 | 12 | fn get_genesis(&self) -> BlockHash; 13 | } 14 | -------------------------------------------------------------------------------- /docs/l2/deployment/migrations.md: -------------------------------------------------------------------------------- 1 | # Migrations 2 | 3 | ## From v7 to v8 4 | 5 | The following table name change was made: 6 | `messages` -> `l1_messages` 7 | 8 | In order to perform a migration you would need to copy the contents of your `messages` table into `l1_messeges` 9 | 10 | ```sql 11 | INSERT INTO l1_messages 12 | SELECT * 13 | FROM messages; 14 | ``` 15 | 16 | You can then safely delete the `messages` table 17 | -------------------------------------------------------------------------------- /metrics/docker-compose-metrics-alerts.overrides.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | grafana: 3 | volumes: 4 | - ../metrics/provisioning/grafana/alerting:/etc/grafana/provisioning/alerting 5 | environment: 6 | - ALERTS_SLACK_TOKEN=${GRAFANA_SLACK_TOKEN:?Slack token is needed for alerts} 7 | - ALERTS_SLACK_CHANNEL=${GRAFANA_SLACK_CHANNEL:?Slack channel is needed for alerts} 8 | - INSTANCE=${GRAFANA_INSTANCE:-docker} 9 | -------------------------------------------------------------------------------- /docs/developers/README.md: -------------------------------------------------------------------------------- 1 | # Developer docs 2 | 3 | Welcome to the ethrex developer docs! 4 | 5 | This section contains documentation on the internals of the project. 6 | 7 | To get started first, read the developer [installation guide](./installing.md) to learn about ethrex and its features. Then you can look into the [L1 developer docs](../developers/l1/introduction.md) or the [L2 developer docs](../developers/l2/introduction.md) 8 | -------------------------------------------------------------------------------- /fixtures/networks/hoodi.yaml: -------------------------------------------------------------------------------- 1 | participants: 2 | - el_type: ethrex 3 | el_image: ethrex:local 4 | cl_type: lighthouse 5 | cl_image: sigp/lighthouse:v8.0.0-rc.1 6 | count: 1 7 | 8 | ethereum_metrics_exporter_enabled: true 9 | 10 | additional_services: 11 | - prometheus_grafana 12 | 13 | network_params: 14 | network: hoodi 15 | 16 | grafana_params: 17 | additional_dashboards: ["./ethrex_l1_perf.json"] 18 | -------------------------------------------------------------------------------- /crates/vm/levm/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod call_frame; 2 | pub mod constants; 3 | pub mod db; 4 | pub mod debug; 5 | pub mod environment; 6 | pub mod errors; 7 | pub mod execution_handlers; 8 | pub mod gas_cost; 9 | pub mod hooks; 10 | pub mod memory; 11 | pub mod opcode_handlers; 12 | pub mod opcodes; 13 | pub mod precompiles; 14 | pub mod tracing; 15 | pub mod utils; 16 | pub mod vm; 17 | pub use environment::*; 18 | pub mod account; 19 | -------------------------------------------------------------------------------- /crates/common/crypto/blake2f/x86_64.rs: -------------------------------------------------------------------------------- 1 | use std::arch::global_asm; 2 | 3 | global_asm!(include_str!("x86_64.s")); 4 | 5 | unsafe extern "C" { 6 | unsafe fn _blake2b_f(r: usize, h: &mut [u64; 8], m: &[u64; 16], t: &[u64; 2], f: bool); 7 | } 8 | 9 | #[inline(always)] 10 | pub fn blake2b_f(r: usize, h: &mut [u64; 8], m: &[u64; 16], t: &[u64; 2], f: bool) { 11 | unsafe { 12 | _blake2b_f(r, h, m, t, f); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /docs/l1/fundamentals/sync_modes.md: -------------------------------------------------------------------------------- 1 | # Sync Modes 2 | 3 | ## Full sync 4 | 5 | Full syncing works by downloading and executing every block from genesis. This means that full syncing will only work for networks that started after [The Merge](https://ethereum.org/en/roadmap/merge/), as ethrex only supports post merge execution. 6 | 7 | ## Snap sync 8 | 9 | For snap sync, you can view the [main document here](./snap_sync.md). 10 | ` 11 | -------------------------------------------------------------------------------- /metrics/provisioning/grafana/datasources/prometheus.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | datasources: 4 | - name: Prometheus 5 | type: prometheus 6 | uid: prom-001 7 | access: proxy 8 | url: http://prometheus:9090 9 | isDefault: true 10 | version: 2 11 | jsonData: 12 | # Scrape time interval should be 5s. 13 | timeInterval: 5s 14 | httpMethod: POST 15 | readOnly: false 16 | editable: true 17 | -------------------------------------------------------------------------------- /crates/networking/p2p/rlpx/l2/mod.rs: -------------------------------------------------------------------------------- 1 | use super::p2p::Capability; 2 | 3 | pub const SUPPORTED_BASED_CAPABILITIES: [Capability; 1] = [Capability::based(1)]; 4 | pub const PERIODIC_BLOCK_BROADCAST_INTERVAL: std::time::Duration = 5 | std::time::Duration::from_millis(500); 6 | pub const PERIODIC_BATCH_BROADCAST_INTERVAL: std::time::Duration = 7 | std::time::Duration::from_millis(500); 8 | pub mod l2_connection; 9 | pub mod messages; 10 | -------------------------------------------------------------------------------- /crates/common/config/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-config" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | ethrex-p2p.workspace = true 10 | ethrex-common.workspace = true 11 | serde_json.workspace = true 12 | serde.workspace = true 13 | hex.workspace = true 14 | 15 | [lib] 16 | path = "lib.rs" 17 | 18 | [lints] 19 | workspace = true 20 | -------------------------------------------------------------------------------- /crates/l2/l2.rs: -------------------------------------------------------------------------------- 1 | pub mod based; 2 | pub mod errors; 3 | pub mod monitor; 4 | pub mod sequencer; 5 | pub mod utils; 6 | 7 | pub use based::{block_fetcher::BlockFetcher, state_updater::StateUpdater}; 8 | pub use sequencer::configs::{ 9 | BasedConfig, BlockFetcherConfig, BlockProducerConfig, CommitterConfig, EthConfig, 10 | L1WatcherConfig, ProofCoordinatorConfig, SequencerConfig, StateUpdaterConfig, 11 | }; 12 | pub use sequencer::start_l2; 13 | -------------------------------------------------------------------------------- /crates/vm/lib.rs: -------------------------------------------------------------------------------- 1 | mod db; 2 | mod errors; 3 | mod execution_result; 4 | pub mod tracing; 5 | mod witness_db; 6 | 7 | pub mod backends; 8 | 9 | pub use backends::{BlockExecutionResult, Evm}; 10 | pub use db::{DynVmDatabase, VmDatabase}; 11 | pub use errors::EvmError; 12 | pub use ethrex_levm::precompiles::precompiles_for_fork; 13 | pub use execution_result::ExecutionResult; 14 | pub use witness_db::GuestProgramStateWrapper; 15 | pub mod system_contracts; 16 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | **/target/ 4 | 5 | **/tmp/ 6 | 7 | # These are backup files generated by rustfmt 8 | **/*.rs.bk 9 | 10 | **/.DS_Store 11 | **/.vscode 12 | 13 | # CI/CD 14 | .github/ 15 | 16 | # Documentation 17 | docs/ 18 | 19 | # Local development 20 | hive/ 21 | ethereum-package/ 22 | tooling/ef_tests/blockchain/vectors 23 | tooling/ef_tests/state/vectors 24 | dev_ethrex_l1/ 25 | dev_ethrex_l2/ 26 | -------------------------------------------------------------------------------- /tooling/ef_tests/state/tests/all.rs: -------------------------------------------------------------------------------- 1 | use clap::Parser; 2 | use ef_tests_state::{ 3 | parser, 4 | runner::{self, EFTestRunnerOptions}, 5 | }; 6 | use std::error::Error; 7 | 8 | #[tokio::main] 9 | async fn main() -> Result<(), Box> { 10 | let opts = EFTestRunnerOptions::parse(); 11 | dbg!(&opts); // Useful for testing. 12 | let ef_tests = parser::parse_ef_tests(&opts)?; 13 | runner::run_ef_tests(ef_tests, &opts).await?; 14 | Ok(()) 15 | } 16 | -------------------------------------------------------------------------------- /docs/developers/l1/introduction.md: -------------------------------------------------------------------------------- 1 | # L1 Developer Docs 2 | 3 | Welcome to the ethrex L1 developer documentation! 4 | 5 | This section provides information about the internals of the L1 side of the project. 6 | 7 | ## Table of contents 8 | 9 | - [Dev mode](./dev-mode.md) 10 | - [Kurtosis localnet](./kurtosis-localnet.md) 11 | - [Importing blocks](./importing-blocks.md) 12 | - [Metrics](./metrics.md) 13 | - [Dashboards](./dashboards.md) 14 | - [Testing](./testing/README.md) 15 | -------------------------------------------------------------------------------- /fixtures/contracts/ERC20/ERC20.sol: -------------------------------------------------------------------------------- 1 | import "./deps.sol"; 2 | 3 | pragma solidity ^0.8.0; 4 | 5 | contract TestToken is ERC20 { 6 | 7 | uint256 constant defaultMint = 1000000 * (10**18); 8 | 9 | constructor() ERC20("TestToken", "TEST") { 10 | _mint(msg.sender, defaultMint); 11 | } 12 | 13 | // Mint a free amount for whoever 14 | // calls the function 15 | function freeMint() public { 16 | _mint(msg.sender, defaultMint); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tooling/reorgs/README.md: -------------------------------------------------------------------------------- 1 | # Reorg integration tests 2 | 3 | This directory contains tests for chain reorganization. 4 | 5 | ## How to run 6 | 7 | First, compile the `ethrex` binary if you haven't already: 8 | 9 | ```bash 10 | cargo build --workspace --bin ethrex 11 | ``` 12 | 13 | Then, run the reorg tests using: 14 | 15 | ```bash 16 | cargo run 17 | ``` 18 | 19 | You can run a custom binary by specifying the path: 20 | 21 | ```bash 22 | cargo run -- /path/to/your/binary 23 | ``` 24 | -------------------------------------------------------------------------------- /.github/actions/free-disk/action.yml: -------------------------------------------------------------------------------- 1 | name: "Free disk space" 2 | description: "Remove unneeded dependencies to free disk space" 3 | 4 | runs: 5 | using: "composite" 6 | steps: 7 | - name: Remove .NET 8 | shell: bash 9 | run: sudo rm -rf /usr/share/dotnet/ 10 | 11 | - name: Remove Android SDK 12 | shell: bash 13 | run: sudo rm -rf /usr/local/lib/android 14 | 15 | - name: Remove Haskell 16 | shell: bash 17 | run: sudo rm -rf /opt/ghc /usr/local/.ghcup 18 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | **Motivation** 2 | 3 | 4 | 5 | **Description** 6 | 7 | 8 | 9 | 10 | 11 | **Checklist** 12 | 13 | - [ ] Updated `STORE_SCHEMA_VERSION` (crates/storage/lib.rs) if the PR includes breaking changes to the `Store` requiring a re-sync. 14 | 15 | Closes #issue_number 16 | 17 | -------------------------------------------------------------------------------- /tooling/ef_tests/blockchain/README.md: -------------------------------------------------------------------------------- 1 | # Blockchain Tests 2 | The blockchain tests test block validation and the consensus rules of the Ethereum blockchain. Tests are usually run for multiple forks. 3 | Some [docs](https://ethereum.github.io/execution-spec-tests/main/consuming_tests/blockchain_test/). 4 | 5 | ## Running the tests 6 | 7 | ```bash 8 | make test 9 | ``` 10 | 11 | ## Running the tests for either levm or revm 12 | 13 | ```bash 14 | make test-levm 15 | ``` 16 | or 17 | ```bash 18 | make test-revm 19 | ``` 20 | -------------------------------------------------------------------------------- /docs/l2/architecture/README.md: -------------------------------------------------------------------------------- 1 | # Architecture 2 | 3 | This section provides an overview of the architecture of an L2 rollup built with ethrex. Here you'll find: 4 | 5 | - High-level diagrams and explanations of the main components 6 | - Details on how the sequencer, prover, and other modules interact 7 | - Information about aligned mode, the prover, the sequencer, and more 8 | 9 | Use this section to understand how the different parts of an ethrex L2 fit together. The [overview](./overview.md) is a good place to start. 10 | -------------------------------------------------------------------------------- /.github/actions/install-risc0/action.yml: -------------------------------------------------------------------------------- 1 | name: "Install RISC0" 2 | description: "Install RISC0 Toolchain" 3 | 4 | runs: 5 | using: "composite" 6 | steps: 7 | - name: Install RISC0 8 | shell: bash 9 | run: | 10 | curl -L https://risczero.com/install | bash 11 | ~/.risc0/bin/rzup install cargo-risczero 3.0.3 12 | ~/.risc0/bin/rzup install risc0-groth16 13 | ~/.risc0/bin/rzup install rust 14 | ~/.risc0/bin/rzup install cpp 15 | ~/.risc0/bin/rzup install r0vm 3.0.3 16 | -------------------------------------------------------------------------------- /docs/l2/interacting/README.md: -------------------------------------------------------------------------------- 1 | # Interacting with the L2 2 | 3 | This section explains how to interact with your L2 rollup built with ethrex. Here you'll find guides for: 4 | 5 | - [Depositing](./deposit.md) and [withdrawing](./withdraw.md) assets 6 | - [Connecting wallets](./wallet.md) like MetaMask 7 | - [Deploying](./deploy_contracts.md) smart contracts 8 | - Maintaining and operating the sequencer 9 | - [Interacting with shared bridge](./shared_bridge.md) 10 | 11 | Use these guides to perform common actions and manage your L2 network. 12 | -------------------------------------------------------------------------------- /crates/common/rlp/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-rlp" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | tinyvec = "1.6.0" 10 | thiserror.workspace = true 11 | bytes.workspace = true 12 | hex.workspace = true 13 | lazy_static.workspace = true 14 | ethereum-types.workspace = true 15 | snap.workspace = true 16 | 17 | [dev-dependencies] 18 | hex-literal.workspace = true 19 | [lib] 20 | path = "./rlp.rs" 21 | 22 | [lints] 23 | workspace = true 24 | -------------------------------------------------------------------------------- /crates/networking/rpc/clients/beacon/errors.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, thiserror::Error)] 2 | pub enum BeaconClientError { 3 | #[error("reqwest error: {0}")] 4 | ReqwestError(#[from] reqwest::Error), 5 | #[error("Beacon RPC error (code: {0}): {1}")] 6 | RpcError(u64, String), 7 | #[error("Response deserialization error: {0}")] 8 | DeserializeError(#[from] serde_json::Error), 9 | #[error("Failed to set url endpoint: {0}")] 10 | FailedToSetURLEndpointError(String), 11 | #[error("Error: {0}")] 12 | Custom(String), 13 | } 14 | -------------------------------------------------------------------------------- /tooling/ef_tests/state_v2/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: help run-tests clean-reports 2 | 3 | help: ## 📚 Show help for each of the Makefile recipes 4 | @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' 5 | 6 | run-tests: ## 🧪 Run all tests with optional flags. Usage: make run-tests flags="--flag1 --flag2" 7 | cargo test --package ef_tests-statev2 --test all --release -- $(flags) 8 | 9 | clean-reports: ## 🗑️ Delete all generated test reports 10 | rm -rf ./reports 11 | 12 | -------------------------------------------------------------------------------- /.github/config/assertoor/syncing-check.yaml: -------------------------------------------------------------------------------- 1 | id: synced-check 2 | name: "Check Client synced" 3 | timeout: 12h 4 | tasks: 5 | - name: run_tasks_concurrent 6 | title: "Check if EL & CL clients are synced" 7 | config: 8 | tasks: 9 | - name: check_consensus_sync_status 10 | title: "Check if CL client is synced" 11 | config: 12 | pollInterval: 60s 13 | - name: check_execution_sync_status 14 | title: "Check if EL client is synced" 15 | config: 16 | pollInterval: 60s 17 | -------------------------------------------------------------------------------- /crates/common/evm.rs: -------------------------------------------------------------------------------- 1 | use ethereum_types::Address; 2 | use ethrex_crypto::keccak::keccak_hash; 3 | use ethrex_rlp::encode::RLPEncode; 4 | 5 | /// Calculates the address of a new conctract using the CREATE 6 | /// opcode as follows: 7 | /// 8 | /// address = keccak256(rlp([sender_address,sender_nonce]))[12:] 9 | pub fn calculate_create_address(sender_address: Address, sender_nonce: u64) -> Address { 10 | let mut encoded = Vec::new(); 11 | (sender_address, sender_nonce).encode(&mut encoded); 12 | Address::from_slice(&keccak_hash(encoded)[12..]) 13 | } 14 | -------------------------------------------------------------------------------- /docs/internal/l2/README.md: -------------------------------------------------------------------------------- 1 | # L2 developer guides 2 | 3 | ## Chain IDs 4 | 5 | In an intent to standarize the deployed chains by the team, we decided to use the following convention for the chain IDs: 6 | 7 | - All chains will have ID `65536XYY`. 8 | - `X` is the stage of the chain: 9 | - `0`: Mainnet 10 | - `1`: Testnet 11 | - `2..9`: Staging 1..7 12 | - `YY` is a number assigned to each deployed rollup. This could be a client, a project, etc. (e.g., Rogue could be 00). 13 | 14 | Following this, the default chain ID set for local development is `65536999`. 15 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/contracts/erc20/ERC20Mint.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.17; 3 | 4 | import "./lib/ERC20.sol"; 5 | 6 | contract ERC20Mint is ERC20 { 7 | constructor() ERC20("ERC20_Mint", "E20_MINT") {} 8 | 9 | function Benchmark(uint256 n) external returns (uint256 result) { 10 | address testAddress = 0x1234567890123456789012345678901234567890; 11 | for (uint256 i = 0; i < n; i++) { 12 | _mint(testAddress, i); 13 | } 14 | return balanceOf(testAddress); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/contracts/FibonacciRecursive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.17; 3 | 4 | contract FibonacciRecursive { 5 | function Benchmark(uint256 n) public view returns (uint256 result) { 6 | if (n <= 1) return n; 7 | 8 | uint256 rec = this.Benchmark(n - 1) + this.Benchmark(n - 2); 9 | 10 | // Check for overflow 11 | if (rec > (type(uint256).max / n)) { 12 | return type(uint256).max; 13 | } 14 | 15 | result = rec; 16 | return result; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /docs/l1/running/README.md: -------------------------------------------------------------------------------- 1 | # Running an Ethereum Node with ethrex 2 | 3 | This section explains how to run an Ethereum L1 node using ethrex. Here you'll find: 4 | 5 | - Requirements for running a node (including the need for a consensus client) 6 | - Step-by-step instructions for setup and configuration 7 | - Guidance for both new and experienced users 8 | 9 | If you already have a consensus client running, you can skip directly to the [node startup instructions](./startup.md). Otherwise, continue to the next section for help [setting up a consensus client](./consensus_client.md). 10 | -------------------------------------------------------------------------------- /crates/common/errors.rs: -------------------------------------------------------------------------------- 1 | #[derive(thiserror::Error, Debug)] 2 | pub enum EcdsaError { 3 | #[cfg(all( 4 | not(feature = "zisk"), 5 | not(feature = "risc0"), 6 | not(feature = "sp1"), 7 | feature = "secp256k1" 8 | ))] 9 | #[error("secp256k1 error: {0}")] 10 | Secp256k1(#[from] secp256k1::Error), 11 | #[cfg(any( 12 | feature = "zisk", 13 | feature = "risc0", 14 | feature = "sp1", 15 | not(feature = "secp256k1") 16 | ))] 17 | #[error("k256 error: {0}")] 18 | K256(#[from] k256::ecdsa::Error), 19 | } 20 | -------------------------------------------------------------------------------- /docs/getting-started/installation/README.md: -------------------------------------------------------------------------------- 1 | # Installation 2 | 3 | Ethrex is designed to run on Linux and macOS. 4 | 5 | There are 4 supported methods to install ethrex: 6 | 7 | - [Binary distribution](./binary_distribution.md) 8 | - [Package manager](./package_manager.md) 9 | - [Docker image](./docker_images.md) 10 | - [Building from source](./building_from_source.md) 11 | 12 | After following the installation steps you should have a binary that can [run an L1 client](../../l1/running/README.md) or a [multi-prover ZK-rollup](../../l2/introduction.md) with support for SP1, RISC Zero and TEEs. 13 | -------------------------------------------------------------------------------- /crates/common/types/mod.rs: -------------------------------------------------------------------------------- 1 | mod account; 2 | mod account_update; 3 | pub mod blobs_bundle; 4 | mod block; 5 | pub mod block_execution_witness; 6 | mod constants; 7 | mod fork_id; 8 | mod genesis; 9 | pub mod l2; 10 | pub mod payload; 11 | mod receipt; 12 | pub mod requests; 13 | pub mod transaction; 14 | pub mod tx_fields; 15 | 16 | pub use account::*; 17 | pub use account_update::*; 18 | pub use blobs_bundle::*; 19 | pub use block::*; 20 | pub use constants::*; 21 | pub use fork_id::*; 22 | pub use genesis::*; 23 | pub use l2::*; 24 | pub use receipt::*; 25 | pub use transaction::*; 26 | pub use tx_fields::*; 27 | -------------------------------------------------------------------------------- /crates/vm/levm/src/opcode_handlers/exchange.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | errors::{OpcodeResult, VMError}, 3 | gas_cost, 4 | vm::VM, 5 | }; 6 | 7 | // Exchange Operations (16) 8 | // Opcodes: SWAP1 ... SWAP16 9 | 10 | impl<'a> VM<'a> { 11 | // SWAP operation 12 | pub fn op_swap(&mut self) -> Result { 13 | let current_call_frame = &mut self.current_call_frame; 14 | current_call_frame.increase_consumed_gas(gas_cost::SWAPN)?; 15 | 16 | current_call_frame.stack.swap::()?; 17 | 18 | Ok(OpcodeResult::Continue) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /crates/l2/storage/src/error.rs: -------------------------------------------------------------------------------- 1 | use thiserror::Error; 2 | 3 | // TODO improve errors 4 | #[derive(Debug, Error)] 5 | pub enum RollupStoreError { 6 | #[error("DecodeError")] 7 | DecodeError, 8 | #[cfg(feature = "sql")] 9 | #[error("Limbo Query error: {0}")] 10 | SQLQueryError(#[from] libsql::Error), 11 | #[cfg(feature = "sql")] 12 | #[error("SQL Query error: unexpected type found while querying DB")] 13 | SQLInvalidTypeError, 14 | #[error("{0}")] 15 | Custom(String), 16 | #[error("Bincode (de)serialization error: {0}")] 17 | BincodeError(#[from] bincode::Error), 18 | } 19 | -------------------------------------------------------------------------------- /docs/l2/architecture/components.md: -------------------------------------------------------------------------------- 1 | # Components 2 | 3 | Here we have documentation about each component of the ethrex L2: 4 | 5 | - [Sequencer](./sequencer.md): Describes the components and configuration of the L2 sequencer node. 6 | - [Contracts](../contracts.md): Explains the L1 and L2 smart contracts used by the system. 7 | - [Prover](./prover.md): Details how block execution proofs are generated and verified using zkVMs. 8 | - [Aligned mode](./aligned_mode.md): Explains how to run an Ethrex L2 node in Aligned mode. 9 | - [TDX execution module](./tdx.md): Documentation related to proving ethrex blocks using TDX. 10 | -------------------------------------------------------------------------------- /crates/common/types/payload.rs: -------------------------------------------------------------------------------- 1 | use super::{BlobsBundle, Block, requests::EncodedRequests}; 2 | use ethereum_types::U256; 3 | 4 | #[derive(Debug, Clone)] 5 | pub struct PayloadBundle { 6 | pub block: Block, 7 | pub block_value: U256, 8 | pub blobs_bundle: BlobsBundle, 9 | pub requests: Vec, 10 | } 11 | 12 | impl PayloadBundle { 13 | pub fn from_block(block: Block) -> Self { 14 | PayloadBundle { 15 | block, 16 | block_value: U256::zero(), 17 | blobs_bundle: BlobsBundle::empty(), 18 | requests: Vec::default(), 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /docs/lectures.md: -------------------------------------------------------------------------------- 1 | # Recommended lectures 2 | 3 | > __Disclaimer__: This section is under development. We’ll continue to expand it with more up-to-date materials over time. 4 | 5 | For those interested in deepening their understanding of Ethereum internals, execution clients, and related zero-knowledge and distributed systems topics, we recommend the following materials: 6 | 7 | - [ENDGAME: How MegaETH bridges throughput and decentralization](https://x.com/megaeth_labs/status/1978854478943256986?s=12) 8 | 9 | - [ENDGAME: How SALT breaks the bottleneck that's been strangling blockchains](https://x.com/megaeth_labs/status/1962902246573879530?s=12) -------------------------------------------------------------------------------- /.github/workflows/pr_perf_changelog.yml: -------------------------------------------------------------------------------- 1 | name: Perf Changelog 2 | on: 3 | pull_request: 4 | types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled] 5 | 6 | permissions: 7 | contents: read 8 | pull-requests: write 9 | 10 | jobs: 11 | # Enforces the update of a changelog file on every pull request 12 | # We only want this for perf-related changes for now, so we add a few labels 13 | # for which the check is skipped 14 | changelog: 15 | if: contains(github.event.pull_request.labels.*.name, 'performance') 16 | runs-on: ubuntu-latest 17 | steps: 18 | - uses: dangoslen/changelog-enforcer@v3 19 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/contracts/erc20/ERC20Transfer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.17; 3 | 4 | import "./lib/ERC20.sol"; 5 | 6 | contract ERC20Transfer is ERC20 { 7 | constructor() ERC20("ERC20_Transfer", "E20_TRANSFER") {} 8 | 9 | function Benchmark(uint256 n) external returns (uint256 result) { 10 | address testAddress = 0x1234567890123456789012345678901234567890; 11 | _mint(_msgSender(), 10000 * 10**decimals()); 12 | for (uint256 i = 0; i < n; i++) { 13 | transfer(testAddress, i); 14 | } 15 | return balanceOf(testAddress); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/contracts/Fibonacci.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.17; 3 | 4 | contract Fibonacci { 5 | function Benchmark(uint256 n) public pure returns (uint256 result) { 6 | if (n <= 1) return n; 7 | 8 | uint256 a = 0; 9 | uint256 b = 1; 10 | 11 | for (uint256 i = 2; i <= n; i++) { 12 | // Check for overflow 13 | if (b > (type(uint256).max - a)) { 14 | return type(uint256).max; 15 | } 16 | (a, b) = (b, a + b); 17 | } 18 | 19 | result = b; 20 | return result; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/contracts/FactorialRecursive.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.0; 3 | 4 | contract FactorialRecursive { 5 | function Benchmark(uint256 n) public view returns (uint256) { 6 | // Base cases 7 | if (n == 0 || n == 1) { 8 | return 1; 9 | } 10 | 11 | // Recursive call via external function 12 | uint256 rec = this.Benchmark(n - 1); 13 | 14 | // Check for overflow 15 | if (rec > (type(uint256).max / n)) { 16 | return type(uint256).max; 17 | } 18 | 19 | return n * rec; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /crates/vm/levm/src/opcode_handlers/dup.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | errors::{OpcodeResult, VMError}, 3 | gas_cost, 4 | vm::VM, 5 | }; 6 | 7 | // Duplication Operation (16) 8 | // Opcodes: DUP1 ... DUP16 9 | 10 | impl<'a> VM<'a> { 11 | // DUP operation 12 | pub fn op_dup(&mut self) -> Result { 13 | // Increase the consumed gas 14 | self.current_call_frame 15 | .increase_consumed_gas(gas_cost::DUPN)?; 16 | 17 | // Duplicate the value at the specified depth 18 | self.current_call_frame.stack.dup::()?; 19 | 20 | Ok(OpcodeResult::Continue) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /docs/l2/deployment/prover/README.md: -------------------------------------------------------------------------------- 1 | # Run a prover 2 | 3 | This section provides step-by-step guides for running an ethrex L2 prover, which is responsible for generating ZK proofs for L2 blocks. These proofs are then submitted to L1 for verification, finalizing the state of your L2. 4 | 5 | Use this section to choose which prover setup best fits your already deployed ethrex L2 and follow the instructions accordingly. 6 | 7 | - [Overview](./overview.md) 8 | - [Running an ethrex L2 SP1 prover](./sp1.md) 9 | - [Running an ethrex L2 RISC0 prover](./risc0.md) 10 | - [Running an ethrex L2 TDX prover](./tee.md) 11 | - [Running multiple provers](./multi-prover.md) 12 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/contracts/Factorial.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.17; 3 | 4 | contract Factorial { 5 | function Benchmark(uint256 n) public pure returns (uint256 result) { 6 | if (n == 0 || n == 1) { 7 | return 1; 8 | } 9 | 10 | result = 1; 11 | for (uint256 i = 2; i <= n; i++) { 12 | // Check for overflow 13 | if (result > (type(uint256).max / i)) { 14 | return type(uint256).max; 15 | } else { 16 | result *= i; 17 | } 18 | } 19 | 20 | return result; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tooling/load_test/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "load_test" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | clap.workspace = true 10 | hex.workspace = true 11 | secp256k1.workspace = true 12 | ethereum-types.workspace = true 13 | ethrex-rpc.workspace = true 14 | ethrex-sdk.workspace = true 15 | ethrex-blockchain.workspace = true 16 | ethrex-common.workspace = true 17 | ethrex-l2-common.workspace = true 18 | ethrex-l2-rpc.workspace = true 19 | eyre.workspace = true 20 | tokio = { workspace = true, features = ["full"] } 21 | futures = "0.3" 22 | url.workspace = true 23 | -------------------------------------------------------------------------------- /crates/vm/levm/runner/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "runner" 3 | version = "0.1.0" 4 | edition = "2024" 5 | 6 | [dependencies] 7 | ethrex-levm = { path = "../" } 8 | ethrex-vm.workspace = true 9 | ethrex-common.workspace = true 10 | ethrex-storage.workspace = true 11 | ethrex-blockchain.workspace = true 12 | hex.workspace = true 13 | bytes.workspace = true 14 | serde = { workspace = true, features = ["derive", "rc"] } 15 | serde_json.workspace = true 16 | json5 = "0.4.1" 17 | clap.workspace = true 18 | log = "0.4.27" 19 | env_logger = "0.11.8" 20 | num-bigint = "0.4.6" 21 | num-traits = "0.2.19" 22 | rustc-hash.workspace = true 23 | 24 | [lints] 25 | workspace = true 26 | -------------------------------------------------------------------------------- /crates/vm/levm/src/db/mod.rs: -------------------------------------------------------------------------------- 1 | use crate::errors::DatabaseError; 2 | use ethrex_common::{ 3 | Address, H256, U256, 4 | types::{AccountState, ChainConfig, Code}, 5 | }; 6 | 7 | pub mod gen_db; 8 | 9 | pub trait Database: Send + Sync { 10 | fn get_account_state(&self, address: Address) -> Result; 11 | fn get_storage_value(&self, address: Address, key: H256) -> Result; 12 | fn get_block_hash(&self, block_number: u64) -> Result; 13 | fn get_chain_config(&self) -> Result; 14 | fn get_account_code(&self, code_hash: H256) -> Result; 15 | } 16 | -------------------------------------------------------------------------------- /.github/workflows/pr_lint_gha.yaml: -------------------------------------------------------------------------------- 1 | name: Github Actions 2 | on: 3 | pull_request: 4 | branches: ["**"] 5 | paths: 6 | - ".github/**.yaml" 7 | - ".github/*.yml" 8 | 9 | permissions: 10 | contents: read 11 | 12 | concurrency: 13 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 14 | cancel-in-progress: true 15 | 16 | jobs: 17 | lint: 18 | name: Lint 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: Checkout sources 22 | uses: actions/checkout@v4 23 | 24 | - name: actionlint 25 | uses: raven-actions/actionlint@v2 26 | with: 27 | flags: "-ignore SC2086 -ignore SC2006 -ignore SC2046" 28 | -------------------------------------------------------------------------------- /cmd/ethrex/networks/mainnet/bootnodes.json: -------------------------------------------------------------------------------- 1 | [ 2 | "enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@18.138.108.67:30303", 3 | "enode://22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de@3.209.45.79:30303", 4 | "enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303", 5 | "enode://4aeb4ab6c14b23e2c4cfdce879c04b0748a20d8e9b59e25ded2a08143e265c6c25936e74cbc8e641e3312ca288673d91f2f93f8e277de3cfa444ecdaaf982052@157.90.35.166:30303" 6 | ] 7 | -------------------------------------------------------------------------------- /crates/l2/prover/src/guest_program/src/risc0/NOTICE: -------------------------------------------------------------------------------- 1 | Original work Copyright [RISC Zero, Inc.] 2 | Copyright [2024] [LambdaClass] 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | -------------------------------------------------------------------------------- /.github/scripts/parse_test_result.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # To determine where the test summary ends, we use new lines. 4 | 5 | # Remove everything until the line that says "Summary: " 6 | resulting_text=$(awk '/Summary: /, 0' $1) 7 | 8 | empty_lines=$(echo "${resulting_text}" | awk '/^$/{print NR}') 9 | empty_lines=($empty_lines) 10 | 11 | resulting_text=$(echo "${resulting_text}" | sed -e "${empty_lines[0]}d") 12 | 13 | # We substract one because we deleted one before. This correction 14 | # shouldn't be needed if all lines are deleted as once 15 | empty_lines[1]=$((empty_lines[1] - 1)) 16 | 17 | resulting_text=$(echo "${resulting_text}" | sed -e "${empty_lines[1]},\$d") 18 | echo "${resulting_text}" 19 | -------------------------------------------------------------------------------- /cmd/ethrex/networks/holesky/bootnodes.json: -------------------------------------------------------------------------------- 1 | [ 2 | "enode://ac906289e4b7f12df423d654c5a962b6ebe5b3a74cc9e06292a85221f9a64a6f1cfdd6b714ed6dacef51578f92b34c60ee91e9ede9c7f8fadc4d347326d95e2b@146.190.13.128:30303", 3 | "enode://a3435a0155a3e837c02f5e7f5662a2f1fbc25b48e4dc232016e1c51b544cb5b4510ef633ea3278c0e970fa8ad8141e2d4d0f9f95456c537ff05fdf9b31c15072@178.128.136.233:30303", 4 | "enode://7fa09f1e8bb179ab5e73f45d3a7169a946e7b3de5ef5cea3a0d4546677e4435ee38baea4dd10b3ddfdc1f1c5e869052932af8b8aeb6f9738598ec4590d0b11a6@65.109.94.124:30303", 5 | "enode://3524632a412f42dee4b9cc899b946912359bb20103d7596bddb9c8009e7683b7bff39ea20040b7ab64d23105d4eac932d86b930a605e632357504df800dba100@172.174.35.249:30303" 6 | ] 7 | -------------------------------------------------------------------------------- /metrics/docker-compose-metrics-l2.overrides.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | prometheus: 3 | volumes: 4 | - ../metrics/provisioning/prometheus/prometheus_l2.yaml:/etc/prometheus/prometheus.yaml 5 | ports: 6 | - "9092:9090" 7 | extra_hosts: 8 | - "host.docker.internal:host-gateway" 9 | grafana: 10 | ports: 11 | - "3802:3000" 12 | volumes: 13 | - ../metrics/provisioning/grafana/dashboards/l2_dashboards:/etc/grafana/provisioning/dashboards/l2_dashboards 14 | - ../metrics/provisioning/grafana/dashboards/dashboard_config_l2.yaml:/etc/grafana/provisioning/dashboards/dashboard.yaml 15 | environment: 16 | - GF_SERVER_ROOT_URL=${GRAFANA_ROOT_URL:-http://localhost:3802} 17 | -------------------------------------------------------------------------------- /tooling/migrations/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "migrations" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | clap.workspace = true 10 | ethrex-blockchain.workspace = true 11 | ethrex-common.workspace = true 12 | ethrex-common-libmdbx = { git = "https://github.com/lambdaclass/ethrex", tag = "v1.0.0", package = "ethrex-common" } 13 | ethrex-storage-libmdbx = { features = [ 14 | "libmdbx", 15 | ], git = "https://github.com/lambdaclass/ethrex", tag = "v1.0.0", package = "ethrex-storage" } 16 | ethrex-storage = { features = ["rocksdb"], workspace = true } 17 | tokio = { features = ["full"], workspace = true } 18 | -------------------------------------------------------------------------------- /metrics/docker-compose-metrics.yaml: -------------------------------------------------------------------------------- 1 | # example: docker compose -f docker-compose-metrics.yaml -f docker-compose-metrics-l2.override.yaml up 2 | services: 3 | prometheus: 4 | image: prom/prometheus 5 | command: --config.file=/etc/prometheus/prometheus.yaml 6 | #volumes: defined in the .overrides file 7 | #ports: defined in the .overrides file 8 | grafana: 9 | image: grafana/grafana 10 | volumes: 11 | - ./provisioning/grafana/datasources:/etc/grafana/provisioning/datasources 12 | #ports: defined in the .overrides file 13 | environment: 14 | - GF_PLUGINS_PREINSTALL=yesoreyeram-infinity-datasource 15 | - L1_RPC_URL=${L1_RPC_URL} 16 | depends_on: 17 | - prometheus 18 | -------------------------------------------------------------------------------- /tooling/reorgs/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reorgs" 3 | version.workspace = true 4 | edition.workspace = true 5 | 6 | [dependencies] 7 | ethrex = { workspace = true, features = ["l2"] } 8 | ethrex-common.workspace = true 9 | ethrex-blockchain.workspace = true 10 | ethrex-rpc.workspace = true 11 | ethrex-config.workspace = true 12 | ethrex-l2-common.workspace = true 13 | ethrex-l2-rpc.workspace = true 14 | ethrex-p2p.workspace = true 15 | 16 | tokio.workspace = true 17 | tokio-util.workspace = true 18 | tracing.workspace = true 19 | rand.workspace = true 20 | sha2.workspace = true 21 | hex.workspace = true 22 | nix = { version = "0.30", features = ["signal"] } 23 | secp256k1.workspace = true 24 | url.workspace = true 25 | -------------------------------------------------------------------------------- /.github/scripts/publish_hive.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -euo pipefail 3 | 4 | WEBHOOK_URL="$1" 5 | BLOCKS_FILE="$2" 6 | RUN_URL="${3:-}" 7 | 8 | PAYLOAD=$(jq -c --arg run_url "$RUN_URL" ' 9 | .blocks += (if ($run_url | length) > 0 then [ 10 | { 11 | "type": "actions", 12 | "elements": [ 13 | { 14 | "type": "button", 15 | "text": { 16 | "type": "plain_text", 17 | "text": "View full breakdown" 18 | }, 19 | "url": $run_url 20 | } 21 | ] 22 | } 23 | ] else [] end) 24 | ' "$BLOCKS_FILE") 25 | 26 | printf '%s' "$PAYLOAD" | curl -X POST "$WEBHOOK_URL" \ 27 | -H 'Content-Type: application/json; charset=utf-8' \ 28 | --data @- 29 | -------------------------------------------------------------------------------- /crates/common/types/l2/batch.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | H256, 3 | types::{BlobsBundle, balance_diff::BalanceDiff}, 4 | }; 5 | use serde::{Deserialize, Serialize}; 6 | 7 | #[derive(Clone, Serialize, Deserialize, Debug, Default)] 8 | pub struct Batch { 9 | pub number: u64, 10 | pub first_block: u64, 11 | pub last_block: u64, 12 | pub state_root: H256, 13 | pub l1_in_messages_rolling_hash: H256, 14 | pub l2_in_message_rolling_hashes: Vec<(u64, H256)>, 15 | pub l1_out_message_hashes: Vec, 16 | pub non_privileged_transactions: u64, 17 | pub balance_diffs: Vec, 18 | pub blobs_bundle: BlobsBundle, 19 | pub commit_tx: Option, 20 | pub verify_tx: Option, 21 | } 22 | -------------------------------------------------------------------------------- /docs/developers/l1/dev-mode.md: -------------------------------------------------------------------------------- 1 | # Ethrex as a local development node 2 | 3 | ## Prerequisites 4 | 5 | This guide assumes you've read the dev [installation guide](../installing.md) 6 | 7 | ## Dev mode 8 | 9 | In dev mode ethrex acts as a local Ethereum development node it can be run with the following command 10 | 11 | ```sh 12 | ethrex --dev 13 | ``` 14 | 15 | Then you can use a tool like [rex](https://github.com/lambdaclass/rex) to make sure that the network is advancing 16 | 17 | ```sh 18 | rex block-number 19 | ``` 20 | 21 | Rich account private keys are listed at the folder `fixtures/keys/private_keys_l1.txt` located at the root of the repo. You can then use these keys to deploy contracts and send transactions in the localnet. 22 | -------------------------------------------------------------------------------- /crates/l2/build.rs: -------------------------------------------------------------------------------- 1 | use std::error::Error; 2 | use vergen_git2::{Emitter, Git2Builder}; 3 | 4 | // This build code is needed to add some env vars in order to construct the code version 5 | // VERGEN_GIT_SHA to get the git commit hash 6 | 7 | fn main() -> Result<(), Box> { 8 | // Export git commit hash and branch name as environment variables 9 | // When building tdx image with nix the commit version is stored as an env var 10 | if let Ok(sha) = std::env::var("VERGEN_GIT_SHA") { 11 | println!("cargo:rustc-env=VERGEN_GIT_SHA={}", sha.trim()); 12 | return Ok(()); 13 | } 14 | let git2 = Git2Builder::default().sha(true).build()?; 15 | 16 | Emitter::default().add_instructions(&git2)?.emit()?; 17 | Ok(()) 18 | } 19 | -------------------------------------------------------------------------------- /crates/storage/lib.rs: -------------------------------------------------------------------------------- 1 | // New unified storage interface 2 | pub mod api; 3 | pub mod backend; 4 | pub mod error; 5 | mod layering; 6 | pub mod rlp; 7 | pub mod store; 8 | pub mod trie; 9 | pub mod utils; 10 | 11 | pub use layering::apply_prefix; 12 | pub use store::{ 13 | AccountUpdatesList, EngineType, MAX_SNAPSHOT_READS, STATE_TRIE_SEGMENTS, Store, UpdateBatch, 14 | hash_address, hash_key, 15 | }; 16 | 17 | /// Store Schema Version, must be updated on any breaking change 18 | /// An upgrade to a newer schema version invalidates currently stored data, requiring a re-sync. 19 | pub const STORE_SCHEMA_VERSION: u64 = 1; 20 | 21 | /// Name of the file storing the metadata about the database 22 | pub const STORE_METADATA_FILENAME: &str = "metadata.json"; 23 | -------------------------------------------------------------------------------- /tooling/archive_sync/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "archive_sync" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | lazy_static.workspace = true 10 | ethrex-common.workspace = true 11 | ethrex-storage.workspace = true 12 | ethrex-rlp.workspace = true 13 | ethrex-rpc.workspace = true 14 | tokio.workspace = true 15 | tracing.workspace = true 16 | tracing-subscriber = { version = "0.3", features = ["fmt"] } 17 | clap = { workspace = true, features = ["string"] } 18 | clap_complete.workspace = true 19 | eyre.workspace = true 20 | reqwest.workspace = true 21 | serde.workspace = true 22 | serde_json.workspace = true 23 | hex.workspace = true 24 | ethrex.workspace = true 25 | -------------------------------------------------------------------------------- /fixtures/contracts/load_test/IOHeavyContract.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: UNLICENSED 2 | pragma solidity ^0.8.13; 3 | 4 | // Contract used in the `load-test-io` Makefile target. The test sends transactions calling 5 | // the `incrementNumbers()` function, which writes to 100 storage slots. 6 | 7 | contract Counter { 8 | uint256[100] public number; 9 | 10 | constructor() { 11 | for(uint i = 0; i < 100; i++) { 12 | number[i] = i; 13 | } 14 | } 15 | 16 | function incrementNumbers() public { 17 | for(uint i = 0; i < 100; i++) { 18 | number[i] = number[i] + 1; 19 | } 20 | } 21 | 22 | function getFirstNumber() public view returns(uint256) { 23 | return number[0]; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /crates/l2/tee/quote-gen/Makefile: -------------------------------------------------------------------------------- 1 | # image.raw is set to phony because the list of files that require rebuilding it is huge 2 | .PHONY: run clean image.raw 3 | 4 | IMAGE_NAME = ethrex-image_0.1.raw 5 | NIXPKGS_URL = https://github.com/NixOS/nixpkgs/archive/3fcbdcfc707e0aa42c541b7743e05820472bdaec.tar.gz 6 | GIT_REV := $(shell git rev-parse --short=7 HEAD) 7 | NIX_BUILD_ARGS = --no-out-link -I nixpkgs=$(NIXPKGS_URL) --argstr gitRev "$(GIT_REV)" 8 | 9 | image.raw: 10 | $(eval IMAGE := $(shell nix-build image.nix ${NIX_BUILD_ARGS})/${IMAGE_NAME}) 11 | cp $(IMAGE) image.raw 12 | chmod u+rw image.raw 13 | 14 | run: image.raw 15 | $(eval RUN_QEMU := $(shell nix-build hypervisor.nix ${NIX_BUILD_ARGS})/bin/run-qemu) 16 | $(RUN_QEMU) image.raw 17 | 18 | clean: 19 | rm image.raw 20 | -------------------------------------------------------------------------------- /crates/vm/db.rs: -------------------------------------------------------------------------------- 1 | use crate::EvmError; 2 | use dyn_clone::DynClone; 3 | use ethrex_common::{ 4 | Address, H256, U256, 5 | types::{AccountState, ChainConfig, Code}, 6 | }; 7 | 8 | pub trait VmDatabase: Send + Sync + DynClone { 9 | fn get_account_state(&self, address: Address) -> Result, EvmError>; 10 | fn get_storage_slot(&self, address: Address, key: H256) -> Result, EvmError>; 11 | fn get_block_hash(&self, block_number: u64) -> Result; 12 | fn get_chain_config(&self) -> Result; 13 | fn get_account_code(&self, code_hash: H256) -> Result; 14 | } 15 | 16 | dyn_clone::clone_trait_object!(VmDatabase); 17 | 18 | pub type DynVmDatabase = Box; 19 | -------------------------------------------------------------------------------- /docs/vm/levm/debug.md: -------------------------------------------------------------------------------- 1 | ### Debug Mode 2 | 3 | Debug mode currently enables printing in solidity by using a `print()` function that does an `MSTORE` with a specific offset to toggle the "print mode". If the VM is in debug mode it will recognize the offset as the "key" for enabling/disabling print mode. If print mode is enabled, MSTORE opcode stores into a buffer the data that the user wants to print, and when there is no more data left to read it prints it and disables the print mode so that execution continues normally. 4 | You can find the solidity code in the [fixtures](https://github.com/lambdaclass/ethrex/blob/4e0ed9cc3b4ccb818dbc37afb305726cc01cec55/fixtures/contracts/levm_print/Print.sol) of this repository. It can be tested with the `PrintTest` contract and it can be imported into another contracts. 5 | -------------------------------------------------------------------------------- /crates/blockchain/dev/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-dev" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | ethrex-rpc.workspace = true 12 | 13 | tokio.workspace = true 14 | tracing.workspace = true 15 | thiserror.workspace = true 16 | jsonwebtoken.workspace = true 17 | serde_json.workspace = true 18 | serde.workspace = true 19 | bytes.workspace = true 20 | ethereum-types.workspace = true 21 | hex.workspace = true 22 | reqwest = { version = "0.12.7", features = ["json"] } 23 | envy = "0.4.2" 24 | sha2 = "0.10.8" 25 | 26 | [lib] 27 | path = "./dev.rs" 28 | 29 | [lints] 30 | workspace = true 31 | -------------------------------------------------------------------------------- /docs/developers/l1/rocksdb-inspection.md: -------------------------------------------------------------------------------- 1 | # Database inspection 2 | 3 | For debugging purposes, you might want to inspect the contents of the database. 4 | 5 | You can use the [RocksDB tools](https://github.com/facebook/rocksdb/wiki/Administration-and-Data-Access-Tool) to query the current state of the snapshotting process. 6 | 7 | You may need to build rocksdb from source, since distributions might package outdated versions not supporting newer formats. 8 | 9 | The procedure for doing that, in Debian 12, is: 10 | ``` 11 | sudo apt install libgflags-dev libsnappy-dev zlib1g-dev libbz2-dev liblz4-dev libzstd-dev 12 | git clone https://github.com/facebook/rocksdb.git 13 | cd rocksdb 14 | make all 15 | ``` 16 | 17 | You can then use the ldb tool to query or modify (ensure the node is offline!) the state. 18 | -------------------------------------------------------------------------------- /.github/workflows/pr_perf_trie.yml: -------------------------------------------------------------------------------- 1 | name: Benchmark Trie 2 | 3 | on: 4 | workflow_call: 5 | pull_request: 6 | branches: ["**"] 7 | paths: 8 | - "crates/common/trie/**" 9 | 10 | permissions: 11 | contents: read 12 | issues: write 13 | pull-requests: write 14 | 15 | jobs: 16 | build-ethrex-trie: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: Checkout sources 20 | uses: actions/checkout@v4 21 | - name: Setup Rust Environment 22 | uses: ./.github/actions/setup-rust 23 | 24 | - name: Benchmarks 25 | uses: boa-dev/criterion-compare-action@v3 26 | with: 27 | cwd: "crates/common/trie" 28 | benchName: "trie_bench" 29 | branchName: ${{ github.base_ref }} 30 | token: ${{ secrets.GITHUB_TOKEN }} 31 | -------------------------------------------------------------------------------- /crates/common/trie/README.md: -------------------------------------------------------------------------------- 1 | ## Ethrex-Trie 2 | This is the implementation of the State Trie (a Merkle Patricia Trie) used 3 | by Ethrex. 4 | 5 | ### Benchmarking 6 | To measure the performance of our implementation, we have a simple benchmark 7 | that compares against [citahub's cita_trie implementation](https://github.com/citahub/cita_trie/tree/master). 8 | 9 | To run it, you'll need rust installed of course, and you 10 | can run a comparison with: 11 | ```bash 12 | make bench 13 | ``` 14 | Benches are in the `benches` folder. 15 | 16 | ### Useful Links 17 | - [Ethereum.org -- Merkle Patricia Trie](https://ethereum.org/es/developers/docs/data-structures-and-encoding/patricia-merkle-trie/) 18 | - [Stack Exchange Discussion](https://ethereum.stackexchange.com/questions/130017/merkle-patricia-trie-in-ethereum) 19 | -------------------------------------------------------------------------------- /docs/l2/introduction.md: -------------------------------------------------------------------------------- 1 | # Introduction 2 | 3 | Layer 2 (L2) solutions are protocols built on top of Ethereum to increase scalability and reduce transaction costs. L2s process transactions off-chain and, in the case of Rollups, they periodically post data or proofs back to Ethereum Layer 1, inheriting its security. 4 | 5 | **Ethrex** is a framework that lets you launch your own L2 rollup or blockchain. With ethrex, you can deploy, run, and experiment with custom L2 networks, taking advantage of Ethereum's security while enabling high throughput and low fees. 6 | 7 | ## Get started with your L2 8 | 9 | Check out the [Quickstart L2 guide](../getting-started/README.md#quickstart-l2) to start your rollup in just a command, or jump right into the [Deploy an L2](../l2/deployment/overview.md) for more detailed instructions. 10 | -------------------------------------------------------------------------------- /crates/l2/common/src/calldata.rs: -------------------------------------------------------------------------------- 1 | use ethrex_common::{Address, Bytes, U256}; 2 | use serde::{Deserialize, Serialize}; 3 | 4 | /// Struct representing the possible solidity types for function arguments 5 | /// - `Uint` -> `uint256` 6 | /// - `Address` -> `address` 7 | /// - `Bool` -> `bool` 8 | /// - `Bytes` -> `bytes` 9 | /// - `String` -> `string` 10 | /// - `Array` -> `T[]` 11 | /// - `Tuple` -> `(X_1, ..., X_k)` 12 | /// - `FixedArray` -> `T[k]` 13 | /// - `FixedBytes` -> `bytesN` 14 | #[derive(Serialize, Deserialize, Debug, PartialEq, Clone)] 15 | pub enum Value { 16 | Address(Address), 17 | Uint(U256), 18 | Int(U256), 19 | Bool(bool), 20 | Bytes(Bytes), 21 | String(String), 22 | Array(Vec), 23 | Tuple(Vec), 24 | FixedArray(Vec), 25 | FixedBytes(Bytes), 26 | } 27 | -------------------------------------------------------------------------------- /docs/l2/deployment/README.md: -------------------------------------------------------------------------------- 1 | # Deploy an L2 2 | 3 | This section provides step-by-step guides for deploying different types of ethrex L2 chains, including vanilla, validium, and based configurations, as well as a shared bridge enabled L2 and migrations bewteen versions. Each guide outlines the necessary commands and parameters to successfully deploy and start an L2 node. 4 | 5 | Use this section to choose the deployment method that best fits your needs and follow the instructions accordingly. 6 | 7 | - [Overview](./overview.md) 8 | - [Deploying a vanilla ethrex L2](./vanilla.md) 9 | - [Deploying a validium ethrex L2](./validium.md) 10 | - [Deploying a based ethrex L2](./based.md) 11 | - [Ethrex <> Aligned](./aligned.md) 12 | - [Deploying a shared bridge enabled L2](./shared_bridge.md) 13 | - [Migrations](./migrations.md) 14 | -------------------------------------------------------------------------------- /benches/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-benches" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | ethrex.workspace = true 10 | ethrex-blockchain.workspace = true 11 | ethrex-common.workspace = true 12 | ethrex-config.workspace = true 13 | ethrex-storage.workspace = true 14 | 15 | bytes.workspace = true 16 | tokio.workspace = true 17 | serde_json.workspace = true 18 | 19 | [dev-dependencies] 20 | criterion = { version = "0.5.1", features = [ 21 | "html_reports", 22 | "async_futures", 23 | "async_tokio", 24 | ] } 25 | secp256k1.workspace = true 26 | tempfile.workspace = true 27 | ethrex-l2-rpc.workspace = true 28 | 29 | [[bench]] 30 | name = "build_block_benchmark" 31 | harness = false 32 | 33 | [lints] 34 | workspace = true 35 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "revm_comparison" 3 | version = "0.1.0" 4 | edition = "2024" 5 | authors = ["LambdaClass"] 6 | 7 | [workspace] 8 | 9 | [lib] 10 | name = "revm_comparison" 11 | path = "src/lib.rs" 12 | 13 | [dependencies] 14 | ethrex-levm = { path = "../../" } 15 | ethrex-vm = { path = "../../.." } 16 | ethrex-common = { path = "../../../../common" } 17 | ethrex-crypto = { path = "../../../../common/crypto" } 18 | ethrex-storage = { path = "../../../../storage" } 19 | ethrex-blockchain = { path = "../../../../blockchain" } 20 | rustc-hash = "2.1.1" 21 | hex = "0.4.3" 22 | bytes = { version = "1.6.0", features = ["serde"] } 23 | 24 | revm = "9.0.0" 25 | 26 | [[bin]] 27 | name = "compile" 28 | path = "src/compile.rs" 29 | 30 | [[bin]] 31 | name = "benchmark" 32 | path = "src/benchmark.rs" 33 | -------------------------------------------------------------------------------- /crates/l2/prover/src/guest_program/src/sp1/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_main] 2 | 3 | use guest_program::{execution::execution_program, input::ProgramInput}; 4 | use rkyv::rancor::Error; 5 | 6 | sp1_zkvm::entrypoint!(main); 7 | 8 | pub fn main() { 9 | println!("cycle-tracker-report-start: read_input"); 10 | let input = sp1_zkvm::io::read_vec(); 11 | let input = rkyv::from_bytes::(&input).unwrap(); 12 | println!("cycle-tracker-report-end: read_input"); 13 | 14 | println!("cycle-tracker-report-start: execution"); 15 | let output = execution_program(input).unwrap(); 16 | println!("cycle-tracker-report-end: execution"); 17 | 18 | println!("cycle-tracker-report-start: commit_public_inputs"); 19 | sp1_zkvm::io::commit_slice(&output.encode()); 20 | println!("cycle-tracker-report-end: commit_public_inputs"); 21 | } 22 | -------------------------------------------------------------------------------- /cmd/ethrex/networks/sepolia/bootnodes.json: -------------------------------------------------------------------------------- 1 | [ 2 | "enode://4e5e92199ee224a01932a377160aa432f31d0b351f84ab413a8e0a42f4f36476f8fb1cbe914af0d9aef0d51665c214cf653c651c4bbd9d5550a934f241f1682b@138.197.51.181:30303", 3 | "enode://143e11fb766781d22d92a2e33f8f104cddae4411a122295ed1fdb6638de96a6ce65f5b7c964ba3763bba27961738fef7d3ecc739268f3e5e771fb4c87b6234ba@146.190.1.103:30303", 4 | "enode://8b61dc2d06c3f96fddcbebb0efb29d60d3598650275dc469c22229d3e5620369b0d3dedafd929835fe7f489618f19f456fe7c0df572bf2d914a9f4e006f783a9@170.64.250.88:30303", 5 | "enode://10d62eff032205fcef19497f35ca8477bea0eadfff6d769a147e895d8b2b8f8ae6341630c645c30f5df6e67547c03494ced3d9c5764e8622a26587b083b028e8@139.59.49.206:30303", 6 | "enode://9e9492e2e8836114cc75f5b929784f4f46c324ad01daf87d956f98b3b6c5fcba95524d6e5cf9861dc96a2c8a171ea7105bb554a197455058de185fa870970c7c@138.68.123.152:30303" 7 | ] 8 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/contracts/erc20/lib/IERC20Metadata.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | import "./IERC20.sol"; 7 | 8 | /** 9 | * @dev Interface for the optional metadata functions from the ERC20 standard. 10 | * 11 | * _Available since v4.1._ 12 | */ 13 | interface IERC20Metadata is IERC20 { 14 | /** 15 | * @dev Returns the name of the token. 16 | */ 17 | function name() external view returns (string memory); 18 | 19 | /** 20 | * @dev Returns the symbol of the token. 21 | */ 22 | function symbol() external view returns (string memory); 23 | 24 | /** 25 | * @dev Returns the decimals places of the token. 26 | */ 27 | function decimals() external view returns (uint8); 28 | } 29 | -------------------------------------------------------------------------------- /metrics/provisioning/grafana/alerting/contact_points.json: -------------------------------------------------------------------------------- 1 | { 2 | "apiVersion": 1, 3 | "contactPoints": [ 4 | { 5 | "orgId": 1, 6 | "name": "Slack", 7 | "receivers": [ 8 | { 9 | "uid": "aeojvx4vrfl6ob", 10 | "type": "slack", 11 | "settings": { 12 | "recipient": "${ALERTS_SLACK_CHANNEL}", 13 | "text": "{{ define \"slack.body\" -}}\n[$INSTANCE]\n{{ .CommonAnnotations.description }}\n{{- end }}\n{{ template \"slack.body\" . }}", 14 | "title": "{{ define \"slack.title\" -}}{{- if eq .Status \"firing\" -}}🚨{{- else -}}✅ [SOLVED]{{- end }} {{ .CommonAnnotations.summary }}{{- end }}{{ template \"slack.title\" . }}", 15 | "token": "${ALERTS_SLACK_TOKEN}" 16 | }, 17 | "disableResolveMessage": false 18 | } 19 | ] 20 | } 21 | ] 22 | } 23 | -------------------------------------------------------------------------------- /crates/l2/contracts/src/l2/interfaces/IERC20L2.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity =0.8.31; 3 | 4 | import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; 5 | 6 | /// @title Interface for an L2-capable token. 7 | /// @author LambdaClass 8 | /// @dev Uses the interface described in the ERC-7802 draft 9 | interface IERC20L2 is IERC20 { 10 | /// @notice Returns the address of the token on the L1 11 | /// @dev Used to verify token reception. 12 | function l1Address() external returns (address); 13 | 14 | /// @notice Mints tokens to the given address 15 | /// @dev Should be callable by the bridge 16 | function crosschainMint(address to, uint256 amount) external; 17 | 18 | /// @notice Burns tokens from the given address 19 | /// @dev Should be callable by the bridge 20 | function crosschainBurn(address from, uint256 amount) external; 21 | } 22 | -------------------------------------------------------------------------------- /crates/l2/contracts/src/l2/interfaces/IFeeToken.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity =0.8.31; 3 | 4 | import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; 5 | import "./IERC20L2.sol"; 6 | 7 | /// @title IFeeToken 8 | /// @notice Interface that L2 fee tokens must implement so the sequencer can lock and distribute fees. 9 | interface IFeeToken is IERC20, IERC20L2 { 10 | /// @notice Locks `amount` of tokens from `payer`. Must only be callable by the fee collector. 11 | /// @dev The L2 hook invokes this to reserve funds up-front. 12 | function lockFee(address payer, uint256 amount) external; 13 | 14 | /// @notice Pays `amount` of tokens to `receiver`. Must only be callable by the fee collector. 15 | /// @dev A zero receiver is treated as a burn by the reference implementation. 16 | function payFee(address receiver, uint256 amount) external; 17 | } 18 | -------------------------------------------------------------------------------- /docs/l2/interacting/wallet.md: -------------------------------------------------------------------------------- 1 | # Connect a Wallet 2 | 3 | You can connect your L2 network to MetaMask to interact with your rollup using a familiar wallet interface. 4 | 5 | ## Add Your L2 Network to MetaMask 6 | 7 | 1. Open MetaMask and click the network dropdown. 8 | 2. Select "Add custom network". 9 | 3. Enter your L2 network details: 10 | - **Network Name:** (choose any name, e.g. "My L2 Rollup") 11 | - **RPC URL:** `http://localhost:1729` (or your L2 node's RPC endpoint) 12 | - **Chain ID:** (use the chain ID from your L2 genesis config) 13 | - **Currency Symbol:** (e.g. ETH) 14 | - **Block Explorer URL:** (optional, can be left blank) 15 | 4. Save the network. 16 | 17 | You can now use MetaMask to send transactions and interact with contracts on your L2. 18 | 19 | > **Tip:** If you are running the L2 node on a remote server, replace `localhost` with the server's IP or domain. 20 | -------------------------------------------------------------------------------- /crates/common/rlp/error.rs: -------------------------------------------------------------------------------- 1 | use thiserror::Error; 2 | 3 | // TODO: improve errors 4 | #[derive(Debug, Error, PartialEq, Eq)] 5 | pub enum RLPDecodeError { 6 | #[error("InvalidLength")] 7 | InvalidLength, 8 | #[error("MalformedData")] 9 | MalformedData, 10 | #[error("MalformedBoolean")] 11 | MalformedBoolean, 12 | #[error("UnexpectedList")] 13 | UnexpectedList, 14 | #[error("UnexpectedString")] 15 | UnexpectedString, 16 | #[error("InvalidCompression")] 17 | InvalidCompression(#[from] snap::Error), 18 | #[error("IncompatibleProtocol: {0}")] 19 | IncompatibleProtocol(String), 20 | #[error("{0}")] 21 | Custom(String), 22 | } 23 | 24 | // TODO: improve errors 25 | #[derive(Debug, Error)] 26 | pub enum RLPEncodeError { 27 | #[error("InvalidCompression")] 28 | InvalidCompression(#[from] snap::Error), 29 | #[error("{0}")] 30 | Custom(String), 31 | } 32 | -------------------------------------------------------------------------------- /crates/networking/rpc/net/mod.rs: -------------------------------------------------------------------------------- 1 | use serde_json::{Value, json}; 2 | 3 | use crate::{ 4 | rpc::RpcApiContext, 5 | utils::{RpcErr, RpcRequest}, 6 | }; 7 | 8 | pub fn version(_req: &RpcRequest, context: RpcApiContext) -> Result { 9 | let chain_spec = context.storage.get_chain_config(); 10 | 11 | let value = serde_json::to_value(format!("{}", chain_spec.chain_id))?; 12 | Ok(value) 13 | } 14 | 15 | pub async fn peer_count(_req: &RpcRequest, mut context: RpcApiContext) -> Result { 16 | let Some(peer_handler) = &mut context.peer_handler else { 17 | return Err(RpcErr::Internal("Peer handler not initialized".to_string())); 18 | }; 19 | let total_peers = peer_handler 20 | .count_total_peers() 21 | .await 22 | .map_err(|e| RpcErr::Internal(format!("Could not retrieve peer count: {e}")))?; 23 | 24 | Ok(json!(format!("{:#x}", total_peers))) 25 | } 26 | -------------------------------------------------------------------------------- /docs/developers/l1/storage_api.md: -------------------------------------------------------------------------------- 1 | # Storage Backend API 2 | 3 | We use a thin, minimal interface for storage backends: 4 | 5 | - Thin: Minimal set of operations that databases must provide 6 | - Simple: Avoids type-system complexity and focuses on core functionality 7 | 8 | Rather than implementing business logic in each database backend, this API provides low-level primitives that higher-level code can build upon. 9 | This eliminates code duplication and makes adding new database backends trivial. 10 | 11 | The API differentiates between three types of database access: 12 | 13 | - Read views `StorageReadView`: read-only views of the database, with no atomicity guarantees between operations. 14 | - Write batches `StorageWriteBatch`: write batch functionality, with atomicity guarantees at commit time. 15 | - Locked views `StorageLockedView`: read-only views of a point in time (snapshots), right now it's only used during snap-sync. 16 | -------------------------------------------------------------------------------- /.github/workflows/pr_perf_build_block_bench.yml: -------------------------------------------------------------------------------- 1 | name: Benchmark Block building 2 | 3 | # This benchmark is put on manual mode until it's fixed. 4 | 5 | on: 6 | workflow_dispatch: 7 | #pull_request: 8 | #branches: ["**"] 9 | 10 | permissions: 11 | contents: read 12 | issues: write 13 | pull-requests: write 14 | 15 | jobs: 16 | build-block-benchmark: 17 | if: contains(github.event.pull_request.labels.*.name, 'performance') 18 | runs-on: ubuntu-latest 19 | steps: 20 | - name: Checkout sources 21 | uses: actions/checkout@v4 22 | - name: Setup Rust Environment 23 | uses: ./.github/actions/setup-rust 24 | 25 | - name: Benchmarks 26 | uses: boa-dev/criterion-compare-action@v3 27 | with: 28 | cwd: "benches/benches" 29 | benchName: "build_block_benchmark" 30 | branchName: ${{ github.base_ref }} 31 | token: ${{ secrets.GITHUB_TOKEN }} 32 | -------------------------------------------------------------------------------- /docs/developers/l2/dev-mode.md: -------------------------------------------------------------------------------- 1 | # Ethrex as a local L2 development node 2 | 3 | ## Prerequisites 4 | 5 | - This guide assumes you've read the dev [installation guide](../installing.md) 6 | - An Ethereum utility tool like [rex](https://github.com/lambdaclass/rex) 7 | 8 | ## Dev mode 9 | 10 | In dev mode ethrex acts as a local Ethereum development node and a local layer 2 rollup 11 | 12 | ```sh 13 | ethrex l2 --dev 14 | ``` 15 | 16 | after running the command the ethrex monitor will open with information about the status of the local L2. 17 | 18 | The default port of the L1 JSON-RPC is 8545 you can test it by running 19 | 20 | ```sh 21 | rex block-number http://localhost:8545 22 | ``` 23 | 24 | The default port of the L2 JSON-RPC is 1729 you can test it by running 25 | 26 | ```sh 27 | rex block-number http://localhost:1729 28 | ``` 29 | 30 | ## Guides 31 | 32 | For more information on how to perform certain operations, go to [Guides](). 33 | -------------------------------------------------------------------------------- /tooling/ef_tests/state_v2/src/main.rs: -------------------------------------------------------------------------------- 1 | #![allow(clippy::all)] 2 | 3 | use clap::Parser; 4 | use ef_tests_statev2::modules::{ 5 | error::RunnerError, 6 | parser::{RunnerOptions, parse_tests}, 7 | }; 8 | 9 | #[tokio::main] 10 | pub async fn main() -> Result<(), RunnerError> { 11 | let mut runner_options = RunnerOptions::parse(); 12 | println!("Runner options: {:#?}", runner_options); 13 | 14 | println!("\nParsing test files..."); 15 | let tests = parse_tests(&mut runner_options)?; 16 | 17 | println!("\nFinished parsing. Executing tests..."); 18 | 19 | if cfg!(feature = "block") { 20 | ef_tests_statev2::modules::block_runner::run_tests(tests.clone()).await?; 21 | } else { 22 | ef_tests_statev2::modules::runner::run_tests(tests).await?; 23 | } 24 | println!( 25 | "\nTests finished running. 26 | Find reports in the './reports' directory. 27 | " 28 | ); 29 | Ok(()) 30 | } 31 | -------------------------------------------------------------------------------- /crates/l2/prover/src/guest_program/src/openvm/src/main.rs: -------------------------------------------------------------------------------- 1 | use guest_program::{execution::execution_program, input::ProgramInput}; 2 | use openvm_keccak256::keccak256; 3 | use rkyv::rancor::Error; 4 | 5 | openvm::init!(); 6 | 7 | pub fn main() { 8 | openvm::io::println("start reading input"); 9 | let input = openvm::io::read_vec(); 10 | let input = rkyv::from_bytes::(&input).unwrap(); 11 | openvm::io::println("finish reading input"); 12 | 13 | openvm::io::println("start execution"); 14 | let output = execution_program(input).unwrap(); 15 | openvm::io::println("finish execution"); 16 | 17 | openvm::io::println("start hashing output"); 18 | let output = keccak256(&output.encode()); 19 | openvm::io::println("finish hashing output"); 20 | 21 | openvm::io::println("start revealing output"); 22 | openvm::io::reveal_bytes32(output); 23 | openvm::io::println("finish revealing output"); 24 | } 25 | -------------------------------------------------------------------------------- /tooling/l2/dev/README.md: -------------------------------------------------------------------------------- 1 | # L2 dev environment 2 | 3 | ## Usage 4 | 5 | 1. Download the docker compose 6 | 7 | curl -L https://raw.githubusercontent.com/lambdaclass/ethrex/main/tooling/l2/dev/docker-compose.yaml -o docker-compose.yaml 8 | 9 | 2. Start the containers 10 | 11 | ```shell 12 | docker compose up 13 | ``` 14 | 15 | this will launch: 16 | 17 | - on localhost:8083 blockscout explorer for L1 18 | - on localhost:8082 blockscout explorer for L2 19 | - on localhost:1729 l2 rpc 20 | - on localhost:8545 l1 rpc 21 | - on localhost:5173 ethrex L2 hub for withdrawals deposits and account abstraction 22 | 23 | 3. Stop the containers and delete the volumes 24 | 25 | > [!NOTE] 26 | > It is recommended to delete all the volumes because blockscout will keep the old state of the blockchain on its db 27 | > but ethrex l2 dev mode starts a new chain on every restart. For this reason we use the `-v` flag 28 | 29 | ```shell 30 | docker compose down -v 31 | ``` 32 | -------------------------------------------------------------------------------- /tooling/log_analysis/README.md: -------------------------------------------------------------------------------- 1 | # Log Analysis Notebook 2 | 3 | This tool is a Jupyter notebook to perform bottleneck analysis based on logs from a block import. 4 | 5 | ## Instructions 6 | 7 | 0. Make sure you have the [uv](https://docs.astral.sh/uv/) tool installed. We use it to manage dependencies. 8 | 1. Run an import with the execution client, saving the output to a file: 9 | ```shell 10 | cargo run --release --bin ethrex -- --network ./cmd/ethrex/networks/hoodi/genesis.json import ./hoodi-100k.rlp > import-100k.log 11 | ``` 12 | 2. Move the file to the `tooling/log_analysis` directory: 13 | ```shell 14 | mv import-100k.log tooling/log_analysis/import-100k.log 15 | ``` 16 | 3. Start the notebook: 17 | ```shell 18 | make notebook 19 | ``` 20 | 4. Go to the `kernel` menu and select `Restart Kernel and Run All Cells`; 21 | 5. Go to the bottom of the page, where you'll see the graphs showing participation of each step of the block import process per block. 22 | -------------------------------------------------------------------------------- /docs/developers/l1/kurtosis-localnet.md: -------------------------------------------------------------------------------- 1 | # Quick Start (L1 localnet) 2 | 3 | This page will show you how to quickly spin up a local development network with ethrex. 4 | 5 | ## Prerequisites 6 | 7 | - [Kurtosis](https://docs.kurtosis.com/install/#ii-install-the-cli) 8 | - [Rust](https://www.rust-lang.org/tools/install) 9 | - [Docker](https://docs.docker.com/engine/install/) 10 | 11 | ## Starting a local devnet 12 | 13 | ```shell 14 | make localnet 15 | ``` 16 | 17 | This make target will: 18 | 19 | 1. Build our node inside a docker image. 20 | 2. Fetch our fork [ethereum package](https://github.com/ethpandaops/ethereum-package), a private testnet on which multiple ethereum clients can interact. 21 | 3. Start the localnet with kurtosis. 22 | 23 | If everything went well, you should be faced with our client's logs (ctrl-c to leave). 24 | 25 | ## Stopping a local devnet 26 | 27 | To stop everything, simply run: 28 | 29 | ```shell 30 | make stop-localnet 31 | ``` 32 | -------------------------------------------------------------------------------- /crates/l2/contracts/src/l1/interfaces/ITDXVerifier.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity =0.8.31; 3 | 4 | /// @title TDX Verifier Interface 5 | /// @author LambdaClass 6 | /// @notice Interface for the TDX Verifier 7 | interface ITDXVerifier { 8 | /// @notice Verifies a proof with given payload and signature 9 | /// @dev The signature should correspond to an address previously registered with the verifier 10 | /// @param payload The payload to be verified 11 | /// @param signature The associated signature 12 | function verify( 13 | bytes calldata payload, 14 | bytes memory signature 15 | ) external view; 16 | 17 | /// @notice Registers the quote 18 | /// @dev The data required to verify the quote must be loaded to the PCCS contracts beforehand 19 | /// @param quote The TDX quote, which includes the address being registered 20 | function register( 21 | bytes calldata quote 22 | ) external; 23 | } 24 | -------------------------------------------------------------------------------- /crates/l2/docker-compose-l2-store.overrides.yaml: -------------------------------------------------------------------------------- 1 | # Mount and use database created from blobs, for the state reconstruct test. 2 | services: 3 | ethrex_l2: 4 | volumes: 5 | - ./store:/store 6 | command: > 7 | --network /genesis/l2.json 8 | --http.addr 0.0.0.0 9 | --http.port 1729 10 | --authrpc.port 8552 11 | --datadir /store 12 | --proof-coordinator.addr 0.0.0.0 13 | --block-producer.coinbase-address 0x0007a881CD95B1484fca47615B64803dad620C8d 14 | --block-producer.base-fee-vault-address 0x000c0d6b7c4516a5b274c51ea331a9410fe69127 15 | --committer.l1-private-key 0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b74924 16 | --proof-coordinator.l1-private-key 0x39725efee3fb28614de3bacaffe4cc4bd8c436257e2c8bb887c4b5c4be45e76d 17 | --l1.bridge-address 0x0000000000000000000000000000000000000000 18 | --l1.on-chain-proposer-address 0x0000000000000000000000000000000000000000 19 | --no-monitor 20 | -------------------------------------------------------------------------------- /.github/actions/setup-rust/action.yml: -------------------------------------------------------------------------------- 1 | name: 'Setup Rust Environment' 2 | description: 'Sets up Rust and caches dependencies' 3 | inputs: 4 | components: 5 | description: "Rust components to install (e.g., rustfmt, clippy)" 6 | required: false 7 | default: "" 8 | runs: 9 | using: "composite" 10 | steps: 11 | - name: Extract Rust version from rust-toolchain.toml 12 | id: rustver 13 | shell: bash 14 | run: | 15 | rust_version=$(grep -E '^[[:space:]]*channel[[:space:]]*=' rust-toolchain.toml \ 16 | | sed -E 's/.*"([^"]+)".*/\1/') 17 | echo "rust_version=${rust_version}" >>"$GITHUB_OUTPUT" 18 | echo "Rust version: ${rust_version}" 19 | 20 | - name: Install Rust 21 | uses: dtolnay/rust-toolchain@master 22 | with: 23 | toolchain: ${{ steps.rustver.outputs.rust_version }} 24 | components: ${{ inputs.components }} 25 | 26 | - name: Add Rust Cache 27 | uses: Swatinem/rust-cache@v2 28 | 29 | -------------------------------------------------------------------------------- /crates/blockchain/metrics/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-metrics" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | tokio = { workspace = true, optional = true } 12 | tracing = { workspace = true, optional = true } 13 | thiserror.workspace = true 14 | serde_json.workspace = true 15 | serde.workspace = true 16 | 17 | ethrex-common.workspace = true 18 | 19 | 20 | prometheus = { version = "0.13.4", features = ["process"], optional = true } 21 | axum = { workspace = true, optional = true } 22 | tracing-subscriber.workspace = true 23 | 24 | 25 | [lib] 26 | path = "./mod.rs" 27 | 28 | [features] 29 | default = ["api"] 30 | transactions = [] 31 | api = ["dep:axum", "dep:prometheus", "dep:tokio", "dep:tracing"] 32 | metrics = ["dep:prometheus"] 33 | 34 | [lints] 35 | workspace = true 36 | -------------------------------------------------------------------------------- /.github/workflows/pr-main_l2_tdx_build.yaml: -------------------------------------------------------------------------------- 1 | name: L2 TDX build 2 | on: 3 | push: 4 | branches: ["main"] 5 | pull_request: 6 | branches: ["**"] 7 | 8 | permissions: 9 | contents: read 10 | 11 | concurrency: 12 | group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} 13 | cancel-in-progress: true 14 | 15 | jobs: 16 | build_tdx: 17 | # "Test" is a required check, don't change the name 18 | name: Test 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: Checkout sources 22 | uses: actions/checkout@v4 23 | 24 | - name: Set up Nix 25 | uses: cachix/install-nix-action@v31 26 | 27 | - name: Build image 28 | run: | 29 | sudo sysctl kernel.unprivileged_userns_apparmor_policy=0 30 | sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0 31 | cd crates/l2/tee/quote-gen 32 | make image.raw || { echo "if fails run in the root of the project: make update-cargo-lock"; exit 1; } 33 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/contracts/erc20/lib/Context.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) 3 | 4 | pragma solidity ^0.8.0; 5 | 6 | /** 7 | * @dev Provides information about the current execution context, including the 8 | * sender of the transaction and its data. While these are generally available 9 | * via msg.sender and msg.data, they should not be accessed in such a direct 10 | * manner, since when dealing with meta-transactions the account sending and 11 | * paying for execution may not be the actual sender (as far as an application 12 | * is concerned). 13 | * 14 | * This contract is only required for intermediate, library-like contracts. 15 | */ 16 | abstract contract Context { 17 | function _msgSender() internal view virtual returns (address) { 18 | return msg.sender; 19 | } 20 | 21 | function _msgData() internal view virtual returns (bytes calldata) { 22 | return msg.data; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /crates/l2/prover/src/guest_program/src/zisk/src/main.rs: -------------------------------------------------------------------------------- 1 | #![no_main] 2 | 3 | use guest_program::{execution::execution_program, input::ProgramInput}; 4 | use rkyv::rancor::Error; 5 | use sha2::{Digest, Sha256}; 6 | 7 | ziskos::entrypoint!(main); 8 | 9 | pub fn main() { 10 | println!("start reading input"); 11 | let input = ziskos::read_input(); 12 | let input = rkyv::from_bytes::(&input).unwrap(); 13 | println!("finish reading input"); 14 | 15 | println!("start execution"); 16 | let output = execution_program(input).unwrap(); 17 | println!("finish execution"); 18 | 19 | println!("start hashing output"); 20 | let output = Sha256::digest(output.encode()); 21 | println!("finish hashing output"); 22 | 23 | println!("start revealing output"); 24 | output.chunks_exact(4).enumerate().for_each(|(idx, bytes)| { 25 | ziskos::set_output(idx, u32::from_le_bytes(bytes.try_into().unwrap())) 26 | }); 27 | println!("finish revealing output"); 28 | } 29 | -------------------------------------------------------------------------------- /crates/common/crypto/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-crypto" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [lib] 9 | path = "./lib.rs" 10 | 11 | [dependencies] 12 | # TODO(#1102): Move to Lambdaworks in the future 13 | c-kzg = { version = "2.1.1", default-features = false, optional = true } 14 | kzg-rs.workspace = true 15 | openvm-kzg = { git = "https://github.com/axiom-crypto/openvm-kzg.git", rev = "530a6ed413def5296b7e4967650ba4fc8fd92ea1", optional = true } # v1.4.1 16 | thiserror.workspace = true 17 | 18 | #[target.'cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))'.dependencies] 19 | tiny-keccak = { version = "2.0.2", features = ["keccak"] } 20 | 21 | [features] 22 | default = [] 23 | c-kzg = ["c-kzg/std", "c-kzg/ethereum_kzg_settings"] 24 | openvm-kzg = ["dep:openvm-kzg"] 25 | 26 | risc0 = ["c-kzg/std", "c-kzg/ethereum_kzg_settings", "c-kzg/portable"] 27 | openvm = ["openvm-kzg"] 28 | 29 | [lints] 30 | workspace = true 31 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/contracts/BubbleSort.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.17; 3 | 4 | contract BubbleSort { 5 | uint256[] public numbers; 6 | 7 | function Benchmark(uint256 amount) public returns (uint8 result) { 8 | // Fill array with random numbers 9 | for (uint256 i = 0; i < amount; i++) { 10 | numbers.push(uint256(keccak256(abi.encodePacked(block.timestamp, block.prevrandao, i))) % 100); 11 | } 12 | uint256 n = numbers.length; 13 | for (uint256 i = 0; i < n - 1; i++) { 14 | for (uint256 j = 0; j < n - i - 1; j++) { 15 | if (numbers[j] > numbers[j + 1]) { 16 | (numbers[j], numbers[j + 1]) = (numbers[j + 1], numbers[j]); 17 | } 18 | } 19 | } 20 | // Ensure the array is sorted 21 | for (uint256 i = 0; i < n - 1; i++) { 22 | require(numbers[i] <= numbers[i + 1]); 23 | } 24 | return 0; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /fixtures/networks/ethrex_only.yaml: -------------------------------------------------------------------------------- 1 | participants: 2 | - el_type: ethrex 3 | el_image: ethrex:local 4 | cl_type: lighthouse 5 | cl_image: sigp/lighthouse:v8.0.0-rc.1 6 | validator_count: 32 7 | ethereum_metrics_exporter_enabled: true 8 | - el_type: ethrex 9 | el_image: ethrex:local 10 | cl_type: teku 11 | cl_image: consensys/teku:25.6.0 12 | validator_count: 32 13 | ethereum_metrics_exporter_enabled: true 14 | # Not working on Mac 15 | # - el_type: ethrex 16 | # el_image: ethrex:local 17 | # cl_type: prysm 18 | # cl_image: gcr.io/offchainlabs/prysm/beacon-chain:v6.0.4 19 | # validator_count: 32 20 | # ethereum_metrics_exporter_enabled: true 21 | 22 | network_params: 23 | seconds_per_slot: 3 24 | 25 | additional_services: 26 | - spamoor 27 | - dora 28 | - prometheus_grafana 29 | 30 | spamoor_params: 31 | spammers: 32 | - scenario: erctx 33 | config: 34 | throughput: 750 35 | 36 | grafana_params: 37 | additional_dashboards: ["./ethrex_l1_perf.json"] 38 | -------------------------------------------------------------------------------- /crates/blockchain/metrics/l2/api.rs: -------------------------------------------------------------------------------- 1 | use axum::{Router, routing::get}; 2 | 3 | use crate::{MetricsApiError, api, l2::metrics::METRICS}; 4 | 5 | pub async fn start_prometheus_metrics_api( 6 | address: String, 7 | port: String, 8 | ) -> Result<(), MetricsApiError> { 9 | let app = Router::new() 10 | .route("/metrics", get(get_metrics)) 11 | .route("/health", get("Service Up")); 12 | 13 | // Start the axum app 14 | let listener = tokio::net::TcpListener::bind(&format!("{address}:{port}")).await?; 15 | axum::serve(listener, app).await?; 16 | 17 | Ok(()) 18 | } 19 | 20 | #[allow(unused_mut)] 21 | async fn get_metrics() -> String { 22 | let mut ret_string = api::get_metrics().await; 23 | 24 | ret_string.push('\n'); 25 | match METRICS.gather_metrics() { 26 | Ok(string) => ret_string.push_str(&string), 27 | Err(e) => { 28 | tracing::error!("Failed to register METRICS_L2: {e}"); 29 | return String::new(); 30 | } 31 | } 32 | 33 | ret_string 34 | } 35 | -------------------------------------------------------------------------------- /crates/l2/contracts/src/l2/interfaces/IFeeTokenRegistry.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity =0.8.31; 3 | 4 | interface IFeeTokenRegistry { 5 | /// @notice Emitted when a new fee token is registered. 6 | event FeeTokenRegistered(address indexed token); 7 | /// @notice Emitted when a fee token is unregistered. 8 | event FeeTokenUnregistered(address indexed token); 9 | 10 | /// @notice Returns true if the token is registered as a fee token. 11 | /// @param token The address of the token to check. 12 | /// @return True if the token is registered as a fee token, false otherwise. 13 | function isFeeToken(address token) external view returns (bool); 14 | 15 | /// @notice Registers a new fee token. 16 | /// @param token The address of the token to register. 17 | function registerFeeToken(address token) external; 18 | 19 | /// @notice Unregisters a fee token. 20 | /// @param token The address of the token to unregister. 21 | function unregisterFeeToken(address token) external; 22 | } 23 | -------------------------------------------------------------------------------- /docs/developers/l1/testing/load-tests.md: -------------------------------------------------------------------------------- 1 | # Load tests 2 | 3 | Before starting, consider increasing the maximum amount of open files for the current shell with the following command: 4 | 5 | ```bash 6 | ulimit -n 65536 7 | ``` 8 | 9 | To run a load test, first run the node using a command like the following in the root folder: 10 | 11 | ```bash 12 | cargo run --bin ethrex --release -- --network fixtures/genesis/load-test.json --dev 13 | ``` 14 | 15 | There are currently three different load tests you can run: 16 | 17 | The first one sends regular transfers between accounts, the second runs an EVM-heavy contract that computes fibonacci numbers, the third a heavy IO contract that writes to 100 storage slots per transaction. 18 | 19 | ```bash 20 | # Eth transfer load test 21 | make load-test 22 | 23 | # ERC 20 transfer load test 24 | make load-test-erc20 25 | 26 | # Tests a contract that executes fibonacci (high cpu) 27 | make load-test-fibonacci 28 | 29 | # Tests a contract that makes heavy access to storage slots 30 | make load-test-io 31 | ``` 32 | 33 | 34 | -------------------------------------------------------------------------------- /crates/vm/levm/runner/input_example.json: -------------------------------------------------------------------------------- 1 | { 2 | "fork": "Prague", 3 | "transaction": { 4 | "to": "0x000000000000000000000000000000000000beef", 5 | "sender": "0x000000000000000000000000000000000000dead", 6 | "gas_limit": "100000000000", 7 | "gas_price": "1", 8 | "value": "10000", 9 | "data": "0x" 10 | }, 11 | "pre": { 12 | "0x000000000000000000000000000000000000dead": { 13 | "balance": "100000000000000000000", 14 | "code": "0x", 15 | "storage": {} 16 | }, 17 | "0x000000000000000000000000000000000000beef": { 18 | "balance": "0", 19 | "code": "0x010101", 20 | "storage": { 21 | "0x0": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef", 22 | "0x3": "0xabc123" 23 | } 24 | } 25 | }, 26 | "initial_stack": [ 27 | "0x01", 28 | "0x02", 29 | "0x03", 30 | "0xf" 31 | ], 32 | "initial_memory": "0xdeadbeef" 33 | } 34 | -------------------------------------------------------------------------------- /tooling/ef_tests/state_v2/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ef_tests-statev2" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | ethrex-blockchain.workspace = true 10 | ethrex-common.workspace = true 11 | ethrex-storage.workspace = true 12 | ethrex-rlp.workspace = true 13 | ethrex-vm.workspace = true 14 | ethrex-levm.workspace = true 15 | ethrex-l2-rpc.workspace = true 16 | 17 | secp256k1.workspace = true 18 | serde.workspace = true 19 | serde_json.workspace = true 20 | bytes.workspace = true 21 | hex.workspace = true 22 | thiserror.workspace = true 23 | clap.workspace = true 24 | clap_complete.workspace = true 25 | tokio = { workspace = true, features = ["full"] } 26 | rustc-hash = "2.1.1" 27 | colored = "2.1.0" 28 | alloy-rlp = "0.3.12" 29 | chrono = "0.4" 30 | prettytable-rs = "0.10" 31 | 32 | [dev-dependencies] 33 | hex = "0.4.3" 34 | 35 | [features] 36 | default = ["c-kzg"] 37 | c-kzg = ["ethrex-vm/c-kzg", "ethrex-levm/c-kzg", "ethrex-common/c-kzg"] 38 | block = [] 39 | -------------------------------------------------------------------------------- /docs/l2/deployment/prover/tee.md: -------------------------------------------------------------------------------- 1 | # Run an ethrex TDX prover 2 | 3 | In this section, we'll guide you through the steps to run an ethrex L2 TDX prover for generating TEE proofs. These proofs are essential for validating batch execution and state settlement on your ethrex L2. 4 | 5 | ## Prerequisites 6 | 7 | - This guide assumes that you have already deployed an ethrex L2 with TDX enabled. If you haven't done so yet, please refer to one of the [Deploying an ethrex L2](../overview.md) guides. 8 | - A machine with TDX support [with the required setup](https://github.com/canonical/tdx). 9 | 10 | ## Start an ethrex L2 TDX prover 11 | 12 | There's no official release of our ethrex L2 TDX prover yet, so you need to build ethrex from source. To do this, clone the ethrex repository and run: 13 | 14 | ```shell 15 | git clone https://github.com/lambdaclass/ethrex.git 16 | 17 | cd ethrex/crates/l2/tee/quote-gen 18 | 19 | make run 20 | ``` 21 | 22 | > [!NOTE] 23 | > Refer to the [TDX guide](../../architecture/tdx.md) for more information on setting up and running the quote generator. 24 | -------------------------------------------------------------------------------- /fixtures/contracts/caller/Caller.bin: -------------------------------------------------------------------------------- 1 | 60808060405234601557610200908161001a8239f35b5f80fdfe6080806040526004361015610012575f80fd5b5f3560e01c633aada4d214610025575f80fd5b346101c65760407ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc3601126101c65760043573ffffffffffffffffffffffffffffffffffffffff811681036101c6576024359067ffffffffffffffff82116101c657366023830112156101c65781600401359267ffffffffffffffff84116101c65736602485850101116101c6575f8185829660248497018337810182815203925af13d156101c1573d67ffffffffffffffff811161019457604051907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f81601f8401160116820182811067ffffffffffffffff8211176101945760405281525f60203d92013e5b1561013657005b60646040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f43616c6c65723a2063616c6c20726576657274656400000000000000000000006044820152fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61012f565b5f80fdfea26469706673582212202184852d93d2cbaca39cee68cc4acfb9652dc23bcbf0d733f4641a8a3a8c135e64736f6c634300081d0033 -------------------------------------------------------------------------------- /crates/l2/prover/src/guest_program/src/openvm/openvm_init.rs: -------------------------------------------------------------------------------- 1 | // This file is automatically generated by cargo openvm. Do not rename or edit. 2 | openvm_algebra_guest::moduli_macros::moduli_init! { "21888242871839275222246405745257275088696311157297823662689037894645226208583", "21888242871839275222246405745257275088548364400416034343698204186575808495617", "115792089237316195423570985008687907853269984665640564039457584007908834671663", "115792089237316195423570985008687907852837564279074904382605163141518161494337", "115792089210356248762697446949407573530086143415290314195533631308867097853951", "115792089210356248762697446949407573529996955224135760342422259061068512044369", "4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787", "52435875175126190479447740508185965837690552500527637822603658699938581184513" } 3 | openvm_algebra_guest::complex_macros::complex_init! { "Bn254Fp2" { mod_idx = 0 }, "Bls12_381Fp2" { mod_idx = 6 } } 4 | openvm_ecc_guest::sw_macros::sw_init! { "Bn254G1Affine", "Secp256k1Point", "P256Point", "Bls12_381G1Affine" } 5 | -------------------------------------------------------------------------------- /crates/networking/p2p/discv4/codec.rs: -------------------------------------------------------------------------------- 1 | use crate::discv4::messages::{Message, Packet, PacketDecodeErr}; 2 | 3 | use bytes::BytesMut; 4 | use secp256k1::SecretKey; 5 | use tokio_util::codec::{Decoder, Encoder}; 6 | 7 | #[derive(Debug)] 8 | pub struct Discv4Codec { 9 | signer: SecretKey, 10 | } 11 | 12 | impl Discv4Codec { 13 | pub fn new(signer: SecretKey) -> Self { 14 | Self { signer } 15 | } 16 | } 17 | 18 | impl Decoder for Discv4Codec { 19 | type Item = Packet; 20 | type Error = PacketDecodeErr; 21 | 22 | fn decode(&mut self, buf: &mut BytesMut) -> Result, Self::Error> { 23 | if !buf.is_empty() { 24 | Ok(Some(Packet::decode(&buf.split_to(buf.len()))?)) 25 | } else { 26 | Ok(None) 27 | } 28 | } 29 | } 30 | 31 | impl Encoder for Discv4Codec { 32 | type Error = PacketDecodeErr; 33 | 34 | fn encode(&mut self, message: Message, buf: &mut BytesMut) -> Result<(), Self::Error> { 35 | message.encode_with_header(buf, &self.signer); 36 | Ok(()) 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/contracts/erc20/ERC20ApprovalTransfer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity ^0.8.17; 3 | 4 | import "./lib/ERC20.sol"; 5 | 6 | contract ERC20Approval is ERC20 { 7 | constructor() ERC20("ERC20Approval", "E20_APP") {} 8 | 9 | function Benchmark(uint256 n) external returns (uint256 result) { 10 | _mint(msg.sender, 1000000000 * 10**decimals()); 11 | for (uint256 i = 1; i < n; i++) { 12 | require( 13 | allowance(msg.sender, msg.sender) == 0, 14 | "Allowance at start is nonzero" 15 | ); 16 | approve(msg.sender, i); 17 | require( 18 | allowance(msg.sender, msg.sender) == i, 19 | "Sender has no allowance" 20 | ); 21 | transferFrom(msg.sender, msg.sender, i); 22 | require( 23 | allowance(msg.sender, msg.sender) == 0, 24 | "Allowance at end is nonzero" 25 | ); 26 | } 27 | return balanceOf(msg.sender); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tooling/ef_tests/blockchain/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ef_tests-blockchain" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | ethrex-blockchain.workspace = true 10 | ethrex-common.workspace = true 11 | ethrex-storage.workspace = true 12 | ethrex-rlp.workspace = true 13 | ethrex-vm.workspace = true 14 | ethrex-prover = { path = "../../../crates/l2/prover", default-features = false } 15 | guest_program = { path = "../../../crates/l2/prover/src/guest_program", default-features = false } 16 | 17 | serde.workspace = true 18 | serde_json.workspace = true 19 | bytes.workspace = true 20 | hex.workspace = true 21 | lazy_static.workspace = true 22 | tokio = { workspace = true, features = ["full"] } 23 | datatest-stable = "0.2.9" 24 | regex = "1.11.1" 25 | 26 | [lib] 27 | path = "./lib.rs" 28 | 29 | [features] 30 | default = ["c-kzg"] 31 | c-kzg = ["ethrex-blockchain/c-kzg"] 32 | sp1 = ["guest_program/sp1", "ethrex-prover/sp1"] 33 | stateless = [] 34 | 35 | [[test]] 36 | name = "all" 37 | harness = false 38 | -------------------------------------------------------------------------------- /crates/networking/rpc/lib.rs: -------------------------------------------------------------------------------- 1 | // This is added because otherwise some tests would fail due to reaching the recursion limit 2 | #![recursion_limit = "400"] 3 | 4 | mod admin; 5 | mod authentication; 6 | pub mod debug; 7 | mod engine; 8 | mod eth; 9 | mod mempool; 10 | mod net; 11 | mod rpc; 12 | mod tracing; 13 | 14 | pub mod clients; 15 | pub mod types; 16 | pub mod utils; 17 | pub use clients::{EngineClient, EthClient}; 18 | 19 | pub use rpc::{start_api, start_block_executor}; 20 | 21 | #[cfg(test)] 22 | mod test_utils; 23 | 24 | // TODO: These exports are needed by ethrex-l2-rpc, but we do not want to 25 | // export them in the public API of this crate. 26 | pub use eth::{ 27 | filter::{ActiveFilters, clean_outdated_filters}, 28 | gas_price::GasPrice, 29 | gas_tip_estimator::GasTipEstimator, 30 | transaction::EstimateGasRequest, 31 | }; 32 | pub use rpc::{ 33 | NodeData, RpcApiContext, RpcHandler, RpcRequestWrapper, map_debug_requests, map_eth_requests, 34 | map_http_requests, rpc_response, shutdown_signal, 35 | }; 36 | pub use utils::{RpcErr, RpcErrorMetadata, RpcNamespace}; 37 | -------------------------------------------------------------------------------- /crates/l2/docker-compose-l2-tdx.yaml: -------------------------------------------------------------------------------- 1 | # Docker Compose file to run ethrex_l2 with TDX support 2 | services: 3 | ethrex_l2: 4 | volumes: 5 | - ./tee/contracts/automata-dcap-qpl/automata-dcap-qpl-tool/target/release/automata-dcap-qpl-tool:/automata-dcap-qpl-tool:ro,exec 6 | - ../../cmd/.env:/env/.env 7 | environment: 8 | - ETHREX_PROOF_COORDINATOR_TDX_PRIVATE_KEY=${ETHREX_PROOF_COORDINATOR_TDX_PRIVATE_KEY:-0x39725efee3fb28614de3bacaffe4cc4bd8c436257e2c8bb887c4b5c4be45e76d} 9 | command: > 10 | --network /genesis/l2.json 11 | --http.addr 0.0.0.0 12 | --http.port 1729 13 | --authrpc.port 8552 14 | --proof-coordinator.addr 0.0.0.0 15 | --block-producer.coinbase-address 0x0007a881CD95B1484fca47615B64803dad620C8d 16 | --committer.l1-private-key 0x385c546456b6a603a1cfcaa9ec9494ba4832da08dd6bcf4de9a71e4a01b74924 17 | --proof-coordinator.l1-private-key 0x39725efee3fb28614de3bacaffe4cc4bd8c436257e2c8bb887c4b5c4be45e76d 18 | --proof-coordinator.qpl-tool-path /automata-dcap-qpl-tool 19 | --no-monitor 20 | 21 | volumes: 22 | env: null 23 | -------------------------------------------------------------------------------- /.github/actions/install-solc/action.yml: -------------------------------------------------------------------------------- 1 | name: Install solc 2 | description: Install solidity compiler 3 | 4 | inputs: 5 | version: 6 | description: "Solidity version (must be >= 0.8.31)" 7 | required: false 8 | default: "0.8.31" 9 | 10 | runs: 11 | using: "composite" 12 | steps: 13 | - id: vars 14 | shell: bash 15 | run: | 16 | if [[ "${{ runner.os }}" == "Linux" && "${{ runner.arch }}" == "X64" ]]; then 17 | sudo curl -L -o /usr/local/bin/solc https://github.com/argotorg/solidity/releases/download/v${{ inputs.version }}/solc-static-linux 18 | elif [[ "${{ runner.os }}" == "Linux" && "${{ runner.arch }}" == "ARM64" ]]; then 19 | sudo curl -L -o /usr/local/bin/solc https://github.com/argotorg/solidity/releases/download/v${{ inputs.version }}/solc-static-linux-arm 20 | elif [[ "${{ runner.os }}" == "macOS" ]]; then 21 | sudo curl -L -o /usr/local/bin/solc https://github.com/argotorg/solidity/releases/download/v${{ inputs.version }}/solc-macos 22 | fi 23 | sudo chmod +x /usr/local/bin/solc 24 | solc --version 25 | -------------------------------------------------------------------------------- /docs/l2/deployment/prover/multi-prover.md: -------------------------------------------------------------------------------- 1 | # Run multiple provers 2 | 3 | In this section, we'll guide you through the steps to run multiple ethrex L2 provers for generating ZK proofs using different backends. These proofs are essential for validating batch execution and state settlement on your ethrex L2. 4 | 5 | ## Prerequisites 6 | 7 | - This guide assumes that you have already deployed an ethrex L2 with TDX enabled. If you haven't done so yet, please refer to one of the [Deploying an ethrex L2](../overview.md) guides. 8 | 9 | ## Start multiple ethrex L2 provers 10 | 11 | Once you have your ethrex L2 deployed with multiple proving backends enabled (SP1, RISC0, TDX), refer to the following guides to start each prover: 12 | 13 | - [Run an ethrex L2 SP1 prover](./sp1.md) 14 | - [Run an ethrex L2 RISC0 prover](./risc0.md) 15 | - [Run an ethrex TDX prover](./tee.md) 16 | 17 | Each prover should be started in different machines to ensure they operate independently and efficiently. Make sure to configure each prover with the appropriate backend flag and proof coordinator URLs as specified in their respective guides. 18 | -------------------------------------------------------------------------------- /crates/l2/contracts/src/example/L2ERC20.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity =0.8.31; 3 | 4 | import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; 5 | import "../l2/interfaces/IERC20L2.sol"; 6 | 7 | /// @title Example L2-side bridgeable token 8 | /// @author LambdaClass 9 | contract TestTokenL2 is ERC20, IERC20L2 { 10 | address public L1_TOKEN = address(0); 11 | address public constant BRIDGE = 0x000000000000000000000000000000000000FFff; 12 | 13 | constructor(address l1Addr) ERC20("TestTokenL2", "TEST") { 14 | L1_TOKEN = l1Addr; 15 | } 16 | 17 | modifier onlyBridge() { 18 | require(msg.sender == BRIDGE, "TestToken: not authorized to mint"); 19 | _; 20 | } 21 | 22 | function l1Address() external view returns (address) { 23 | return L1_TOKEN; 24 | } 25 | 26 | function crosschainMint(address destination, uint256 amount) external onlyBridge { 27 | _mint(destination, amount); 28 | } 29 | 30 | function crosschainBurn(address from, uint256 value) external onlyBridge { 31 | _burn(from, value); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /crates/common/trie/rkyv_utils.rs: -------------------------------------------------------------------------------- 1 | use ethereum_types::H256; 2 | use rkyv::{Archive, Deserialize, Serialize}; 3 | use std::hash::{Hash, Hasher}; 4 | 5 | #[derive( 6 | Archive, Serialize, Deserialize, Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, 7 | )] 8 | #[rkyv(remote = H256)] 9 | pub struct H256Wrapper([u8; 32]); 10 | 11 | impl From for H256 { 12 | fn from(value: H256Wrapper) -> Self { 13 | Self(value.0) 14 | } 15 | } 16 | 17 | impl PartialEq for ArchivedH256Wrapper { 18 | fn eq(&self, other: &Self) -> bool { 19 | self.0 == other.0 20 | } 21 | } 22 | 23 | impl PartialOrd for ArchivedH256Wrapper { 24 | fn partial_cmp(&self, other: &Self) -> Option { 25 | Some(self.cmp(other)) 26 | } 27 | } 28 | 29 | impl Ord for ArchivedH256Wrapper { 30 | fn cmp(&self, other: &Self) -> std::cmp::Ordering { 31 | self.0.cmp(&other.0) 32 | } 33 | } 34 | 35 | impl Eq for ArchivedH256Wrapper {} 36 | 37 | impl Hash for ArchivedH256Wrapper { 38 | fn hash(&self, state: &mut H) { 39 | self.0.hash(state); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /crates/l2/prover/src/guest_program/src/risc0/src/main.rs: -------------------------------------------------------------------------------- 1 | use std::io::Read; 2 | 3 | use guest_program::{execution::execution_program, input::ProgramInput}; 4 | use risc0_zkvm::guest::env; 5 | use rkyv::rancor::Error; 6 | 7 | fn main() { 8 | println!("start reading input"); 9 | let start = env::cycle_count(); 10 | let mut input = Vec::new(); 11 | env::stdin().read_to_end(&mut input).unwrap(); 12 | let input = rkyv::from_bytes::(&input).unwrap(); 13 | let end = env::cycle_count(); 14 | println!("end reading input, cycles: {}", end - start); 15 | 16 | println!("start execution"); 17 | let output = execution_program(input).unwrap(); 18 | let end_exec = env::cycle_count(); 19 | println!("end execution, cycles: {}", end_exec - end); 20 | 21 | println!("start committing public inputs"); 22 | env::commit_slice(&output.encode()); 23 | let end_commit = env::cycle_count(); 24 | println!( 25 | "end committing public inputs, cycles: {}", 26 | end_commit - end_exec 27 | ); 28 | 29 | println!("total cycles: {}", end_commit - start); 30 | } 31 | -------------------------------------------------------------------------------- /docs/l2/interacting/deploy_contracts.md: -------------------------------------------------------------------------------- 1 | # Deploy a Contract to L2 2 | 3 | You can deploy smart contracts to your L2 using [`rex`](https://github.com/lambdaclass/rex), a simple CLI tool for interacting with Ethereum-compatible networks. 4 | 5 | ## 1. Generate the Contract Bytecode 6 | 7 | First, compile your Solidity contract to get the deployment bytecode. You can use [solc (v0.8.31)](https://docs.soliditylang.org/en/latest/installing-solidity.html) for this: 8 | 9 | ```sh 10 | solc --bin MyContract.sol -o out/ 11 | ``` 12 | 13 | The bytecode will be in out/MyContract.bin 14 | 15 | ## 2. Deploy with rex 16 | 17 | Use the following command to deploy your contract: 18 | 19 | ```sh 20 | rex deploy --rpc-url http://localhost:1729 0 21 | ``` 22 | 23 | - Replace `` with the hex string from your compiled contract (e.g., contents of `MyContract.bin`) 24 | - Replace `` with your wallet's private key. It must have funds in L2 25 | - Adjust the `--rpc-url` if your L2 node is running elsewhere 26 | 27 | For more details and advanced usage, see the [rex repository](https://github.com/lambdaclass/rex). 28 | -------------------------------------------------------------------------------- /crates/l2/docker-compose-l2-web3signer.yaml: -------------------------------------------------------------------------------- 1 | services: 2 | web3signer: 3 | restart: always 4 | container_name: web3signer 5 | image: "consensys/web3signer" 6 | ports: 7 | # API 8 | - 0.0.0.0:9000:9000 9 | volumes: 10 | - ../../fixtures/keys:/keys 11 | command: "--http-host-allowlist=* --key-store-path=/keys eth1 --chain-id=1729" 12 | 13 | ethrex_l2: 14 | command: > 15 | --network /genesis/l2.json 16 | --http.addr 0.0.0.0 17 | --http.port 1729 18 | --authrpc.port 8552 19 | --proof-coordinator.addr 0.0.0.0 20 | --block-producer.coinbase-address 0x0007a881CD95B1484fca47615B64803dad620C8d 21 | --block-producer.base-fee-vault-address 0x000c0d6b7c4516a5b274c51ea331a9410fe69127 22 | --committer.remote-signer-url http://web3signer:9000 23 | --committer.remote-signer-public-key 02eadbea0cdb17fda8d56fc9c51df8a6158c2ab157aabf2ca57c3a32cd69f98bbc 24 | --proof-coordinator.remote-signer-url http://web3signer:9000 25 | --proof-coordinator.remote-signer-public-key 029a87812d21330c485e2ab11fbbcc875fd3ecda9e74c3964d8de9a95560b64f21 26 | --no-monitor 27 | -------------------------------------------------------------------------------- /crates/vm/levm/src/hooks/hook.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | errors::{ContextResult, VMError}, 3 | hooks::{L2Hook, backup_hook::BackupHook, default_hook::DefaultHook}, 4 | vm::{VM, VMType}, 5 | }; 6 | use ethrex_common::types::fee_config::FeeConfig; 7 | use std::{cell::RefCell, rc::Rc}; 8 | 9 | pub trait Hook { 10 | fn prepare_execution(&mut self, vm: &mut VM<'_>) -> Result<(), VMError>; 11 | 12 | fn finalize_execution( 13 | &mut self, 14 | vm: &mut VM<'_>, 15 | report: &mut ContextResult, 16 | ) -> Result<(), VMError>; 17 | } 18 | 19 | pub fn get_hooks(vm_type: &VMType) -> Vec>> { 20 | match vm_type { 21 | VMType::L1 => l1_hooks(), 22 | VMType::L2(fee_config) => l2_hooks(*fee_config), 23 | } 24 | } 25 | 26 | pub fn l1_hooks() -> Vec>> { 27 | vec![Rc::new(RefCell::new(DefaultHook))] 28 | } 29 | 30 | pub fn l2_hooks(fee_config: FeeConfig) -> Vec>> { 31 | vec![ 32 | Rc::new(RefCell::new(L2Hook { fee_config })), 33 | Rc::new(RefCell::new(BackupHook::default())), 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /crates/l2/prover/src/guest_program/src/openvm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | version = "0.1.0" 3 | name = "zkvm-openvm-program" 4 | edition = "2024" 5 | 6 | [workspace] 7 | 8 | [dependencies] 9 | openvm = { git = "https://github.com/openvm-org/openvm.git", features = [ 10 | "std", 11 | ], tag = "v1.4.1" } 12 | openvm-keccak256 = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.1" } 13 | openvm-k256 = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.1", package = "k256" } 14 | openvm-ecc-guest = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.1" } 15 | openvm-algebra-guest = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.1" } 16 | rkyv = "0.8.10" 17 | 18 | ethrex-vm = { path = "../../../../../../vm", default-features = false, features = [ 19 | "openvm", 20 | ] } 21 | ethrex-common = { path = "../../../../../../common", default-features = false, features = [ 22 | "openvm", 23 | ] } 24 | ethrex-blockchain = { path = "../../../../../../blockchain", default-features = false } 25 | 26 | guest_program = { path = "../..", default-features = false } 27 | 28 | [features] 29 | l2 = ["guest_program/l2"] 30 | -------------------------------------------------------------------------------- /fixtures/contracts/deposit_spammer/DepositSpammer.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity =0.8.31; 3 | 4 | struct SendValues { 5 | address to; 6 | uint256 gasLimit; 7 | uint256 value; 8 | bytes data; 9 | } 10 | 11 | interface ICommonBridge { 12 | function sendToL2(SendValues calldata sendValues) external; 13 | } 14 | 15 | contract InnerSpammer { 16 | function sendCall(address bridge, uint256 gasLimit) internal { 17 | SendValues memory values = SendValues({ 18 | to: address(uint160(0xffff)), 19 | gasLimit: gasLimit, 20 | value: 1, 21 | data: "" 22 | }); 23 | ICommonBridge(bridge).sendToL2(values); 24 | } 25 | constructor(address bridge) { 26 | sendCall(bridge, 1); 27 | sendCall(bridge, 1_000_000); 28 | for (uint256 i = 0; i < 10; i++) { 29 | sendCall(bridge, 1); 30 | } 31 | } 32 | } 33 | 34 | contract DepositSpammer { 35 | function spam(address bridge, uint256 n) public { 36 | for (uint256 i = 0; i < n; i++) { 37 | new InnerSpammer(bridge); 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /crates/vm/levm/src/opcode_handlers/keccak.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | errors::{OpcodeResult, VMError}, 3 | gas_cost, 4 | memory::calculate_memory_size, 5 | utils::size_offset_to_usize, 6 | vm::VM, 7 | }; 8 | use ethrex_common::utils::u256_from_big_endian; 9 | use ethrex_crypto::keccak::keccak_hash; 10 | 11 | // KECCAK256 (1) 12 | // Opcodes: KECCAK256 13 | 14 | impl<'a> VM<'a> { 15 | pub fn op_keccak256(&mut self) -> Result { 16 | let current_call_frame = &mut self.current_call_frame; 17 | let [offset, size] = *current_call_frame.stack.pop()?; 18 | let (size, offset) = size_offset_to_usize(size, offset)?; 19 | 20 | let new_memory_size = calculate_memory_size(offset, size)?; 21 | 22 | current_call_frame.increase_consumed_gas(gas_cost::keccak256( 23 | new_memory_size, 24 | current_call_frame.memory.len(), 25 | size, 26 | )?)?; 27 | 28 | let hash = keccak_hash(current_call_frame.memory.load_range(offset, size)?); 29 | current_call_frame.stack.push(u256_from_big_endian(&hash))?; 30 | 31 | Ok(OpcodeResult::Continue) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Lambdaclass core team 2 | * @lambdaclass/lambda-execution-reviewers 3 | 4 | ## ethrex L2 code owners 5 | crates/l2 @ilitteri @manuelbilbao @avilagaston9 6 | crates/l2/contracts/src @jrchatruc @manuelbilbao 7 | cmd/ethrex/l2 @ilitteri @manuelbilbao @avilagaston9 8 | cmd/ethrex/build* @ilitteri @manuelbilbao @avilagaston9 9 | crates/blockchain/dev @ilitteri @manuelbilbao @avilagaston9 10 | crates/common/crypto @ilitteri @manuelbilbao @avilagaston9 11 | crates/common/types/blobs_bundle.rs @ilitteri @manuelbilbao @avilagaston9 12 | crates/common/types/l2 @ilitteri @manuelbilbao @avilagaston9 13 | crates/common/types/l2.rs @ilitteri @manuelbilbao @avilagaston9 14 | crates/common/types/transaction.rs @ilitteri @manuelbilbao @avilagaston9 15 | crates/common/rkyv_utils.rs @ilitteri @manuelbilbao @avilagaston9 16 | crates/networking/p2p/rlpx/l2 @ilitteri @manuelbilbao @avilagaston9 17 | crates/networking/rpc/types/transaction.rs @ilitteri @manuelbilbao @avilagaston9 18 | crates/networking/rpc/clients @ilitteri @manuelbilbao @avilagaston9 19 | crates/vm/levm/src/hooks/l2_hook.rs @ilitteri @manuelbilbao @avilagaston9 20 | crates/blockchain/dev @ilitteri @manuelbilbao @avilagaston9 21 | -------------------------------------------------------------------------------- /docs/internal/l1/transactions_tradeoffs.md: -------------------------------------------------------------------------------- 1 | # Tradeoffs of using or not Optimistic Transaction DB in RocksDB 2 | 3 | ## Advantages of Optimistic Transactions 4 | - Easier to keep consistency between multiple writers. 5 | - Easier to keep consistency with readers. 6 | 7 | ## Advantages of Pessimistic Transactions 8 | - Lower memory usage? 9 | - No conflict resolution. 10 | 11 | ## Advantages of Non-Transactional DB 12 | - `delete_range`: much faster key deletion in bulk, useful during healing. 13 | - Lower memory usage (confirm). 14 | - Secondary instances are either much easier or possible. 15 | 16 | ## Alternatives to DB Transactions 17 | - We can use snapshots/secondary instances to provide a consistent view to block production and protocols. 18 | - We can provide crash safety by adding checkpoints or explicit markers so we can go back to the last known consistent version. 19 | - We would need to run a healing pass from that point on startup, to fix possible partial changes to tries. 20 | - We would need to add explicit tests for crashing during writes to make sure we recover correctly. 21 | - L2 can't recover from peers (at least until Based), so it should probably remain transactional. 22 | -------------------------------------------------------------------------------- /docs/vm/levm/forks.md: -------------------------------------------------------------------------------- 1 | ## Forks 2 | 3 | In LEVM we won't implement forks previous to Paris. 4 | The main reasons are: 5 | - Ethrex client will only support post-Merge forks 6 | - There are some aspects of previous forks that add complexity to the EVM, something we try to avoid whenever possible. 7 | 8 | For example, thanks to [EIP-158](https://eips.ethereum.org/EIPS/eip-158) from Tangerine Whistle onwards we don't need to differentiate existing empty accounts from non-existing empty accounts because the definition of empty account changed. Now empty accounts don't exist in the [trie](https://ethereum.org/en/developers/docs/data-structures-and-encoding/patricia-merkle-trie/). So the EVM can easily check if an account exists or not just by checking that it doesn't have nonce, balance nor code! Implementing forks previous to this change would definitely add more complexity to the EVM. 9 | We also avoid filling LEVM with `if` statements of old forks, this way the code is cleaner and easier to understand. 10 | 11 | 12 | Note: EFTests from older forks are also tested for more recent forks, so we aren't missing any tests. The tests remain the same but we just check the results for the forks we are interested in. 13 | -------------------------------------------------------------------------------- /docs/developers/l1/testing/ef-tests.md: -------------------------------------------------------------------------------- 1 | # Ethereum foundation tests 2 | 3 | These are the official execution spec tests there two kinds `state tests` and `blockchain tests`, you can execute them with: 4 | 5 | ### State tests 6 | 7 | The state tests are individual transactions not related one to each other that test particular behavior of the EVM. Tests are usually run for multiple forks and the result of execution may vary between forks. 8 | See [docs](https://eest.ethereum.org/v4.1.0/consuming_tests/state_test/). 9 | 10 | To run the test first: 11 | 12 | ```sh 13 | cd tooling/ef_tests/state 14 | ``` 15 | 16 | then download the test vectors: 17 | 18 | ```sh 19 | make download-evm-ef-tests 20 | ``` 21 | 22 | then run the tests: 23 | 24 | ```sh 25 | make run-evm-ef-tests 26 | ``` 27 | 28 | ### Blockchain tests 29 | 30 | 31 | The blockchain tests test block validation and the consensus rules of the Ethereum blockchain. Tests are usually run for multiple forks. 32 | See [docs](https://eest.ethereum.org/v4.1.0/consuming_tests/blockchain_test). 33 | 34 | To run the tests first: 35 | 36 | ```sh 37 | cd tooling/ef_tests/blockchain 38 | ``` 39 | 40 | then run the tests: 41 | 42 | ```sh 43 | make test-levm 44 | ``` 45 | -------------------------------------------------------------------------------- /crates/l2/sdk/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-sdk" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | ethrex-common.workspace = true 10 | ethrex-rpc.workspace = true 11 | ethrex-l2-common.workspace = true 12 | ethrex-l2-rpc.workspace = true 13 | ethrex-sdk-contract-utils = { path = "contract_utils" } 14 | 15 | ethereum-types.workspace = true 16 | tokio.workspace = true 17 | hex.workspace = true 18 | secp256k1.workspace = true 19 | itertools = "0.13.0" 20 | thiserror.workspace = true 21 | serde_json.workspace = true 22 | serde.workspace = true 23 | tracing.workspace = true 24 | ethrex-rlp.workspace = true 25 | bytes.workspace = true 26 | reqwest.workspace = true 27 | eyre.workspace = true 28 | lazy_static.workspace = true 29 | 30 | [lib] 31 | name = "ethrex_l2_sdk" 32 | path = "src/sdk.rs" 33 | 34 | [build-dependencies] 35 | ethrex-sdk-contract-utils = { path = "contract_utils" } 36 | hex.workspace = true 37 | 38 | [lints.clippy] 39 | unwrap_used = "deny" 40 | expect_used = "deny" 41 | indexing_slicing = "deny" 42 | as_conversions = "deny" 43 | unnecessary_cast = "warn" 44 | panic = "deny" 45 | redundant_clone = "warn" 46 | -------------------------------------------------------------------------------- /crates/l2/contracts/src/l1/interfaces/ISP1Verifier.sol: -------------------------------------------------------------------------------- 1 | // From: https://github.com/succinctlabs/sp1-contracts/blob/65a1d96b720ffa2e6d167fb62527c9c8a534abbe/contracts/src/ISP1Verifier.sol 2 | // SPDX-License-Identifier: MIT 3 | pragma solidity =0.8.31; 4 | 5 | /// @title SP1 Verifier Interface 6 | /// @author Succinct Labs 7 | /// @notice This contract is the interface for the SP1 Verifier. 8 | interface ISP1Verifier { 9 | /// @notice Verifies a proof with given public values and vkey. 10 | /// @dev It is expected that the first 4 bytes of proofBytes must match the first 4 bytes of 11 | /// target verifier's VERIFIER_HASH. 12 | /// @param programVKey The verification key for the RISC-V program. 13 | /// @param publicValues The public values encoded as bytes. 14 | /// @param proofBytes The proof of the program execution the SP1 zkVM encoded as bytes. 15 | function verifyProof( 16 | bytes32 programVKey, 17 | bytes calldata publicValues, 18 | bytes calldata proofBytes 19 | ) external view; 20 | } 21 | 22 | interface ISP1VerifierWithHash is ISP1Verifier { 23 | /// @notice Returns the hash of the verifier. 24 | function VERIFIER_HASH() external pure returns (bytes32); 25 | } 26 | -------------------------------------------------------------------------------- /crates/vm/levm/bench/revm_comparison/src/revm_bench.rs: -------------------------------------------------------------------------------- 1 | use revm::{ 2 | Evm, 3 | db::BenchmarkDB, 4 | primitives::{Address, Bytecode, TransactTo, address}, 5 | }; 6 | use std::hint::black_box; 7 | 8 | pub fn run_with_revm(contract_code: &str, runs: u64, calldata: &str) { 9 | let rich_acc_address = address!("1000000000000000000000000000000000000000"); 10 | let bytes = hex::decode(contract_code).unwrap(); 11 | let raw_bytecode = Bytecode::new_raw(bytes.clone().into()); 12 | 13 | let mut evm = Evm::builder() 14 | .modify_tx_env(|tx| { 15 | tx.caller = rich_acc_address; 16 | tx.transact_to = TransactTo::Call(Address::ZERO); 17 | tx.data = hex::decode(calldata).unwrap().into(); 18 | }) 19 | .with_db(BenchmarkDB::new_bytecode(raw_bytecode)) 20 | .build(); 21 | 22 | for _ in 0..runs - 1 { 23 | let result = black_box(evm.transact()).unwrap(); 24 | assert!(result.result.is_success(), "{:?}", result.result); 25 | } 26 | let result = black_box(evm.transact()).unwrap(); 27 | assert!(result.result.is_success(), "{:?}", result.result); 28 | 29 | println!("output: \t\t{}", result.result.into_output().unwrap()); 30 | } 31 | -------------------------------------------------------------------------------- /crates/networking/rpc/types/account_proof.rs: -------------------------------------------------------------------------------- 1 | use ethrex_common::{Address, H256, U256, serde_utils}; 2 | use serde::{Serialize, Serializer, ser::SerializeSeq}; 3 | 4 | #[derive(Debug, Serialize)] 5 | #[serde(rename_all = "camelCase")] 6 | pub struct AccountProof { 7 | #[serde(serialize_with = "serialize_proofs")] 8 | pub account_proof: Vec>, 9 | pub address: Address, 10 | pub balance: U256, 11 | pub code_hash: H256, 12 | #[serde(with = "serde_utils::u64::hex_str")] 13 | pub nonce: u64, 14 | pub storage_hash: H256, 15 | pub storage_proof: Vec, 16 | } 17 | 18 | #[derive(Debug, Serialize)] 19 | #[serde(rename_all = "camelCase")] 20 | pub struct StorageProof { 21 | pub key: U256, 22 | #[serde(serialize_with = "serialize_proofs")] 23 | pub proof: Vec>, 24 | pub value: U256, 25 | } 26 | 27 | pub fn serialize_proofs(value: &Vec>, serializer: S) -> Result 28 | where 29 | S: Serializer, 30 | { 31 | let mut seq_serializer = serializer.serialize_seq(Some(value.len()))?; 32 | for encoded_node in value { 33 | seq_serializer.serialize_element(&format!("0x{}", hex::encode(encoded_node)))?; 34 | } 35 | seq_serializer.end() 36 | } 37 | -------------------------------------------------------------------------------- /.github/workflows/pr-main_mdbook.yml: -------------------------------------------------------------------------------- 1 | name: Publish Ethrex docs to https://docs.ethrex.xyz/ 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths: 8 | - "docs/**" 9 | pull_request: 10 | paths: 11 | - "docs/**" 12 | workflow_dispatch: 13 | 14 | permissions: 15 | contents: write 16 | 17 | jobs: 18 | deploy: 19 | runs-on: ubuntu-latest 20 | concurrency: 21 | group: ${{ github.workflow }}-${{ github.ref }} 22 | steps: 23 | - uses: actions/checkout@v4 24 | 25 | - name: Setup mdBook 26 | uses: peaceiris/actions-mdbook@v2 27 | with: 28 | mdbook-version: '0.4.51' 29 | 30 | - name: Install mdbook dependencies 31 | run: make docs-deps 32 | 33 | - name: Build documentation 34 | run: make docs 35 | 36 | - name: Deploy 37 | uses: peaceiris/actions-gh-pages@v4 38 | if: ${{ github.ref == 'refs/heads/main' }} 39 | with: 40 | github_token: ${{ secrets.GITHUB_TOKEN }} 41 | publish_dir: book/html 42 | destination_dir: . # root of gh-pages 43 | keep_files: true # do not erase flamegraphs/ or benchmarks/ 44 | cname: docs.ethrex.xyz # always commit the CNAME file 45 | -------------------------------------------------------------------------------- /crates/l2/networking/rpc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-l2-rpc" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | ethrex-common.workspace = true 12 | ethrex-storage.workspace = true 13 | ethrex-blockchain.workspace = true 14 | ethrex-p2p = { workspace = true, features = ["l2"] } 15 | ethrex-storage-rollup.workspace = true 16 | ethrex-l2-common.workspace = true 17 | ethrex-rpc.workspace = true 18 | ethrex-rlp.workspace = true 19 | 20 | axum.workspace = true 21 | tower-http.workspace = true 22 | serde.workspace = true 23 | serde_json = "1.0.117" 24 | tokio = { workspace = true, features = ["full"] } 25 | bytes.workspace = true 26 | tracing.workspace = true 27 | tracing-subscriber.workspace = true 28 | thiserror.workspace = true 29 | secp256k1.workspace = true 30 | reqwest.workspace = true 31 | ethereum-types.workspace = true 32 | hex.workspace = true 33 | rustc-hex.workspace = true 34 | url.workspace = true 35 | 36 | [lib] 37 | path = "./lib.rs" 38 | 39 | [features] 40 | 41 | [lints.clippy] 42 | unwrap_used = "deny" 43 | redundant_clone = "warn" 44 | -------------------------------------------------------------------------------- /crates/l2/based/sequencer_state.rs: -------------------------------------------------------------------------------- 1 | use std::sync::Arc; 2 | 3 | use serde::{Deserialize, Serialize}; 4 | use tokio::sync::Mutex; 5 | 6 | #[derive(Debug, Clone)] 7 | pub struct SequencerState(Arc>); 8 | 9 | impl SequencerState { 10 | pub async fn status(&self) -> SequencerStatus { 11 | *self.0.clone().lock().await 12 | } 13 | 14 | pub async fn new_status(&self, status: SequencerStatus) { 15 | *self.0.lock().await = status; 16 | } 17 | } 18 | 19 | impl From for SequencerState { 20 | fn from(status: SequencerStatus) -> Self { 21 | Self(Arc::new(Mutex::new(status))) 22 | } 23 | } 24 | 25 | #[derive(Debug, Default, Clone, PartialEq, Eq, Serialize, Deserialize, Copy)] 26 | pub enum SequencerStatus { 27 | Sequencing, 28 | #[default] 29 | Syncing, 30 | Following, 31 | } 32 | 33 | impl std::fmt::Display for SequencerStatus { 34 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 35 | match self { 36 | SequencerStatus::Sequencing => write!(f, "Sequencing"), 37 | SequencerStatus::Syncing => write!(f, "Syncing"), 38 | SequencerStatus::Following => write!(f, "Following"), 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /crates/common/trie/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-trie" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | ethrex-crypto.workspace = true 10 | ethrex-rlp.workspace = true 11 | ethrex-threadpool.workspace = true 12 | 13 | ethereum-types.workspace = true 14 | anyhow = "1.0.86" 15 | bytes.workspace = true 16 | tracing.workspace = true 17 | thiserror.workspace = true 18 | hex.workspace = true 19 | serde.workspace = true 20 | serde_json = "1.0.117" 21 | smallvec = { version = "1.10.0", features = ["const_generics", "union"] } 22 | digest = "0.10.6" 23 | lazy_static.workspace = true 24 | crossbeam.workspace = true 25 | rustc-hash.workspace = true 26 | rkyv.workspace = true 27 | 28 | [features] 29 | default = [] 30 | 31 | 32 | [dev-dependencies] 33 | hex.workspace = true 34 | hex-literal.workspace = true 35 | proptest = "1.0.0" 36 | tempfile.workspace = true 37 | cita_trie = "4.0.0" # used for proptest comparisons 38 | hasher = "0.1.4" # cita_trie needs this 39 | criterion = "0.5.1" 40 | rand.workspace = true 41 | 42 | [lib] 43 | path = "./trie.rs" 44 | 45 | [[bench]] 46 | name = "trie_bench" 47 | harness = false 48 | 49 | [lints] 50 | workspace = true 51 | -------------------------------------------------------------------------------- /.github/config/assertoor/network_params_tx.yaml: -------------------------------------------------------------------------------- 1 | participants: 2 | - el_type: geth 3 | el_image: ethereum/client-go:v1.16.1 4 | cl_type: lighthouse 5 | cl_image: sigp/lighthouse:v8.0.0-rc.1 6 | validator_count: 32 7 | - el_type: ethrex 8 | el_image: ethrex:ci 9 | cl_type: lighthouse 10 | cl_image: sigp/lighthouse:v8.0.0-rc.1 11 | validator_count: 32 12 | 13 | additional_services: 14 | - assertoor 15 | - spamoor 16 | # - dora 17 | # - prometheus_grafana 18 | # ethereum_metrics_exporter_enabled: true 19 | # Uncomment the previous lines to enable metrics dashboards and dora explorer, useful for local testing 20 | 21 | spamoor_params: 22 | spammers: 23 | - scenario: blobs 24 | config: 25 | # The eip limits our blob transactions to 6 per block, so for max transactions we keep it at that 26 | throughput: 6 27 | 28 | network_params: 29 | # The address of the staking contract address on the Eth1 chain 30 | deposit_contract_address: "0x4242424242424242424242424242424242424242" 31 | 32 | assertoor_params: 33 | run_stability_check: false 34 | run_block_proposal_check: false 35 | tests: 36 | - https://raw.githubusercontent.com/ethpandaops/assertoor/refs/heads/master/playbooks/stable/eoa-transactions-test.yaml 37 | -------------------------------------------------------------------------------- /crates/common/types/l2/balance_diff.rs: -------------------------------------------------------------------------------- 1 | use bytes::BufMut; 2 | use ethereum_types::{H256, U256}; 3 | use ethrex_rlp::{decode::RLPDecode, encode::RLPEncode, error::RLPDecodeError}; 4 | use serde::{Deserialize, Serialize}; 5 | 6 | /// Represents the amount of balance to transfer to the bridge contract for a specific chain. 7 | #[derive(Debug, Clone, Default, Serialize, Deserialize)] 8 | pub struct BalanceDiff { 9 | pub chain_id: U256, 10 | pub value: U256, 11 | pub message_hashes: Vec, 12 | } 13 | 14 | impl RLPEncode for BalanceDiff { 15 | fn encode(&self, buf: &mut dyn BufMut) { 16 | self.chain_id.encode(buf); 17 | self.value.encode(buf); 18 | self.message_hashes.encode(buf); 19 | } 20 | } 21 | 22 | impl RLPDecode for BalanceDiff { 23 | fn decode_unfinished(rlp: &[u8]) -> Result<(Self, &[u8]), RLPDecodeError> { 24 | let (chain_id, rlp) = U256::decode_unfinished(rlp)?; 25 | let (value, rlp) = U256::decode_unfinished(rlp)?; 26 | let (message_hashes, rlp) = Vec::::decode_unfinished(rlp)?; 27 | Ok(( 28 | BalanceDiff { 29 | chain_id, 30 | value, 31 | message_hashes, 32 | }, 33 | rlp, 34 | )) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /crates/storage/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-storage" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | ethrex-rlp.workspace = true 12 | ethrex-common.workspace = true 13 | ethrex-crypto.workspace = true 14 | ethrex-trie.workspace = true 15 | 16 | async-trait.workspace = true 17 | ethereum-types.workspace = true 18 | anyhow = "1.0.86" 19 | bytes.workspace = true 20 | tracing.workspace = true 21 | thiserror.workspace = true 22 | hex.workspace = true 23 | serde.workspace = true 24 | serde_json = "1.0.117" 25 | rocksdb = { workspace = true, optional = true } 26 | rustc-hash.workspace = true 27 | tokio = { workspace = true, features = ["rt"] } 28 | qfilter = "0.2.5" 29 | rayon.workspace = true 30 | lru = "0.16.2" 31 | 32 | [features] 33 | default = [] 34 | rocksdb = ["dep:rocksdb"] 35 | 36 | [dev-dependencies] 37 | hex.workspace = true 38 | hex-literal.workspace = true 39 | tempfile.workspace = true 40 | tokio = { workspace = true, features = ["full"] } 41 | 42 | [lib] 43 | path = "./lib.rs" 44 | 45 | [lints.clippy] 46 | unwrap_used = "deny" 47 | redundant_clone = "warn" 48 | -------------------------------------------------------------------------------- /.github/config/assertoor/network_params_blob.yaml: -------------------------------------------------------------------------------- 1 | participants: 2 | - el_type: geth 3 | el_image: ethereum/client-go:v1.16.1 4 | cl_type: lighthouse 5 | cl_image: sigp/lighthouse:v8.0.0-rc.1 6 | validator_count: 32 7 | count: 2 8 | - el_type: ethrex 9 | el_image: ethrex:ci 10 | cl_type: lighthouse 11 | cl_image: sigp/lighthouse:v8.0.0-rc.1 12 | validator_count: 32 13 | 14 | additional_services: 15 | - assertoor 16 | - tx_fuzz 17 | # - dora 18 | # - prometheus_grafana 19 | # ethereum_metrics_exporter_enabled: true 20 | # Uncomment the previous lines to enable metrics dashboards and dora explorer, useful for local testing 21 | 22 | network_params: 23 | # The address of the staking contract address on the Eth1 chain 24 | deposit_contract_address: "0x4242424242424242424242424242424242424242" 25 | 26 | assertoor_params: 27 | run_stability_check: false 28 | run_block_proposal_check: false 29 | tests: 30 | - https://raw.githubusercontent.com/ethpandaops/assertoor/refs/heads/master/playbooks/stable/blob-transactions-test.yaml 31 | - https://raw.githubusercontent.com/lambdaclass/ethrex/refs/heads/main/.github/config/assertoor/el-stability-check.yaml 32 | 33 | tx_fuzz_params: 34 | tx_fuzz_extra_args: ["--txcount=3", "--accounts=80"] 35 | -------------------------------------------------------------------------------- /docs/crate_reviews/README.md: -------------------------------------------------------------------------------- 1 | # Crate Complexity & Concurrency Reviews 2 | 3 | This directory hosts the finished per-crate reviews and the tracker that summarizes their core metrics. 4 | 5 | ## Tracker 6 | 7 | | Crate | Main LOC | Test LOC | Complexity Score | Report | 8 | | --- | --- | --- | --- | --- | 9 | | `crates/networking/p2p` | 11,644 | 1,613 | 5 / 5 | [ethrex_p2p_review.md](ethrex_p2p_review.md) | 10 | | `crates/vm/levm` | 7,884 | 201 | 4 / 5 | [ethrex_levm_review.md](ethrex_levm_review.md) | 11 | | `crates/storage` | 4,619 | 912 | 4 / 5 | [ethrex_storage_review.md](ethrex_storage_review.md) | 12 | | `crates/blockchain` | 2,419 | 598 | 4 / 5 | [ethrex_blockchain_review.md](ethrex_blockchain_review.md) | 13 | | `crates/networking/rpc` | 6,827 | 1,284 | 3 / 5 | [ethrex_rpc_review.md](ethrex_rpc_review.md) | 14 | | `crates/common/trie` | 2,082 | 1,837 | 3 / 5 | [ethrex_trie_review.md](ethrex_trie_review.md) | 15 | | `crates/common` | 6,161 | 1,985 | 2 / 5 | [ethrex_common_review.md](ethrex_common_review.md) | 16 | | `crates/vm` | 1,118 | 0 | 2 / 5 | [ethrex_vm_review.md](ethrex_vm_review.md) | 17 | 18 | ## Toolkit 19 | 20 | Workflow checklists, analyzer scripts, and the report template now live under `toolkit/`. See `toolkit/README.md` for usage details when preparing a new review. 21 | -------------------------------------------------------------------------------- /fixtures/keys/private_keys_tests.txt: -------------------------------------------------------------------------------- 1 | 0x850643a0224065ecce3882673c21f56bcf6eef86274cc21cadff15930b59fc8c 2 | 0x180ba7fc7455b07afdf408722b32945e018ed2d5b6865915c185c733ab1f3459 3 | 0xdaf15504c22a352648a71ef2926334fe040ac1d5005019e09f6c979808024dc7 4 | 0xeaba42282ad33c8ef2524f07277c03a776d98ae19f581990ce75becb7cfa1c23 5 | 0x3fd98b5187bf6526734efaa644ffbb4e3670d66f5d0268ce0323ec09124bff61 6 | 0x5288e2f440c7f0cb61a9be8afdeb4295f786383f96f5e35eb0c94ef103996b64 7 | 0xf296c7802555da2a5a662be70e078cbd38b44f96f8615ae529da41122ce8db05 8 | 0xbf3beef3bd999ba9f2451e06936f0423cd62b815c9233dd3bc90f7e02a1e8673 9 | 0x6ecadc396415970e91293726c3f5775225440ea0844ae5616135fd10d66b5954 10 | 0xa492823c3e193d6c595f37a18e3c06650cf4c74558cc818b16130b293716106f 11 | 0xc5114526e042343c6d1899cad05e1c00ba588314de9b96929914ee0df18d46b2 12 | 0x04b9f63ecf84210c5366c66d68fa1f5da1fa4f634fad6dfc86178e4d79ff9e59 13 | 0x00f3c6e26fe106334befc354dcf4a08d2d947625f6968920759ec6630de1c3a3 14 | 0x029227c59d8967cbfec97cffa4bcfb985852afbd96b7b5da7c9a9a42f92e9166 15 | 0x031f8b6155ab7f04aa6d5cd424bfc1c3ad65f911ced9e1f863c9bc118eb5228d 16 | 0x0480559965a26c68396f8d76957d86bcf41d4798d6354a213d67d3c77ab9dd02 17 | 0x274442f0dabd2d7f8ce904e7f2616d9c10807e5856266d160bc6a89ec08150cf 18 | 0x2875b9d5a0b251168ddae14d3e7491865f0a57c9fa4edc3cc1b2b253f978e9b3 19 | -------------------------------------------------------------------------------- /docs/developers/l1/testing/assertoor.md: -------------------------------------------------------------------------------- 1 | # Assertoor tests 2 | 3 | We run some assertoor checks on our CI, to execute them locally you can run the following: 4 | 5 | ```bash 6 | make localnet-assertoor-tx 7 | # or 8 | make localnet-assertoor-blob 9 | ``` 10 | 11 | Those are two different set of assertoor checks the details are as follows: 12 | 13 | _assertoor-tx_ 14 | 15 | - [eoa-transaction-test](https://raw.githubusercontent.com/ethpandaops/assertoor/refs/heads/master/playbooks/stable/eoa-transactions-test.yaml) 16 | 17 | _assertoor-blob_ 18 | 19 | - [blob-transaction-test](https://raw.githubusercontent.com/ethpandaops/assertoor/refs/heads/master/playbooks/stable/blob-transactions-test.yaml) 20 | - _Custom_ [el-stability-check](https://raw.githubusercontent.com/lambdaclass/ethrex/refs/heads/main/.github/config/assertoor/el-stability-check.yaml) 21 | 22 | For reference on each individual check see the [assertoor-wiki](https://github.com/ethpandaops/assertoor/wiki#supported-tasks-in-assertoor) 23 | 24 | ## Run 25 | 26 | Example run: 27 | 28 | ```bash 29 | cargo run --bin ethrex -- --network fixtures/genesis/kurtosis.json 30 | ``` 31 | 32 | The `network` argument is mandatory, as it defines the parameters of the chain. 33 | For more information about the different cli arguments check out the next section. 34 | -------------------------------------------------------------------------------- /crates/l2/common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-l2-common" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | ethereum-types.workspace = true 10 | ethrex-common.workspace = true 11 | ethrex-crypto.workspace = true 12 | ethrex-rlp.workspace = true 13 | ethrex-storage.workspace = true 14 | ethrex-trie.workspace = true 15 | ethrex-vm.workspace = true 16 | 17 | bytes.workspace = true 18 | thiserror.workspace = true 19 | serde.workspace = true 20 | lambdaworks-crypto.workspace = true 21 | sha3.workspace = true 22 | hex.workspace = true 23 | serde_with.workspace = true 24 | # We do not need to enable the "unaligned" feature here since we are just using 25 | # rkyv for ProverInputData, a data structure meant to be used in the host and not 26 | # inside a guest program 27 | rkyv.workspace = true 28 | k256.workspace = true 29 | 30 | secp256k1 = { workspace = true, optional = true } 31 | 32 | [lints.clippy] 33 | unwrap_used = "deny" 34 | expect_used = "deny" 35 | indexing_slicing = "deny" 36 | as_conversions = "deny" 37 | unnecessary_cast = "warn" 38 | panic = "deny" 39 | redundant_clone = "warn" 40 | 41 | [features] 42 | default = ["secp256k1"] 43 | secp256k1 = ["dep:secp256k1"] 44 | risc0 = [] 45 | sp1 = [] 46 | zisk = [] 47 | -------------------------------------------------------------------------------- /crates/storage/rlp.rs: -------------------------------------------------------------------------------- 1 | use std::fmt::Debug; 2 | use std::marker::PhantomData; 3 | 4 | use ethrex_common::{ 5 | H256, 6 | types::{Block, BlockBody, BlockHeader, Receipt}, 7 | }; 8 | use ethrex_rlp::{decode::RLPDecode, encode::RLPEncode}; 9 | 10 | // Account types 11 | pub type AccountCodeHashRLP = Rlp; 12 | 13 | // Block types 14 | pub type BlockHeaderRLP = Rlp; 15 | pub type BlockBodyRLP = Rlp; 16 | pub type BlockRLP = Rlp; 17 | 18 | // Receipt types 19 | #[allow(unused)] 20 | pub type ReceiptRLP = Rlp; 21 | 22 | #[derive(Clone, Debug)] 23 | pub struct Rlp(Vec, PhantomData); 24 | 25 | impl From for Rlp { 26 | fn from(value: T) -> Self { 27 | let mut buf = Vec::new(); 28 | RLPEncode::encode(&value, &mut buf); 29 | Self(buf, Default::default()) 30 | } 31 | } 32 | 33 | impl Rlp { 34 | pub fn to(&self) -> Result { 35 | T::decode(&self.0) 36 | } 37 | } 38 | 39 | impl Rlp { 40 | pub fn from_bytes(bytes: Vec) -> Self { 41 | Self(bytes, Default::default()) 42 | } 43 | 44 | pub fn bytes(&self) -> &Vec { 45 | &self.0 46 | } 47 | 48 | pub fn into_vec(self) -> Vec { 49 | self.0 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /docs/l2/interacting/deposit.md: -------------------------------------------------------------------------------- 1 | # Deposit assets into the L2 2 | 3 | To transfer ETH from Ethereum L1 to your L2 account, you need to use the `CommonBridge` as explained in this section. 4 | 5 | ## Prerequisites for L1 deposit 6 | 7 | - An L1 account with sufficient ETH balance, for developing purposes you can use: 8 | - Address: `0x8943545177806ed17b9f23f0a21ee5948ecaa776` 9 | - Private Key: `0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31` 10 | - The address of the deployed `CommonBridge` contract. 11 | - An Ethereum utility tool like [Rex](https://github.com/lambdaclass/rex) 12 | 13 | ## Making a deposit 14 | 15 | Making a deposit in the Bridge, using Rex, is as simple as: 16 | 17 | ```sh 18 | # Format: rex l2 deposit [L1_RPC_URL] 19 | rex l2 deposit 50000000 0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31 0x65dd6dc5df74b7e08e92c910122f91d7b2d5184f 20 | ``` 21 | 22 | ## Verifying the updated L2 balance 23 | 24 | Once the deposit is made you can verify the balance has increase with: 25 | 26 | ```sh 27 | # Format: rex l2 balance
[RPC_URL] 28 | rex l2 balance 0x8943545177806ed17b9f23f0a21ee5948ecaa776 29 | ``` 30 | 31 | For more information on what you can do with the `CommonBridge` see [Ethrex L2 contracts](../fundamentals/contracts.md). 32 | -------------------------------------------------------------------------------- /crates/vm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ethrex-vm" 3 | version.workspace = true 4 | edition.workspace = true 5 | authors.workspace = true 6 | documentation.workspace = true 7 | 8 | [dependencies] 9 | ethrex-common = { workspace = true, default-features = false } 10 | ethrex-crypto.workspace = true 11 | ethrex-levm = { path = "./levm", default-features = false } 12 | ethrex-trie.workspace = true 13 | ethrex-rlp.workspace = true 14 | 15 | derive_more = { version = "1.0.0", features = ["full"] } 16 | bytes.workspace = true 17 | thiserror.workspace = true 18 | lazy_static.workspace = true 19 | tracing.workspace = true 20 | serde.workspace = true 21 | rkyv.workspace = true 22 | 23 | bincode = "1" 24 | dyn-clone = "1.0" 25 | 26 | ethereum-types.workspace = true 27 | 28 | [lib] 29 | path = "./lib.rs" 30 | 31 | [features] 32 | default = ["secp256k1"] 33 | 34 | secp256k1 = ["ethrex-levm/secp256k1", "ethrex-common/secp256k1"] 35 | c-kzg = ["ethrex-levm/c-kzg", "ethrex-common/c-kzg"] 36 | 37 | sp1 = ["ethrex-levm/sp1", "ethrex-common/sp1"] 38 | risc0 = ["ethrex-levm/risc0", "ethrex-common/risc0", "c-kzg"] 39 | zisk = ["ethrex-levm/zisk", "ethrex-common/zisk"] 40 | openvm = ["ethrex-levm/openvm", "ethrex-common/openvm"] 41 | 42 | debug = ["ethrex-levm/debug"] 43 | 44 | [lints.clippy] 45 | unwrap_used = "deny" 46 | redundant_clone = "warn" 47 | -------------------------------------------------------------------------------- /crates/l2/tee/contracts/assets/platform_ca.hex: -------------------------------------------------------------------------------- 1 | 308202963082023da003020102021500956f5dcdbd1be1e94049c9d4f433ce01570bde54300a06082a8648ce3d0403023068311a301806035504030c11496e74656c2053475820526f6f74204341311a3018060355040a0c11496e74656c20436f72706f726174696f6e3114301206035504070c0b53616e746120436c617261310b300906035504080c024341310b3009060355040613025553301e170d3138303532313130353031305a170d3333303532313130353031305a30703122302006035504030c19496e74656c205347582050434b20506c6174666f726d204341311a3018060355040a0c11496e74656c20436f72706f726174696f6e3114301206035504070c0b53616e746120436c617261310b300906035504080c024341310b30090603550406130255533059301306072a8648ce3d020106082a8648ce3d0301070342000435207feeddb595748ed82bb3a71c3be1e241ef61320c6816e6b5c2b71dad5532eaea12a4eb3f948916429ea47ba6c3af82a15e4b19664e52657939a2d96633dea381bb3081b8301f0603551d2304183016801422650cd65a9d3489f383b49552bf501b392706ac30520603551d1f044b30493047a045a043864168747470733a2f2f6365727469666963617465732e7472757374656473657276696365732e696e74656c2e636f6d2f496e74656c534758526f6f7443412e646572301d0603551d0e04160414956f5dcdbd1be1e94049c9d4f433ce01570bde54300e0603551d0f0101ff04040302010630120603551d130101ff040830060101ff020100300a06082a8648ce3d040302034700304402205ec5648b4c3e8ba558196dd417fdb6b9a5ded182438f551e9c0f938c3d5a8b970220261bd520260f9c647d3569be8e14a32892631ac358b994478088f4d2b27cf37e 2 | -------------------------------------------------------------------------------- /metrics/docker-compose-metrics-l1.overrides.yaml: -------------------------------------------------------------------------------- 1 | # L1 monitoring override: ethrex + lighthouse + ethereum-metrics-exporter 2 | # Usage: docker compose -f docker-compose-metrics.yaml -f docker-compose-metrics-l1.overrides.yaml up 3 | services: 4 | ethereum-metrics-exporter: 5 | image: samcm/ethereum-metrics-exporter:latest 6 | command: 7 | - --execution-url=http://host.docker.internal:8545 8 | - --execution-modules="eth","net","web3","txpool" 9 | - --consensus-url=http://host.docker.internal:5052 10 | - --metrics-port=9093 11 | ports: 12 | - "9093:9093" 13 | extra_hosts: 14 | - "host.docker.internal:host-gateway" 15 | depends_on: 16 | - prometheus 17 | 18 | prometheus: 19 | volumes: 20 | - ./provisioning/prometheus/prometheus_l1_sync_docker.yaml:/etc/prometheus/prometheus.yaml 21 | ports: 22 | - "9091:9090" 23 | extra_hosts: 24 | - "host.docker.internal:host-gateway" 25 | 26 | grafana: 27 | ports: 28 | - "3001:3000" 29 | volumes: 30 | - ./provisioning/grafana/datasources:/etc/grafana/provisioning/datasources 31 | - ./provisioning/grafana/dashboards:/etc/grafana/provisioning/dashboards 32 | environment: 33 | - GF_SECURITY_ADMIN_PASSWORD=admin 34 | extra_hosts: 35 | - "host.docker.internal:host-gateway" 36 | -------------------------------------------------------------------------------- /crates/l2/contracts/src/l2/Messenger.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity =0.8.31; 3 | 4 | import "./interfaces/IMessenger.sol"; 5 | 6 | /// @title Messenger contract. 7 | /// @author LambdaClass 8 | contract Messenger is IMessenger { 9 | /// @notice Id of the last emitted message. 10 | /// @dev Message Id that should be incremented before a message is sent 11 | uint256 public lastMessageId; 12 | address public constant BRIDGE = 0x000000000000000000000000000000000000FFff; 13 | 14 | modifier onlyBridge() { 15 | require(msg.sender == BRIDGE, "Only bridge can call this function"); 16 | _; 17 | } 18 | 19 | /// @inheritdoc IMessenger 20 | function sendMessageToL1(bytes32 data) external { 21 | // This event gets pushed to L1, the sequencer monitors 22 | // them on every block. 23 | lastMessageId += 1; 24 | emit L1Message(msg.sender, data, lastMessageId); 25 | } 26 | 27 | /// @inheritdoc IMessenger 28 | function sendMessageToL2( 29 | uint256 chainId, 30 | address from, 31 | address to, 32 | uint256 gasLimit, 33 | uint256 txId, 34 | uint256 value, 35 | bytes calldata data 36 | ) external onlyBridge { 37 | emit L2Message(chainId, from, to, value, gasLimit, txId, data); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /tooling/migrations/README.md: -------------------------------------------------------------------------------- 1 | # Ethrex migration tools 2 | 3 | This tool provides a way to migrate ethrex databases created with Libmdbx to RocksDB. 4 | 5 | ## Instructions 6 | 7 | > [!IMPORTANT] 8 | > If you are migrating a db from an ethrex L2 rollup you should also copy the `rollup_store`, `rollup_store-shm` and `rollup_store-wal` files to ``. 9 | 10 | It is recomended to backup the original database before migration even if this process does not erase the old data. To migrate a database run: 11 | 12 | ``` 13 | cargo run --release -- l2r --genesis --store.old --store.new 14 | ``` 15 | 16 | This will output the migrated database to ``. 17 | Finally restart your ethrex node pointing `--datadir` to the path of the migrated database 18 | 19 | ## CLI Reference 20 | 21 | ``` 22 | Migrate a libmdbx database to rocksdb 23 | 24 | Usage: migrations libmdbx2rocksdb --genesis --store.old --store.new 25 | 26 | Options: 27 | --genesis Path to the genesis file for the genesis block of store.old 28 | --store.old Path to the target database to migrate 29 | --store.new Path to use for the migrated database 30 | -h, --help Print help 31 | ``` 32 | -------------------------------------------------------------------------------- /tooling/import_benchmark/parse_bench.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | bench = {} 4 | bench_around = {} 5 | 6 | for file_path in sys.argv[1:]: 7 | bench_around[file_path] = {} 8 | 9 | with open(file_path, "r") as file: 10 | for line in file: 11 | if "Finished regenerating state" in line: 12 | break 13 | 14 | for line in file: 15 | if "[METRIC]" in line: 16 | block_num = line.split(")")[0][-7:] 17 | ggas = line.split(")")[1][2:7] 18 | 19 | if block_num not in bench: 20 | bench[block_num] = {} 21 | bench[block_num][file_path] = float(ggas) 22 | bench_around[file_path][block_num] = float(ggas) 23 | 24 | total = 0 25 | count = 0 26 | for block in bench.values(): 27 | for ggas in block.values(): 28 | total += ggas 29 | count += 1 30 | 31 | 32 | print("Blocks tested", len(bench)) 33 | print("Mean ggas across multiple runs:", total / count) 34 | for run_count, run in bench_around.items(): 35 | print("Mean ggas in run:", run_count, sum(run.values()) / len(run.values())) 36 | 37 | average_difference = [] 38 | for block_num, block in bench.items(): 39 | average_difference.append(max(block.values()) - min(block.values())) 40 | pass 41 | print("Mean ggas spread across blocks:", sum(average_difference) / count) 42 | -------------------------------------------------------------------------------- /crates/l2/tee/quote-gen/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "quote-gen" 3 | version = "7.0.0" 4 | edition = "2024" 5 | 6 | [dependencies] 7 | configfs-tsm = "0.0.1" 8 | tokio = { version = "1.41.1", features = ["full"] } 9 | hex = "0.4" 10 | zerocopy = "0.8" 11 | serde = { version = "<1.0.220", features = ["derive"] } 12 | # serde >=1.0.220 contains a breaking change for alloy-consensus 13 | # https://github.com/alloy-rs/alloy/issues/2876 14 | serde_json = "1.0" 15 | 16 | ethrex-common = { path = "../../../common", default-features = false } 17 | ethrex-storage = { path = "../../../storage", default-features = false } 18 | ethrex-rlp = { path = "../../../common/rlp" } 19 | ethrex-vm = { path = "../../../vm", default-features = false } 20 | ethrex-blockchain = { path = "../../../blockchain", default-features = false } 21 | ethrex-rpc = { path = "../../../networking/rpc", default-features = false } 22 | guest_program = { path = "../../prover/src/guest_program", default-features = false } 23 | ethrex-l2 = { path = "../..", default-features = false } 24 | ethrex-l2-common = { path = "../../common", default-features = false } 25 | 26 | secp256k1 = { version = "0.30.0", default-features = false, features = [ 27 | "global-context", 28 | "recovery", 29 | "rand", 30 | "std", 31 | ] } 32 | 33 | [workspace] 34 | 35 | [features] 36 | default = ["l2"] 37 | l2 = ["guest_program/l2", "ethrex-l2/l2"] 38 | -------------------------------------------------------------------------------- /crates/l2/contracts/src/l2/FeeTokenRegistry.sol: -------------------------------------------------------------------------------- 1 | 2 | // SPDX-License-Identifier: MIT 3 | pragma solidity =0.8.31; 4 | import "./interfaces/IFeeTokenRegistry.sol"; 5 | 6 | contract FeeTokenRegistry is IFeeTokenRegistry { 7 | address public constant BRIDGE = 0x000000000000000000000000000000000000FFff; 8 | 9 | mapping(address => bool) private feeTokens; 10 | 11 | modifier onlyBridge() { 12 | require(msg.sender == BRIDGE, "FeeTokenRegistry: not bridge"); 13 | _; 14 | } 15 | 16 | /// @inheritdoc IFeeTokenRegistry 17 | function isFeeToken(address token) external view override returns (bool) { 18 | return feeTokens[token]; 19 | } 20 | 21 | /// @inheritdoc IFeeTokenRegistry 22 | function registerFeeToken(address token) external override onlyBridge { 23 | require(token != address(0), "FeeTokenRegistry: zero address"); 24 | require( 25 | !feeTokens[token], 26 | "FeeTokenRegistry: token already registered" 27 | ); 28 | feeTokens[token] = true; 29 | emit FeeTokenRegistered(token); 30 | } 31 | 32 | /// @inheritdoc IFeeTokenRegistry 33 | function unregisterFeeToken(address token) external override onlyBridge { 34 | require(feeTokens[token], "FeeTokenRegistry: token not registered"); 35 | feeTokens[token] = false; 36 | emit FeeTokenUnregistered(token); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /crates/l2/contracts/src/l2/L2Upgradeable.sol: -------------------------------------------------------------------------------- 1 | // SPDX-License-Identifier: MIT 2 | pragma solidity =0.8.31; 3 | 4 | import "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol"; 5 | 6 | /// @title Proxy for an L2 system contract 7 | /// @author LambdaClass 8 | /// @notice This contract is meant to be included in the genesis at the system contract address 9 | /// @dev The genesis generator sets the initial implementation using the well-known (ERC-1967) proxy slot 10 | contract UpgradeableSystemContract is TransparentUpgradeableProxy { 11 | /// @notice The CommonBridge uses this address to send upgrades 12 | address constant ADMIN = 0x000000000000000000000000000000000000f000; 13 | 14 | constructor() TransparentUpgradeableProxy(address(0), address(0), "") { 15 | // This contract is compiled into runtime code when assembling the genesis 16 | // The setup is done by directly setting the ERC-1967 storage slots 17 | revert("This contract is not meant to be directly deployed."); 18 | } 19 | 20 | /// @notice We override this so that it can be easily included in the genesis 21 | /// @dev The normal constructor has hard to simulate (deploying a ProxyAdmin, setting immutable variables) 22 | /// @dev behavior, so this is the simpler way. 23 | function _proxyAdmin() internal pure override returns (address) { 24 | return ADMIN; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /crates/vm/levm/src/hooks/backup_hook.rs: -------------------------------------------------------------------------------- 1 | use crate::{ 2 | call_frame::CallFrameBackup, 3 | errors::{ContextResult, VMError}, 4 | hooks::hook::Hook, 5 | vm::VM, 6 | }; 7 | 8 | #[derive(Default)] 9 | pub struct BackupHook { 10 | /// We need to store this because we clear the backup after `prepare_execution` hook is executed 11 | pub pre_execution_backup: CallFrameBackup, 12 | } 13 | 14 | impl Hook for BackupHook { 15 | fn prepare_execution(&mut self, vm: &mut crate::vm::VM<'_>) -> Result<(), VMError> { 16 | // Here we need to backup the callframe for undoing transaction changes if we want to. 17 | self.pre_execution_backup = vm.current_call_frame.call_frame_backup.clone(); 18 | Ok(()) 19 | } 20 | 21 | fn finalize_execution( 22 | &mut self, 23 | vm: &mut VM<'_>, 24 | _ctx_result: &mut ContextResult, 25 | ) -> Result<(), VMError> { 26 | // We want to restore to the initial state, this includes saving the changes made by the prepare execution 27 | // and the changes made by the execution itself. 28 | let mut execution_backup = vm.current_call_frame.call_frame_backup.clone(); 29 | let pre_execution_backup = std::mem::take(&mut self.pre_execution_backup); 30 | execution_backup.extend(pre_execution_backup); 31 | vm.db.tx_backup = Some(execution_backup); 32 | 33 | Ok(()) 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /docs/getting-started/hardware_requirements.md: -------------------------------------------------------------------------------- 1 | # Hardware Requirements 2 | 3 | > NOTE: The guidance in this document applies to running an L1 (Ethereum) node. L2 deployments (sequencers, provers and related infra) have different hardware profiles and operational requirements — see the "L2" section below for details. 4 | 5 | Hardware requirements depend primarily on the **network** you're running — for example, **Hoodi**, **Sepolia**, or **Mainnet**. 6 | 7 | ## General Recommendations 8 | 9 | Across all networks, the following apply: 10 | 11 | - **Disk Type:** Use **high-performance NVMe SSDs**. For multi-disk setups, **software RAID 0** is recommended to maximize speed and capacity. **Avoid hardware RAID**, which can limit NVMe performance. 12 | - **RAM:** Sufficient memory minimizes sync bottlenecks and improves stability under load. 13 | - **CPU:** 4-8 Cores. 14 | - x86-64 bit Processors must be compatible with the instruction set AVX2. 15 | 16 | --- 17 | 18 | ## Disk and Memory Requirements by Network 19 | 20 | | Network | Disk (Minimum) | Disk (Recommended) | RAM (Minimum) | RAM (Recommended) | 21 | |------|------------------|--------------------|----------------|-------------------| 22 | | **Ethereum Mainnet** | 500 GB | 1 TB | 32 GB | 64 GB | 23 | | **Ethereum Sepolia** | 250 GB | 400 GB| 32 GB | 64 GB | 24 | | **Ethereum Hoodi** | 60 GB | 100 GB | 32 GB | 64 GB | 25 | 26 | --- 27 | 28 | ## L2 29 | 30 | TBD 31 | -------------------------------------------------------------------------------- /fixtures/networks/default.yaml: -------------------------------------------------------------------------------- 1 | participants: 2 | # NOTE: Both erigon and geth work on this example, but they provide wrong nodes information on discovery protocol 3 | # - el_type: erigon 4 | # el_image: ethpandaops/erigon:main-764a2c50 5 | # cl_type: lighthouse 6 | # cl_image: sigp/lighthouse:v8.0.0-rc.1 7 | # validator_count: 32 8 | # - el_type: reth 9 | # el_image: ghcr.io/paradigmxyz/reth:v1.2.2 10 | # cl_type: lighthouse 11 | # cl_image: sigp/lighthouse:v8.0.0-rc.1 12 | # validator_count: 32 13 | - el_type: besu 14 | el_image: ethpandaops/besu:main-142a5e6 15 | cl_type: lighthouse 16 | cl_image: sigp/lighthouse:v8.0.0-rc.1 17 | validator_count: 32 18 | - el_type: geth 19 | el_image: ethereum/client-go:v1.15.2 20 | cl_type: lighthouse 21 | cl_image: sigp/lighthouse:v8.0.0-rc.1 22 | validator_count: 32 23 | count: 1 24 | - el_type: ethrex 25 | el_image: ethrex:local 26 | cl_type: lighthouse 27 | cl_image: sigp/lighthouse:v8.0.0-rc.1 28 | validator_count: 32 29 | # snooper_enabled: true 30 | 31 | ethereum_metrics_exporter_enabled: true 32 | 33 | additional_services: 34 | - dora 35 | - spamoor 36 | - prometheus_grafana 37 | 38 | spamoor_params: 39 | spammers: 40 | - scenario: erctx 41 | config: 42 | throughput: 750 43 | 44 | grafana_params: 45 | additional_dashboards: ["./ethrex_l1_perf.json"] 46 | -------------------------------------------------------------------------------- /.github/config/assertoor/network_params_ethrex_multiple_cl.yaml: -------------------------------------------------------------------------------- 1 | participants: 2 | - el_type: ethrex 3 | el_image: ethrex:ci 4 | cl_type: lighthouse 5 | cl_image: sigp/lighthouse:v8.0.0-rc.1 6 | validator_count: 32 7 | ethereum_metrics_exporter_enabled: true 8 | - el_type: ethrex 9 | el_image: ethrex:ci 10 | cl_type: teku 11 | cl_image: consensys/teku:25.6.0 12 | validator_count: 32 13 | ethereum_metrics_exporter_enabled: true 14 | - el_type: ethrex 15 | el_image: ethrex:ci 16 | cl_type: prysm 17 | cl_image: gcr.io/offchainlabs/prysm/beacon-chain:v6.0.4 18 | validator_count: 32 19 | ethereum_metrics_exporter_enabled: true 20 | 21 | network_params: 22 | # The address of the staking contract address on the Eth1 chain 23 | deposit_contract_address: "0x4242424242424242424242424242424242424242" 24 | seconds_per_slot: 3 25 | 26 | additional_services: 27 | - assertoor 28 | - dora 29 | 30 | assertoor_params: 31 | tests: 32 | - https://raw.githubusercontent.com/lambdaclass/ethrex/refs/heads/main/.github/config/assertoor/el-stability-check.yaml # Check that all el clients are synced with the corresponding cl 33 | - https://raw.githubusercontent.com/ethpandaops/assertoor/refs/heads/master/playbooks/stable/blob-transactions-test.yaml 34 | - https://raw.githubusercontent.com/ethpandaops/assertoor/refs/heads/master/playbooks/stable/eoa-transactions-test.yaml 35 | --------------------------------------------------------------------------------