├── .cargo └── config.toml ├── .codespellrc ├── .config └── nextest.toml ├── .dockerignore ├── .editorconfig ├── .gitattributes ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug.yml │ ├── config.yml │ ├── docs.yml │ └── feature.yml ├── assets │ ├── check_wasm.sh │ ├── hive │ │ ├── Dockerfile │ │ ├── build_simulators.sh │ │ ├── expected_failures.yaml │ │ ├── expected_failures_experimental.yaml │ │ ├── load_images.sh │ │ ├── no_sim_build.diff │ │ ├── parse.py │ │ └── run_simulator.sh │ ├── install_geth.sh │ └── label_pr.js ├── dependabot.yml └── workflows │ ├── assertoor.yml │ ├── bench.yml │ ├── book.yml │ ├── deny.yml │ ├── dependencies.yml │ ├── docker.yml │ ├── eth-sync.yml │ ├── hive.yml │ ├── integration.yml │ ├── label-pr.yml │ ├── lint-actions.yml │ ├── lint.yml │ ├── op-sync.yml │ ├── release-dist.yml │ ├── release.yml │ ├── stage.yml │ ├── stale.yml │ └── unit.yml ├── .gitignore ├── CONTRIBUTING.md ├── Cargo.lock ├── Cargo.toml ├── Cross.toml ├── Dockerfile ├── Dockerfile.cross ├── DockerfileOp.cross ├── LICENSE-APACHE ├── LICENSE-MIT ├── Makefile ├── README.md ├── SECURITY.md ├── assets ├── reth-alpha.png ├── reth-beta.png ├── reth-docs.png ├── reth-prod.png └── reth.jpg ├── audit └── sigma_prime_audit_v2.pdf ├── bin ├── reth-bench │ ├── Cargo.toml │ ├── README.md │ └── src │ │ ├── authenticated_transport.rs │ │ ├── bench │ │ ├── context.rs │ │ ├── mod.rs │ │ ├── new_payload_fcu.rs │ │ ├── new_payload_only.rs │ │ └── output.rs │ │ ├── bench_mode.rs │ │ ├── main.rs │ │ └── valid_payload.rs └── reth │ ├── Cargo.toml │ └── src │ ├── cli │ └── mod.rs │ ├── commands │ ├── debug_cmd │ │ ├── build_block.rs │ │ ├── execution.rs │ │ ├── in_memory_merkle.rs │ │ ├── merkle.rs │ │ ├── mod.rs │ │ └── replay_engine.rs │ └── mod.rs │ ├── lib.rs │ ├── macros.rs │ ├── main.rs │ └── optimism.rs ├── book.toml ├── book ├── SUMMARY.md ├── cli │ ├── SUMMARY.md │ ├── cli.md │ ├── help.py │ ├── op-reth.md │ ├── reth.md │ ├── reth │ │ ├── config.md │ │ ├── db.md │ │ ├── db │ │ │ ├── checksum.md │ │ │ ├── clear.md │ │ │ ├── clear │ │ │ │ ├── mdbx.md │ │ │ │ ├── static-file.md │ │ │ │ └── static_file.md │ │ │ ├── diff.md │ │ │ ├── drop.md │ │ │ ├── get.md │ │ │ ├── get │ │ │ │ ├── mdbx.md │ │ │ │ ├── static-file.md │ │ │ │ └── static_file.md │ │ │ ├── list.md │ │ │ ├── path.md │ │ │ ├── static_file.md │ │ │ ├── stats.md │ │ │ └── version.md │ │ ├── debug.md │ │ ├── debug │ │ │ ├── build-block.md │ │ │ ├── execution.md │ │ │ ├── in-memory-merkle.md │ │ │ ├── merkle.md │ │ │ └── replay-engine.md │ │ ├── dump-genesis.md │ │ ├── import-op.md │ │ ├── import-receipts-op.md │ │ ├── import.md │ │ ├── init-state.md │ │ ├── init.md │ │ ├── node.md │ │ ├── p2p.md │ │ ├── p2p │ │ │ ├── body.md │ │ │ ├── header.md │ │ │ ├── rlpx.md │ │ │ └── rlpx │ │ │ │ └── ping.md │ │ ├── prune.md │ │ ├── recover.md │ │ ├── recover │ │ │ └── storage-tries.md │ │ ├── stage.md │ │ ├── stage │ │ │ ├── drop.md │ │ │ ├── dump.md │ │ │ ├── dump │ │ │ │ ├── account-hashing.md │ │ │ │ ├── execution.md │ │ │ │ ├── merkle.md │ │ │ │ └── storage-hashing.md │ │ │ ├── run.md │ │ │ ├── unwind.md │ │ │ └── unwind │ │ │ │ ├── num-blocks.md │ │ │ │ └── to-block.md │ │ ├── test-vectors.md │ │ └── test-vectors │ │ │ └── tables.md │ └── update.sh ├── developers │ ├── contribute.md │ ├── developers.md │ ├── exex │ │ ├── assets │ │ │ └── remote_exex.png │ │ ├── exex.md │ │ ├── hello-world.md │ │ ├── how-it-works.md │ │ ├── remote.md │ │ └── tracking-state.md │ └── profiling.md ├── installation │ ├── binaries.md │ ├── build-for-arm-devices.md │ ├── docker.md │ ├── installation.md │ ├── priorities.md │ └── source.md ├── intro.md ├── jsonrpc │ ├── admin.md │ ├── debug.md │ ├── eth.md │ ├── intro.md │ ├── net.md │ ├── rpc.md │ ├── trace.md │ ├── txpool.md │ └── web3.md ├── run │ ├── config.md │ ├── mainnet.md │ ├── observability.md │ ├── optimism.md │ ├── ports.md │ ├── private-testnet.md │ ├── pruning.md │ ├── run-a-node.md │ ├── sync-op-mainnet.md │ ├── transactions.md │ └── troubleshooting.md ├── templates │ └── source_and_github.md └── theme │ └── head.hbs ├── clippy.toml ├── crates ├── blockchain-tree-api │ ├── Cargo.toml │ └── src │ │ ├── error.rs │ │ └── lib.rs ├── blockchain-tree │ ├── Cargo.toml │ ├── docs │ │ └── mermaid │ │ │ └── tree.mmd │ └── src │ │ ├── block_buffer.rs │ │ ├── block_indices.rs │ │ ├── blockchain_tree.rs │ │ ├── bundle.rs │ │ ├── canonical_chain.rs │ │ ├── chain.rs │ │ ├── config.rs │ │ ├── externals.rs │ │ ├── lib.rs │ │ ├── metrics.rs │ │ ├── noop.rs │ │ ├── shareable.rs │ │ └── state.rs ├── chain-state │ ├── Cargo.toml │ └── src │ │ ├── chain_info.rs │ │ ├── in_memory.rs │ │ ├── lib.rs │ │ ├── memory_overlay.rs │ │ ├── notifications.rs │ │ └── test_utils.rs ├── chainspec │ ├── Cargo.toml │ ├── res │ │ └── genesis │ │ │ ├── base.json │ │ │ ├── dev.json │ │ │ ├── goerli.json │ │ │ ├── holesky.json │ │ │ ├── mainnet.json │ │ │ ├── optimism.json │ │ │ ├── sepolia.json │ │ │ ├── sepolia_base.json │ │ │ └── sepolia_op.json │ └── src │ │ ├── api.rs │ │ ├── constants.rs │ │ ├── info.rs │ │ ├── lib.rs │ │ └── spec.rs ├── cli │ ├── cli │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── chainspec.rs │ │ │ └── lib.rs │ ├── commands │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── common.rs │ │ │ ├── config_cmd.rs │ │ │ ├── db │ │ │ ├── checksum.rs │ │ │ ├── clear.rs │ │ │ ├── diff.rs │ │ │ ├── get.rs │ │ │ ├── list.rs │ │ │ ├── mod.rs │ │ │ ├── stats.rs │ │ │ └── tui.rs │ │ │ ├── dump_genesis.rs │ │ │ ├── import.rs │ │ │ ├── init_cmd.rs │ │ │ ├── init_state.rs │ │ │ ├── lib.rs │ │ │ ├── node.rs │ │ │ ├── p2p │ │ │ ├── mod.rs │ │ │ └── rlpx.rs │ │ │ ├── prune.rs │ │ │ ├── recover │ │ │ ├── mod.rs │ │ │ └── storage_tries.rs │ │ │ ├── stage │ │ │ ├── drop.rs │ │ │ ├── dump │ │ │ │ ├── execution.rs │ │ │ │ ├── hashing_account.rs │ │ │ │ ├── hashing_storage.rs │ │ │ │ ├── merkle.rs │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── run.rs │ │ │ └── unwind.rs │ │ │ └── test_vectors │ │ │ ├── mod.rs │ │ │ └── tables.rs │ ├── runner │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── util │ │ ├── Cargo.toml │ │ └── src │ │ ├── lib.rs │ │ ├── load_secret_key.rs │ │ ├── parsers.rs │ │ └── sigsegv_handler.rs ├── config │ ├── Cargo.toml │ └── src │ │ ├── config.rs │ │ └── lib.rs ├── consensus │ ├── auto-seal │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── client.rs │ │ │ ├── lib.rs │ │ │ ├── mode.rs │ │ │ └── task.rs │ ├── beacon │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── engine │ │ │ ├── error.rs │ │ │ ├── event.rs │ │ │ ├── forkchoice.rs │ │ │ ├── handle.rs │ │ │ ├── hooks │ │ │ │ ├── controller.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── prune.rs │ │ │ │ └── static_file.rs │ │ │ ├── invalid_headers.rs │ │ │ ├── message.rs │ │ │ ├── metrics.rs │ │ │ ├── mod.rs │ │ │ ├── sync.rs │ │ │ └── test_utils.rs │ │ │ └── lib.rs │ ├── common │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── calc.rs │ │ │ ├── lib.rs │ │ │ └── validation.rs │ ├── consensus │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ ├── noop.rs │ │ │ └── test_utils.rs │ └── debug-client │ │ ├── Cargo.toml │ │ └── src │ │ ├── client.rs │ │ ├── lib.rs │ │ └── providers │ │ ├── etherscan.rs │ │ ├── mod.rs │ │ └── rpc.rs ├── e2e-test-utils │ ├── Cargo.toml │ └── src │ │ ├── engine_api.rs │ │ ├── lib.rs │ │ ├── network.rs │ │ ├── node.rs │ │ ├── payload.rs │ │ ├── rpc.rs │ │ ├── traits.rs │ │ ├── transaction.rs │ │ └── wallet.rs ├── engine │ ├── primitives │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── service │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── service.rs │ ├── tree │ │ ├── Cargo.toml │ │ ├── src │ │ │ ├── backfill.rs │ │ │ ├── chain.rs │ │ │ ├── download.rs │ │ │ ├── engine.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ ├── persistence.rs │ │ │ ├── test_utils.rs │ │ │ └── tree │ │ │ │ ├── config.rs │ │ │ │ ├── metrics.rs │ │ │ │ └── mod.rs │ │ └── test-data │ │ │ └── holesky │ │ │ ├── 1.rlp │ │ │ └── 2.rlp │ └── util │ │ ├── Cargo.toml │ │ └── src │ │ ├── engine_store.rs │ │ ├── lib.rs │ │ ├── reorg.rs │ │ ├── skip_fcu.rs │ │ └── skip_new_payload.rs ├── errors │ ├── Cargo.toml │ └── src │ │ ├── error.rs │ │ └── lib.rs ├── ethereum-forks │ ├── Cargo.toml │ └── src │ │ ├── display.rs │ │ ├── forkcondition.rs │ │ ├── forkid.rs │ │ ├── hardfork │ │ ├── dev.rs │ │ ├── ethereum.rs │ │ ├── macros.rs │ │ ├── mod.rs │ │ └── optimism.rs │ │ ├── hardforks │ │ ├── ethereum.rs │ │ ├── mod.rs │ │ └── optimism.rs │ │ ├── head.rs │ │ └── lib.rs ├── ethereum │ ├── cli │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── chainspec.rs │ │ │ └── lib.rs │ ├── consensus │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── validation.rs │ ├── engine-primitives │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── payload.rs │ ├── evm │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── config.rs │ │ │ ├── dao_fork.rs │ │ │ ├── eip6110.rs │ │ │ ├── execute.rs │ │ │ └── lib.rs │ ├── node │ │ ├── Cargo.toml │ │ ├── src │ │ │ ├── evm.rs │ │ │ ├── lib.rs │ │ │ └── node.rs │ │ └── tests │ │ │ ├── assets │ │ │ └── genesis.json │ │ │ ├── e2e │ │ │ ├── blobs.rs │ │ │ ├── dev.rs │ │ │ ├── eth.rs │ │ │ ├── main.rs │ │ │ ├── p2p.rs │ │ │ └── utils.rs │ │ │ └── it │ │ │ ├── builder.rs │ │ │ ├── exex.rs │ │ │ └── main.rs │ └── payload │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── etl │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── evm │ ├── Cargo.toml │ ├── execution-errors │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── trie.rs │ ├── execution-types │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── chain.rs │ │ │ ├── execute.rs │ │ │ ├── execution_outcome.rs │ │ │ └── lib.rs │ └── src │ │ ├── builder.rs │ │ ├── either.rs │ │ ├── execute.rs │ │ ├── lib.rs │ │ ├── noop.rs │ │ ├── provider.rs │ │ ├── system_calls.rs │ │ └── test_utils.rs ├── exex │ ├── exex │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── backfill │ │ │ ├── factory.rs │ │ │ ├── job.rs │ │ │ ├── mod.rs │ │ │ ├── stream.rs │ │ │ └── test_utils.rs │ │ │ ├── context.rs │ │ │ ├── event.rs │ │ │ ├── lib.rs │ │ │ └── manager.rs │ ├── test-utils │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ └── types │ │ ├── Cargo.toml │ │ └── src │ │ ├── finished_height.rs │ │ ├── lib.rs │ │ └── notification.rs ├── fs-util │ ├── Cargo.toml │ └── src │ │ └── lib.rs ├── metrics │ ├── Cargo.toml │ ├── metrics-derive │ │ ├── Cargo.toml │ │ ├── src │ │ │ ├── expand.rs │ │ │ ├── lib.rs │ │ │ ├── metric.rs │ │ │ └── with_attrs.rs │ │ └── tests │ │ │ ├── compile-fail │ │ │ ├── metric_attr.rs │ │ │ ├── metric_attr.stderr │ │ │ ├── metrics_attr.rs │ │ │ └── metrics_attr.stderr │ │ │ ├── metrics.rs │ │ │ └── trybuild.rs │ └── src │ │ ├── common │ │ ├── mod.rs │ │ └── mpsc.rs │ │ └── lib.rs ├── net │ ├── banlist │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── discv4 │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src │ │ │ ├── config.rs │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ ├── node.rs │ │ │ ├── proto.rs │ │ │ ├── table.rs │ │ │ └── test_utils.rs │ ├── discv5 │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src │ │ │ ├── config.rs │ │ │ ├── enr.rs │ │ │ ├── error.rs │ │ │ ├── filter.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ └── network_stack_id.rs │ ├── dns │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── config.rs │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ ├── query.rs │ │ │ ├── resolver.rs │ │ │ ├── sync.rs │ │ │ └── tree.rs │ ├── downloaders │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── bodies │ │ │ ├── bodies.rs │ │ │ ├── mod.rs │ │ │ ├── noop.rs │ │ │ ├── queue.rs │ │ │ ├── request.rs │ │ │ ├── task.rs │ │ │ └── test_utils.rs │ │ │ ├── file_client.rs │ │ │ ├── file_codec.rs │ │ │ ├── headers │ │ │ ├── mod.rs │ │ │ ├── noop.rs │ │ │ ├── reverse_headers.rs │ │ │ ├── task.rs │ │ │ └── test_utils.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ ├── receipt_file_client.rs │ │ │ └── test_utils │ │ │ ├── bodies_client.rs │ │ │ └── mod.rs │ ├── ecies │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── algorithm.rs │ │ │ ├── codec.rs │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ ├── mac.rs │ │ │ ├── stream.rs │ │ │ └── util.rs │ ├── eth-wire-types │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── blocks.rs │ │ │ ├── broadcast.rs │ │ │ ├── capability.rs │ │ │ ├── disconnect_reason.rs │ │ │ ├── header.rs │ │ │ ├── lib.rs │ │ │ ├── message.rs │ │ │ ├── receipts.rs │ │ │ ├── response.rs │ │ │ ├── state.rs │ │ │ ├── status.rs │ │ │ ├── transactions.rs │ │ │ └── version.rs │ ├── eth-wire │ │ ├── Cargo.toml │ │ ├── src │ │ │ ├── capability.rs │ │ │ ├── disconnect.rs │ │ │ ├── errors │ │ │ │ ├── eth.rs │ │ │ │ ├── mod.rs │ │ │ │ └── p2p.rs │ │ │ ├── ethstream.rs │ │ │ ├── hello.rs │ │ │ ├── lib.rs │ │ │ ├── multiplex.rs │ │ │ ├── p2pstream.rs │ │ │ ├── pinger.rs │ │ │ ├── protocol.rs │ │ │ └── test_utils.rs │ │ ├── testdata │ │ │ ├── blob_transaction │ │ │ ├── bsc_new_block_network_one │ │ │ ├── bsc_new_block_network_two │ │ │ ├── new_block_network_rlp │ │ │ ├── new_pooled_transactions_network_rlp │ │ │ ├── pooled_transactions_with_blob │ │ │ ├── request_pair_pooled_blob_transactions │ │ │ └── rpc_blob_transaction │ │ └── tests │ │ │ ├── fuzz_roundtrip.rs │ │ │ ├── new_block.rs │ │ │ ├── new_pooled_transactions.rs │ │ │ └── pooled_transactions.rs │ ├── nat │ │ ├── Cargo.toml │ │ └── src │ │ │ └── lib.rs │ ├── network-api │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── downloaders.rs │ │ │ ├── error.rs │ │ │ ├── events.rs │ │ │ ├── lib.rs │ │ │ ├── noop.rs │ │ │ └── test_utils │ │ │ ├── mod.rs │ │ │ └── peers_manager.rs │ ├── network-types │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── backoff.rs │ │ │ ├── lib.rs │ │ │ ├── peers │ │ │ ├── addr.rs │ │ │ ├── config.rs │ │ │ ├── kind.rs │ │ │ ├── mod.rs │ │ │ ├── reputation.rs │ │ │ └── state.rs │ │ │ └── session │ │ │ ├── config.rs │ │ │ └── mod.rs │ ├── network │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── benches │ │ │ └── bench.rs │ │ ├── docs │ │ │ └── mermaid │ │ │ │ ├── fetch-client.mmd │ │ │ │ ├── network-manager.mmd │ │ │ │ └── swarm.mmd │ │ ├── src │ │ │ ├── budget.rs │ │ │ ├── builder.rs │ │ │ ├── cache.rs │ │ │ ├── config.rs │ │ │ ├── discovery.rs │ │ │ ├── error.rs │ │ │ ├── eth_requests.rs │ │ │ ├── fetch │ │ │ │ ├── client.rs │ │ │ │ └── mod.rs │ │ │ ├── flattened_response.rs │ │ │ ├── import.rs │ │ │ ├── lib.rs │ │ │ ├── listener.rs │ │ │ ├── manager.rs │ │ │ ├── message.rs │ │ │ ├── metrics.rs │ │ │ ├── network.rs │ │ │ ├── peers.rs │ │ │ ├── protocol.rs │ │ │ ├── session │ │ │ │ ├── active.rs │ │ │ │ ├── conn.rs │ │ │ │ ├── counter.rs │ │ │ │ ├── handle.rs │ │ │ │ └── mod.rs │ │ │ ├── state.rs │ │ │ ├── swarm.rs │ │ │ ├── test_utils │ │ │ │ ├── init.rs │ │ │ │ ├── mod.rs │ │ │ │ └── testnet.rs │ │ │ └── transactions │ │ │ │ ├── config.rs │ │ │ │ ├── constants.rs │ │ │ │ ├── fetcher.rs │ │ │ │ ├── mod.rs │ │ │ │ └── validation.rs │ │ └── tests │ │ │ └── it │ │ │ ├── big_pooled_txs_req.rs │ │ │ ├── connect.rs │ │ │ ├── main.rs │ │ │ ├── multiplex.rs │ │ │ ├── requests.rs │ │ │ ├── session.rs │ │ │ ├── startup.rs │ │ │ └── txgossip.rs │ ├── p2p │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── bodies │ │ │ ├── client.rs │ │ │ ├── downloader.rs │ │ │ ├── mod.rs │ │ │ └── response.rs │ │ │ ├── download.rs │ │ │ ├── either.rs │ │ │ ├── error.rs │ │ │ ├── full_block.rs │ │ │ ├── headers │ │ │ ├── client.rs │ │ │ ├── downloader.rs │ │ │ ├── error.rs │ │ │ └── mod.rs │ │ │ ├── lib.rs │ │ │ ├── priority.rs │ │ │ ├── sync.rs │ │ │ └── test_utils │ │ │ ├── bodies.rs │ │ │ ├── full_block.rs │ │ │ ├── headers.rs │ │ │ └── mod.rs │ └── peers │ │ ├── Cargo.toml │ │ └── src │ │ ├── bootnodes │ │ ├── ethereum.rs │ │ ├── mod.rs │ │ └── optimism.rs │ │ ├── lib.rs │ │ ├── node_record.rs │ │ └── trusted_peer.rs ├── node │ ├── api │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ ├── node.rs │ │ │ └── primitives.rs │ ├── builder │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── docs │ │ │ └── mermaid │ │ │ │ └── builder.mmd │ │ └── src │ │ │ ├── builder │ │ │ ├── add_ons.rs │ │ │ ├── mod.rs │ │ │ └── states.rs │ │ │ ├── components │ │ │ ├── builder.rs │ │ │ ├── consensus.rs │ │ │ ├── execute.rs │ │ │ ├── mod.rs │ │ │ ├── network.rs │ │ │ ├── payload.rs │ │ │ └── pool.rs │ │ │ ├── exex.rs │ │ │ ├── handle.rs │ │ │ ├── hooks.rs │ │ │ ├── launch │ │ │ ├── common.rs │ │ │ ├── engine.rs │ │ │ ├── exex.rs │ │ │ └── mod.rs │ │ │ ├── lib.rs │ │ │ ├── node.rs │ │ │ ├── rpc.rs │ │ │ └── setup.rs │ ├── core │ │ ├── Cargo.toml │ │ ├── build.rs │ │ └── src │ │ │ ├── args │ │ │ ├── benchmark_args.rs │ │ │ ├── database.rs │ │ │ ├── datadir_args.rs │ │ │ ├── debug.rs │ │ │ ├── dev.rs │ │ │ ├── gas_price_oracle.rs │ │ │ ├── log.rs │ │ │ ├── mod.rs │ │ │ ├── network.rs │ │ │ ├── payload_builder.rs │ │ │ ├── pruning.rs │ │ │ ├── rpc_server.rs │ │ │ ├── rpc_state_cache.rs │ │ │ ├── stage.rs │ │ │ ├── txpool.rs │ │ │ ├── types.rs │ │ │ └── utils.rs │ │ │ ├── cli │ │ │ ├── config.rs │ │ │ └── mod.rs │ │ │ ├── dirs.rs │ │ │ ├── exit.rs │ │ │ ├── lib.rs │ │ │ ├── node_config.rs │ │ │ ├── utils.rs │ │ │ └── version.rs │ ├── events │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── cl.rs │ │ │ ├── lib.rs │ │ │ └── node.rs │ └── metrics │ │ ├── Cargo.toml │ │ └── src │ │ ├── hooks.rs │ │ ├── lib.rs │ │ ├── recorder.rs │ │ ├── server.rs │ │ └── version.rs ├── optimism │ ├── cli │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── chainspec.rs │ │ │ ├── commands │ │ │ ├── build_pipeline.rs │ │ │ ├── import.rs │ │ │ ├── import_receipts.rs │ │ │ └── mod.rs │ │ │ ├── file_codec_ovm_receipt.rs │ │ │ └── lib.rs │ ├── consensus │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── validation.rs │ ├── evm │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── config.rs │ │ │ ├── error.rs │ │ │ ├── execute.rs │ │ │ ├── l1.rs │ │ │ └── lib.rs │ ├── node │ │ ├── Cargo.toml │ │ ├── src │ │ │ ├── args.rs │ │ │ ├── engine.rs │ │ │ ├── lib.rs │ │ │ ├── node.rs │ │ │ ├── rpc.rs │ │ │ └── txpool.rs │ │ └── tests │ │ │ ├── assets │ │ │ └── genesis.json │ │ │ ├── e2e │ │ │ ├── main.rs │ │ │ ├── p2p.rs │ │ │ └── utils.rs │ │ │ └── it │ │ │ ├── builder.rs │ │ │ └── main.rs │ ├── payload │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── builder.rs │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ └── payload.rs │ ├── primitives │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── bedrock_import.rs │ │ │ └── lib.rs │ └── rpc │ │ ├── Cargo.toml │ │ └── src │ │ ├── api.rs │ │ ├── error.rs │ │ ├── eth │ │ ├── block.rs │ │ ├── call.rs │ │ ├── mod.rs │ │ ├── pending_block.rs │ │ ├── receipt.rs │ │ └── transaction.rs │ │ └── lib.rs ├── payload │ ├── basic │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── lib.rs │ │ │ └── metrics.rs │ ├── builder │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── database.rs │ │ │ ├── error.rs │ │ │ ├── events.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ ├── noop.rs │ │ │ ├── service.rs │ │ │ ├── test_utils.rs │ │ │ └── traits.rs │ ├── primitives │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ ├── payload.rs │ │ │ └── traits.rs │ └── validator │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── primitives-traits │ ├── Cargo.toml │ └── src │ │ ├── account.rs │ │ ├── alloy_compat.rs │ │ ├── constants │ │ ├── gas_units.rs │ │ └── mod.rs │ │ ├── error.rs │ │ ├── header │ │ ├── error.rs │ │ ├── mod.rs │ │ ├── sealed.rs │ │ └── test_utils.rs │ │ ├── integer_list.rs │ │ ├── lib.rs │ │ ├── log.rs │ │ ├── request.rs │ │ ├── storage.rs │ │ └── withdrawal.rs ├── primitives │ ├── Cargo.toml │ ├── benches │ │ ├── recover_ecdsa_crit.rs │ │ └── validate_blob_tx.rs │ └── src │ │ ├── alloy_compat.rs │ │ ├── basefee.rs │ │ ├── block.rs │ │ ├── compression │ │ ├── mod.rs │ │ ├── receipt_dictionary.bin │ │ └── transaction_dictionary.bin │ │ ├── constants │ │ ├── eip4844.rs │ │ └── mod.rs │ │ ├── eip4844.rs │ │ ├── eip7702.rs │ │ ├── genesis.rs │ │ ├── lib.rs │ │ ├── proofs.rs │ │ ├── receipt.rs │ │ └── transaction │ │ ├── access_list.rs │ │ ├── blob_data │ │ ├── README.md │ │ ├── blob1.json │ │ ├── blob2.json │ │ ├── blob3.json │ │ └── blob4.json │ │ ├── compat.rs │ │ ├── eip1559.rs │ │ ├── eip2930.rs │ │ ├── eip4844.rs │ │ ├── eip7702.rs │ │ ├── error.rs │ │ ├── legacy.rs │ │ ├── meta.rs │ │ ├── mod.rs │ │ ├── optimism.rs │ │ ├── pooled.rs │ │ ├── sidecar.rs │ │ ├── signature.rs │ │ ├── tx_type.rs │ │ ├── util.rs │ │ └── variant.rs ├── prune │ ├── prune │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── builder.rs │ │ │ ├── error.rs │ │ │ ├── event.rs │ │ │ ├── lib.rs │ │ │ ├── metrics.rs │ │ │ ├── pruner.rs │ │ │ └── segments │ │ │ ├── mod.rs │ │ │ ├── receipts.rs │ │ │ ├── set.rs │ │ │ ├── static_file │ │ │ ├── headers.rs │ │ │ ├── mod.rs │ │ │ ├── receipts.rs │ │ │ └── transactions.rs │ │ │ └── user │ │ │ ├── account_history.rs │ │ │ ├── history.rs │ │ │ ├── mod.rs │ │ │ ├── receipts.rs │ │ │ ├── receipts_by_logs.rs │ │ │ ├── sender_recovery.rs │ │ │ ├── storage_history.rs │ │ │ └── transaction_lookup.rs │ └── types │ │ ├── Cargo.toml │ │ └── src │ │ ├── checkpoint.rs │ │ ├── lib.rs │ │ ├── limiter.rs │ │ ├── mode.rs │ │ ├── pruner.rs │ │ ├── segment.rs │ │ └── target.rs ├── revm │ ├── Cargo.toml │ └── src │ │ ├── batch.rs │ │ ├── database.rs │ │ ├── lib.rs │ │ ├── state_change.rs │ │ └── test_utils.rs ├── rpc │ ├── ipc │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src │ │ │ ├── client │ │ │ └── mod.rs │ │ │ ├── lib.rs │ │ │ ├── server │ │ │ ├── connection.rs │ │ │ ├── ipc.rs │ │ │ ├── mod.rs │ │ │ └── rpc_service.rs │ │ │ └── stream_codec.rs │ ├── rpc-api │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── admin.rs │ │ │ ├── anvil.rs │ │ │ ├── debug.rs │ │ │ ├── engine.rs │ │ │ ├── ganache.rs │ │ │ ├── hardhat.rs │ │ │ ├── lib.rs │ │ │ ├── mev.rs │ │ │ ├── net.rs │ │ │ ├── otterscan.rs │ │ │ ├── reth.rs │ │ │ ├── rpc.rs │ │ │ ├── trace.rs │ │ │ ├── txpool.rs │ │ │ ├── validation.rs │ │ │ └── web3.rs │ ├── rpc-builder │ │ ├── Cargo.toml │ │ ├── src │ │ │ ├── auth.rs │ │ │ ├── config.rs │ │ │ ├── cors.rs │ │ │ ├── error.rs │ │ │ ├── eth.rs │ │ │ ├── lib.rs │ │ │ └── metrics.rs │ │ └── tests │ │ │ └── it │ │ │ ├── auth.rs │ │ │ ├── http.rs │ │ │ ├── main.rs │ │ │ ├── middleware.rs │ │ │ ├── serde.rs │ │ │ ├── startup.rs │ │ │ └── utils.rs │ ├── rpc-engine-api │ │ ├── Cargo.toml │ │ ├── src │ │ │ ├── capabilities.rs │ │ │ ├── engine_api.rs │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ ├── message.rs │ │ │ └── metrics.rs │ │ └── tests │ │ │ └── it │ │ │ ├── main.rs │ │ │ └── payload.rs │ ├── rpc-eth-api │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── bundle.rs │ │ │ ├── core.rs │ │ │ ├── filter.rs │ │ │ ├── helpers │ │ │ ├── block.rs │ │ │ ├── blocking_task.rs │ │ │ ├── call.rs │ │ │ ├── error.rs │ │ │ ├── fee.rs │ │ │ ├── mod.rs │ │ │ ├── pending_block.rs │ │ │ ├── receipt.rs │ │ │ ├── signer.rs │ │ │ ├── spec.rs │ │ │ ├── state.rs │ │ │ ├── trace.rs │ │ │ └── transaction.rs │ │ │ ├── lib.rs │ │ │ ├── pubsub.rs │ │ │ └── types.rs │ ├── rpc-eth-types │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── builder │ │ │ ├── config.rs │ │ │ ├── ctx.rs │ │ │ └── mod.rs │ │ │ ├── cache │ │ │ ├── config.rs │ │ │ ├── db.rs │ │ │ ├── metrics.rs │ │ │ ├── mod.rs │ │ │ └── multi_consumer.rs │ │ │ ├── error.rs │ │ │ ├── fee_history.rs │ │ │ ├── gas_oracle.rs │ │ │ ├── id_provider.rs │ │ │ ├── lib.rs │ │ │ ├── logs_utils.rs │ │ │ ├── pending_block.rs │ │ │ ├── receipt.rs │ │ │ ├── revm_utils.rs │ │ │ ├── transaction.rs │ │ │ └── utils.rs │ ├── rpc-layer │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── auth_client_layer.rs │ │ │ ├── auth_layer.rs │ │ │ ├── jwt_validator.rs │ │ │ └── lib.rs │ ├── rpc-server-types │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── constants.rs │ │ │ ├── lib.rs │ │ │ ├── module.rs │ │ │ └── result.rs │ ├── rpc-testing-util │ │ ├── Cargo.toml │ │ ├── assets │ │ │ ├── noop-tracer.js │ │ │ └── tracer-template.js │ │ ├── src │ │ │ ├── debug.rs │ │ │ ├── lib.rs │ │ │ ├── trace.rs │ │ │ └── utils.rs │ │ └── tests │ │ │ └── it │ │ │ ├── main.rs │ │ │ └── trace.rs │ ├── rpc-types-compat │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── block.rs │ │ │ ├── engine │ │ │ ├── mod.rs │ │ │ └── payload.rs │ │ │ ├── lib.rs │ │ │ ├── proof.rs │ │ │ └── transaction │ │ │ ├── mod.rs │ │ │ ├── signature.rs │ │ │ └── typed.rs │ ├── rpc-types │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── eth │ │ │ ├── error.rs │ │ │ ├── mod.rs │ │ │ └── transaction │ │ │ │ ├── mod.rs │ │ │ │ ├── request.rs │ │ │ │ └── typed.rs │ │ │ └── lib.rs │ └── rpc │ │ ├── Cargo.toml │ │ └── src │ │ ├── admin.rs │ │ ├── debug.rs │ │ ├── engine.rs │ │ ├── eth │ │ ├── bundle.rs │ │ ├── core.rs │ │ ├── filter.rs │ │ ├── helpers │ │ │ ├── block.rs │ │ │ ├── call.rs │ │ │ ├── fees.rs │ │ │ ├── mod.rs │ │ │ ├── pending_block.rs │ │ │ ├── receipt.rs │ │ │ ├── signer.rs │ │ │ ├── spec.rs │ │ │ ├── state.rs │ │ │ ├── trace.rs │ │ │ └── transaction.rs │ │ ├── mod.rs │ │ └── pubsub.rs │ │ ├── lib.rs │ │ ├── net.rs │ │ ├── otterscan.rs │ │ ├── reth.rs │ │ ├── rpc.rs │ │ ├── trace.rs │ │ ├── txpool.rs │ │ └── web3.rs ├── stages │ ├── api │ │ ├── Cargo.toml │ │ ├── docs │ │ │ └── mermaid │ │ │ │ └── pipeline.mmd │ │ └── src │ │ │ ├── error.rs │ │ │ ├── lib.rs │ │ │ ├── metrics │ │ │ ├── listener.rs │ │ │ ├── mod.rs │ │ │ └── sync_metrics.rs │ │ │ ├── pipeline │ │ │ ├── builder.rs │ │ │ ├── ctrl.rs │ │ │ ├── event.rs │ │ │ ├── mod.rs │ │ │ ├── progress.rs │ │ │ └── set.rs │ │ │ ├── stage.rs │ │ │ ├── test_utils.rs │ │ │ └── util.rs │ ├── stages │ │ ├── Cargo.toml │ │ ├── benches │ │ │ ├── README.md │ │ │ ├── criterion.rs │ │ │ └── setup │ │ │ │ ├── account_hashing.rs │ │ │ │ ├── constants.rs │ │ │ │ └── mod.rs │ │ └── src │ │ │ ├── lib.rs │ │ │ ├── prelude.rs │ │ │ ├── sets.rs │ │ │ ├── stages │ │ │ ├── bodies.rs │ │ │ ├── execution.rs │ │ │ ├── finish.rs │ │ │ ├── hashing_account.rs │ │ │ ├── hashing_storage.rs │ │ │ ├── headers.rs │ │ │ ├── index_account_history.rs │ │ │ ├── index_storage_history.rs │ │ │ ├── merkle.rs │ │ │ ├── mod.rs │ │ │ ├── prune.rs │ │ │ ├── sender_recovery.rs │ │ │ ├── tx_lookup.rs │ │ │ └── utils.rs │ │ │ └── test_utils │ │ │ ├── macros.rs │ │ │ ├── mod.rs │ │ │ ├── runner.rs │ │ │ ├── set.rs │ │ │ └── test_db.rs │ └── types │ │ ├── Cargo.toml │ │ └── src │ │ ├── checkpoints.rs │ │ ├── execution.rs │ │ ├── id.rs │ │ └── lib.rs ├── static-file │ ├── static-file │ │ ├── Cargo.toml │ │ ├── README.md │ │ └── src │ │ │ ├── event.rs │ │ │ ├── lib.rs │ │ │ ├── segments │ │ │ ├── headers.rs │ │ │ ├── mod.rs │ │ │ ├── receipts.rs │ │ │ └── transactions.rs │ │ │ └── static_file_producer.rs │ └── types │ │ ├── Cargo.toml │ │ └── src │ │ ├── compression.rs │ │ ├── filters.rs │ │ ├── lib.rs │ │ └── segment.rs ├── storage │ ├── codecs │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── derive │ │ │ ├── Cargo.toml │ │ │ └── src │ │ │ │ ├── arbitrary.rs │ │ │ │ ├── compact │ │ │ │ ├── enums.rs │ │ │ │ ├── flags.rs │ │ │ │ ├── generator.rs │ │ │ │ ├── mod.rs │ │ │ │ └── structs.rs │ │ │ │ └── lib.rs │ │ ├── src │ │ │ ├── alloy │ │ │ │ ├── access_list.rs │ │ │ │ ├── authorization_list.rs │ │ │ │ ├── genesis_account.rs │ │ │ │ ├── log.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── request.rs │ │ │ │ ├── trie.rs │ │ │ │ ├── txkind.rs │ │ │ │ └── withdrawal.rs │ │ │ └── lib.rs │ │ └── testdata │ │ │ ├── access_list_compact.json │ │ │ └── log_compact.json │ ├── db-api │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── common.rs │ │ │ ├── cursor.rs │ │ │ ├── database.rs │ │ │ ├── database_metrics.rs │ │ │ ├── lib.rs │ │ │ ├── mock.rs │ │ │ ├── models │ │ │ ├── accounts.rs │ │ │ ├── blocks.rs │ │ │ ├── client_version.rs │ │ │ ├── integer_list.rs │ │ │ ├── mod.rs │ │ │ ├── sharded_key.rs │ │ │ └── storage_sharded_key.rs │ │ │ ├── scale.rs │ │ │ ├── table.rs │ │ │ ├── transaction.rs │ │ │ └── utils.rs │ ├── db-common │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── db_tool │ │ │ └── mod.rs │ │ │ ├── init.rs │ │ │ └── lib.rs │ ├── db-models │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── accounts.rs │ │ │ ├── blocks.rs │ │ │ └── lib.rs │ ├── db │ │ ├── Cargo.toml │ │ ├── benches │ │ │ ├── README.md │ │ │ ├── criterion.rs │ │ │ ├── hash_keys.rs │ │ │ ├── iai.rs │ │ │ └── utils.rs │ │ └── src │ │ │ ├── implementation │ │ │ ├── mdbx │ │ │ │ ├── cursor.rs │ │ │ │ ├── mod.rs │ │ │ │ └── tx.rs │ │ │ └── mod.rs │ │ │ ├── lib.rs │ │ │ ├── lockfile.rs │ │ │ ├── mdbx.rs │ │ │ ├── metrics.rs │ │ │ ├── static_file │ │ │ ├── cursor.rs │ │ │ ├── mask.rs │ │ │ ├── masks.rs │ │ │ └── mod.rs │ │ │ ├── tables │ │ │ ├── codecs │ │ │ │ ├── fuzz │ │ │ │ │ ├── inputs.rs │ │ │ │ │ └── mod.rs │ │ │ │ └── mod.rs │ │ │ ├── mod.rs │ │ │ ├── raw.rs │ │ │ └── utils.rs │ │ │ ├── utils.rs │ │ │ └── version.rs │ ├── errors │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── db.rs │ │ │ ├── lib.rs │ │ │ ├── lockfile.rs │ │ │ ├── provider.rs │ │ │ └── writer.rs │ ├── libmdbx-rs │ │ ├── Cargo.toml │ │ ├── README.md │ │ ├── benches │ │ │ ├── cursor.rs │ │ │ ├── transaction.rs │ │ │ └── utils.rs │ │ ├── mdbx-sys │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ ├── libmdbx │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── GNUmakefile │ │ │ │ ├── LICENSE │ │ │ │ ├── Makefile │ │ │ │ ├── VERSION.txt │ │ │ │ ├── cmake │ │ │ │ │ ├── compiler.cmake │ │ │ │ │ ├── profile.cmake │ │ │ │ │ └── utils.cmake │ │ │ │ ├── config.h.in │ │ │ │ ├── man1 │ │ │ │ │ ├── mdbx_chk.1 │ │ │ │ │ ├── mdbx_copy.1 │ │ │ │ │ ├── mdbx_drop.1 │ │ │ │ │ ├── mdbx_dump.1 │ │ │ │ │ ├── mdbx_load.1 │ │ │ │ │ └── mdbx_stat.1 │ │ │ │ ├── mdbx.c │ │ │ │ ├── mdbx.c++ │ │ │ │ ├── mdbx.h │ │ │ │ ├── mdbx.h++ │ │ │ │ ├── mdbx_chk.c │ │ │ │ ├── mdbx_copy.c │ │ │ │ ├── mdbx_drop.c │ │ │ │ ├── mdbx_dump.c │ │ │ │ ├── mdbx_load.c │ │ │ │ ├── mdbx_stat.c │ │ │ │ └── ntdll.def │ │ │ └── src │ │ │ │ └── lib.rs │ │ ├── src │ │ │ ├── codec.rs │ │ │ ├── cursor.rs │ │ │ ├── database.rs │ │ │ ├── environment.rs │ │ │ ├── error.rs │ │ │ ├── flags.rs │ │ │ ├── lib.rs │ │ │ ├── transaction.rs │ │ │ └── txn_manager.rs │ │ └── tests │ │ │ ├── cursor.rs │ │ │ ├── environment.rs │ │ │ └── transaction.rs │ ├── nippy-jar │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── compression │ │ │ ├── lz4.rs │ │ │ ├── mod.rs │ │ │ └── zstd.rs │ │ │ ├── cursor.rs │ │ │ ├── error.rs │ │ │ ├── filter │ │ │ ├── cuckoo.rs │ │ │ └── mod.rs │ │ │ ├── lib.rs │ │ │ ├── phf │ │ │ ├── fmph.rs │ │ │ ├── go_fmph.rs │ │ │ └── mod.rs │ │ │ └── writer.rs │ ├── provider │ │ ├── Cargo.toml │ │ └── src │ │ │ ├── bundle_state │ │ │ ├── mod.rs │ │ │ └── state_reverts.rs │ │ │ ├── lib.rs │ │ │ ├── providers │ │ │ ├── blockchain_provider.rs │ │ │ ├── bundle_state_provider.rs │ │ │ ├── consistent_view.rs │ │ │ ├── database │ │ │ │ ├── metrics.rs │ │ │ │ ├── mod.rs │ │ │ │ └── provider.rs │ │ │ ├── mod.rs │ │ │ ├── state │ │ │ │ ├── historical.rs │ │ │ │ ├── latest.rs │ │ │ │ ├── macros.rs │ │ │ │ └── mod.rs │ │ │ └── static_file │ │ │ │ ├── jar.rs │ │ │ │ ├── manager.rs │ │ │ │ ├── metrics.rs │ │ │ │ ├── mod.rs │ │ │ │ └── writer.rs │ │ │ ├── test_utils │ │ │ ├── blocks.rs │ │ │ ├── mock.rs │ │ │ ├── mod.rs │ │ │ └── noop.rs │ │ │ ├── traits │ │ │ ├── block.rs │ │ │ ├── chain_info.rs │ │ │ ├── database_provider.rs │ │ │ ├── finalized_block.rs │ │ │ ├── full.rs │ │ │ ├── hashing.rs │ │ │ ├── header_sync_gap.rs │ │ │ ├── history.rs │ │ │ ├── mod.rs │ │ │ ├── state.rs │ │ │ ├── static_file_provider.rs │ │ │ ├── stats.rs │ │ │ ├── tree_viewer.rs │ │ │ └── trie.rs │ │ │ └── writer │ │ │ ├── database.rs │ │ │ ├── mod.rs │ │ │ └── static_file.rs │ └── storage-api │ │ ├── Cargo.toml │ │ └── src │ │ ├── account.rs │ │ ├── block.rs │ │ ├── block_hash.rs │ │ ├── block_id.rs │ │ ├── header.rs │ │ ├── lib.rs │ │ ├── noop.rs │ │ ├── prune_checkpoint.rs │ │ ├── receipts.rs │ │ ├── requests.rs │ │ ├── stage_checkpoint.rs │ │ ├── state.rs │ │ ├── storage.rs │ │ ├── transactions.rs │ │ ├── trie.rs │ │ └── withdrawals.rs ├── tasks │ ├── Cargo.toml │ └── src │ │ ├── lib.rs │ │ ├── metrics.rs │ │ ├── pool.rs │ │ └── shutdown.rs ├── tokio-util │ ├── Cargo.toml │ └── src │ │ ├── event_sender.rs │ │ ├── event_stream.rs │ │ ├── lib.rs │ │ └── ratelimit.rs ├── tracing │ ├── Cargo.toml │ └── src │ │ ├── formatter.rs │ │ ├── layers.rs │ │ ├── lib.rs │ │ └── test_tracer.rs ├── transaction-pool │ ├── Cargo.toml │ ├── benches │ │ ├── priority.rs │ │ ├── reorder.rs │ │ └── truncate.rs │ ├── docs │ │ └── mermaid │ │ │ └── txpool.mmd │ ├── src │ │ ├── blobstore │ │ │ ├── disk.rs │ │ │ ├── mem.rs │ │ │ ├── mod.rs │ │ │ ├── noop.rs │ │ │ └── tracker.rs │ │ ├── config.rs │ │ ├── error.rs │ │ ├── identifier.rs │ │ ├── lib.rs │ │ ├── maintain.rs │ │ ├── metrics.rs │ │ ├── noop.rs │ │ ├── ordering.rs │ │ ├── pool │ │ │ ├── best.rs │ │ │ ├── blob.rs │ │ │ ├── events.rs │ │ │ ├── listener.rs │ │ │ ├── mod.rs │ │ │ ├── parked.rs │ │ │ ├── pending.rs │ │ │ ├── size.rs │ │ │ ├── state.rs │ │ │ ├── txpool.rs │ │ │ └── update.rs │ │ ├── test_utils │ │ │ ├── gen.rs │ │ │ ├── mock.rs │ │ │ ├── mod.rs │ │ │ └── pool.rs │ │ ├── traits.rs │ │ └── validate │ │ │ ├── constants.rs │ │ │ ├── eth.rs │ │ │ ├── mod.rs │ │ │ └── task.rs │ ├── test_data │ │ └── blob1.json │ └── tests │ │ └── it │ │ ├── blobs.rs │ │ ├── evict.rs │ │ ├── listeners.rs │ │ ├── main.rs │ │ └── pending.rs └── trie │ ├── common │ ├── Cargo.toml │ └── src │ │ ├── account.rs │ │ ├── hash_builder │ │ ├── mod.rs │ │ └── state.rs │ │ ├── lib.rs │ │ ├── nibbles.rs │ │ ├── proofs.rs │ │ ├── root.rs │ │ ├── storage.rs │ │ └── subnode.rs │ ├── db │ ├── Cargo.toml │ ├── src │ │ ├── hashed_cursor.rs │ │ ├── lib.rs │ │ ├── prefix_set.rs │ │ ├── proof.rs │ │ ├── state.rs │ │ ├── storage.rs │ │ ├── trie_cursor.rs │ │ └── witness.rs │ └── tests │ │ ├── fuzz_in_memory_nodes.rs │ │ ├── post_state.rs │ │ ├── proof.rs │ │ ├── trie.rs │ │ └── walker.rs │ ├── parallel │ ├── Cargo.toml │ ├── benches │ │ └── root.rs │ └── src │ │ ├── async_root.rs │ │ ├── lib.rs │ │ ├── metrics.rs │ │ ├── parallel_root.rs │ │ ├── stats.rs │ │ └── storage_root_targets.rs │ └── trie │ ├── Cargo.toml │ ├── benches │ ├── hash_post_state.rs │ ├── prefix_set.rs │ └── trie_root.rs │ ├── src │ ├── forward_cursor.rs │ ├── hashed_cursor │ │ ├── mod.rs │ │ └── post_state.rs │ ├── lib.rs │ ├── metrics.rs │ ├── node_iter.rs │ ├── prefix_set.rs │ ├── progress.rs │ ├── proof.rs │ ├── state.rs │ ├── stats.rs │ ├── test_utils.rs │ ├── trie.rs │ ├── trie_cursor │ │ ├── in_memory.rs │ │ ├── mod.rs │ │ ├── noop.rs │ │ └── subnode.rs │ ├── updates.rs │ ├── walker.rs │ └── witness.rs │ └── testdata │ └── proof-genesis.json ├── deny.toml ├── docs ├── README.md ├── crates │ ├── README.md │ ├── db.md │ ├── discv4.md │ ├── eth-wire.md │ ├── network.md │ └── stages.md ├── design │ ├── README.md │ ├── codecs.md │ ├── database.md │ ├── goals.md │ ├── headers-downloader.md │ ├── metrics.md │ ├── p2p.md │ └── review.md ├── release.md ├── repo │ ├── README.md │ ├── ci.md │ ├── labels.md │ └── layout.md └── workflow.md ├── etc ├── .gitignore ├── README.md ├── assertoor │ └── assertoor-template.yaml ├── docker-compose.yml ├── ethereum-metrics-exporter │ └── config.yaml ├── generate-jwt.sh ├── grafana │ ├── dashboards │ │ ├── dashboard.yml │ │ ├── metrics-exporter.json │ │ ├── overview.json │ │ ├── reth-discovery.json │ │ ├── reth-mempool.json │ │ └── reth-state-growth.json │ └── datasources │ │ └── prometheus.yml ├── lighthouse.yml └── prometheus │ └── prometheus.yml ├── examples ├── README.md ├── beacon-api-sidecar-fetcher │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── mined_sidecar.rs ├── beacon-api-sse │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── bsc-p2p │ ├── Cargo.toml │ └── src │ │ ├── chainspec.rs │ │ ├── genesis.json │ │ └── main.rs ├── custom-dev-node │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── custom-engine-types │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── custom-evm │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── custom-inspector │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── custom-node-components │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── custom-payload-builder │ ├── Cargo.toml │ └── src │ │ ├── generator.rs │ │ ├── job.rs │ │ └── main.rs ├── custom-rlpx-subprotocol │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── subprotocol │ │ ├── connection │ │ ├── handler.rs │ │ └── mod.rs │ │ ├── mod.rs │ │ └── protocol │ │ ├── event.rs │ │ ├── handler.rs │ │ ├── mod.rs │ │ └── proto.rs ├── db-access │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── manual-p2p │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── network-txpool │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── network │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── node-custom-rpc │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── node-event-hooks │ ├── Cargo.toml │ └── src │ │ └── main.rs ├── polygon-p2p │ ├── Cargo.toml │ └── src │ │ ├── chain_cfg.rs │ │ ├── genesis.json │ │ └── main.rs ├── rpc-db │ ├── Cargo.toml │ └── src │ │ ├── main.rs │ │ └── myrpc_ext.rs ├── stateful-precompile │ ├── Cargo.toml │ └── src │ │ └── main.rs └── txpool-tracing │ ├── Cargo.toml │ └── src │ └── main.rs ├── rustfmt.toml └── testing ├── ef-tests ├── .gitignore ├── Cargo.toml ├── src │ ├── assert.rs │ ├── case.rs │ ├── cases │ │ ├── blockchain_test.rs │ │ └── mod.rs │ ├── lib.rs │ ├── models.rs │ ├── result.rs │ └── suite.rs └── tests │ └── tests.rs └── testing-utils ├── Cargo.toml └── src ├── generators.rs ├── genesis_allocator.rs └── lib.rs /.cargo/config.toml: -------------------------------------------------------------------------------- 1 | [alias] 2 | docs = "doc --workspace --all-features --no-deps" 3 | 4 | [target.x86_64-pc-windows-msvc] 5 | rustflags = [ 6 | # Increases the stack size to 10MB, which is 7 | # in line with Linux (whereas default for Windows is 1MB) 8 | "-Clink-arg=/STACK:10000000", 9 | ] 10 | 11 | [target.i686-pc-windows-msvc] 12 | rustflags = [ 13 | # Increases the stack size to 10MB, which is 14 | # in line with Linux (whereas default for Windows is 1MB) 15 | "-Clink-arg=/STACK:10000000", 16 | ] 17 | -------------------------------------------------------------------------------- /.codespellrc: -------------------------------------------------------------------------------- 1 | [codespell] 2 | skip = .git,target,./crates/storage/libmdbx-rs/mdbx-sys/libmdbx,Cargo.toml,Cargo.lock 3 | ignore-words-list = crate,ser,ratatui 4 | -------------------------------------------------------------------------------- /.config/nextest.toml: -------------------------------------------------------------------------------- 1 | [profile.default] 2 | retries = { backoff = "exponential", count = 2, delay = "2s", jitter = true } 3 | slow-timeout = { period = "30s", terminate-after = 4 } 4 | 5 | [[profile.default.overrides]] 6 | filter = "test(general_state_tests)" 7 | slow-timeout = { period = "1m", terminate-after = 10 } 8 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | # exclude everything 2 | * 3 | 4 | # include source files 5 | !/bin 6 | !/crates 7 | !/testing 8 | !book.toml 9 | !Cargo.lock 10 | !Cargo.toml 11 | !Cross.toml 12 | !deny.toml 13 | !Makefile 14 | 15 | # include for vergen constants 16 | !/.git 17 | 18 | # include dist directory, where the reth binary is located after compilation 19 | !/dist 20 | 21 | # include licenses 22 | !LICENSE-* 23 | 24 | # include example files 25 | !/examples 26 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | end_of_line = lf 9 | charset = utf-8 10 | trim_trailing_whitespace = true 11 | insert_final_newline = true 12 | indent_style = space 13 | indent_size = 4 14 | 15 | [*.rs] 16 | max_line_length = 100 17 | 18 | [*.{yml,yaml}] 19 | indent_size = 2 20 | 21 | [*.md] 22 | # double whitespace at end of line 23 | # denotes a line break in Markdown 24 | trim_trailing_whitespace = false 25 | 26 | [Makefile] 27 | indent_style = tab 28 | 29 | [] 30 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | book/cli/**/*.md linguist-vendored 2 | book/cli/cli.md -linguist-vendored 3 | 4 | crates/storage/libmdbx-rs/mdbx-sys/** linguist-vendored 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: GitHub Discussions 4 | url: https://github.com/paradigmxyz/reth/discussions 5 | about: Please ask and answer questions here to keep the issue tracker clean. 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/docs.yml: -------------------------------------------------------------------------------- 1 | name: Documentation 2 | description: Suggest a change to our documentation 3 | labels: ["C-docs", "S-needs-triage"] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | If you are unsure if the docs are relevant or needed, please open up a discussion first. 9 | - type: textarea 10 | attributes: 11 | label: Describe the change 12 | description: | 13 | Please describe the documentation you want to change or add, and if it is for end-users or contributors. 14 | validations: 15 | required: true 16 | - type: textarea 17 | attributes: 18 | label: Additional context 19 | description: Add any other context to the feature (like screenshots, resources) 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Suggest a feature 3 | labels: ["C-enhancement", "S-needs-triage"] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Please ensure that the feature has not already been requested in the issue tracker. 9 | - type: textarea 10 | attributes: 11 | label: Describe the feature 12 | description: | 13 | Please describe the feature and what it is aiming to solve, if relevant. 14 | 15 | If the feature is for a crate, please include a proposed API surface. 16 | validations: 17 | required: true 18 | - type: textarea 19 | attributes: 20 | label: Additional context 21 | description: Add any other context to the feature (like screenshots, resources) 22 | -------------------------------------------------------------------------------- /.github/assets/hive/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | 3 | COPY dist/reth /usr/local/bin 4 | 5 | COPY LICENSE-* ./ 6 | 7 | EXPOSE 30303 30303/udp 9001 8545 8546 8 | ENTRYPOINT ["/usr/local/bin/reth"] -------------------------------------------------------------------------------- /.github/assets/hive/load_images.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eo pipefail 3 | 4 | # List of tar files to load 5 | IMAGES=( 6 | "/tmp/hiveproxy.tar" 7 | "/tmp/devp2p.tar" 8 | "/tmp/engine.tar" 9 | "/tmp/rpc_compat.tar" 10 | "/tmp/pyspec.tar" 11 | "/tmp/smoke_genesis.tar" 12 | "/tmp/smoke_network.tar" 13 | "/tmp/ethereum_sync.tar" 14 | "/tmp/reth_image.tar" 15 | ) 16 | 17 | # Loop through the images and load them 18 | for IMAGE_TAR in "${IMAGES[@]}"; do 19 | echo "Loading image $IMAGE_TAR..." 20 | docker load -i "$IMAGE_TAR" & 21 | done 22 | 23 | wait 24 | 25 | docker image ls -a -------------------------------------------------------------------------------- /.github/assets/hive/run_simulator.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # set -x 3 | 4 | cd hivetests/ 5 | 6 | sim="${1}" 7 | limit="${2}" 8 | 9 | run_hive() { 10 | hive --sim "${sim}" --sim.limit "${limit}" --sim.parallelism 4 --client reth 2>&1 | tee /tmp/log || true 11 | } 12 | 13 | check_log() { 14 | tail -n 1 /tmp/log | sed -r 's/\x1B\[[0-9;]*[mK]//g' 15 | } 16 | 17 | attempt=0 18 | max_attempts=5 19 | 20 | while [ $attempt -lt $max_attempts ]; do 21 | run_hive 22 | 23 | # Check if no tests were run. sed removes ansi colors 24 | if check_log | grep -q "suites=0"; then 25 | echo "no tests were run, retrying in 10 seconds" 26 | sleep 10 27 | attempt=$((attempt + 1)) 28 | continue 29 | fi 30 | 31 | # Check the last line of the log for "finished", "tests failed", or "test failed" 32 | if check_log | grep -Eq "(finished|tests? failed)"; then 33 | exit 0 34 | else 35 | exit 1 36 | fi 37 | done 38 | exit 1 39 | -------------------------------------------------------------------------------- /.github/assets/install_geth.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Installs Geth (https://geth.ethereum.org) in $HOME/bin for x86_64 Linux. 4 | 5 | set -eo pipefail 6 | 7 | GETH_BUILD=${GETH_BUILD:-"1.13.4-3f907d6a"} 8 | 9 | name="geth-linux-amd64-$GETH_BUILD" 10 | 11 | mkdir -p "$HOME/bin" 12 | wget "https://gethstore.blob.core.windows.net/builds/$name.tar.gz" 13 | tar -xvf "$name.tar.gz" 14 | rm "$name.tar.gz" 15 | mv "$name/geth" "$HOME/bin/geth" 16 | rm -rf "$name" 17 | chmod +x "$HOME/bin/geth" 18 | 19 | # Add $HOME/bin to $PATH 20 | [[ "$PATH" != *$HOME/bin* ]] && export PATH=$HOME/bin:$PATH 21 | [ -n "$CI" ] && echo "$HOME/bin" >> "$GITHUB_PATH" 22 | 23 | geth version 24 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /.github/workflows/deny.yml: -------------------------------------------------------------------------------- 1 | # Runs `cargo-deny` when modifying `Cargo.lock`. 2 | 3 | name: deny 4 | 5 | on: 6 | push: 7 | branches: [main] 8 | paths: [Cargo.lock] 9 | pull_request: 10 | branches: [main] 11 | paths: [Cargo.lock] 12 | merge_group: 13 | 14 | env: 15 | CARGO_TERM_COLOR: always 16 | 17 | concurrency: deny-${{ github.head_ref || github.run_id }} 18 | 19 | jobs: 20 | deny: 21 | name: deny 22 | runs-on: ubuntu-latest 23 | steps: 24 | - uses: actions/checkout@v4 25 | - uses: EmbarkStudios/cargo-deny-action@v2 26 | with: 27 | command: check all 28 | -------------------------------------------------------------------------------- /.github/workflows/label-pr.yml: -------------------------------------------------------------------------------- 1 | name: Label PRs 2 | 3 | on: 4 | pull_request: 5 | types: [opened] 6 | 7 | jobs: 8 | label_prs: 9 | runs-on: ubuntu-latest 10 | permissions: 11 | issues: write 12 | pull-requests: write 13 | steps: 14 | - uses: actions/checkout@v4 15 | with: 16 | fetch-depth: 0 17 | 18 | - name: Label PRs 19 | uses: actions/github-script@v7 20 | with: 21 | script: | 22 | const label_pr = require('./.github/assets/label_pr.js') 23 | await label_pr({github, context}) 24 | -------------------------------------------------------------------------------- /.github/workflows/lint-actions.yml: -------------------------------------------------------------------------------- 1 | name: Lint GitHub Actions workflows 2 | on: 3 | pull_request: 4 | paths: 5 | - '.github/**' 6 | merge_group: 7 | push: 8 | paths: 9 | - '.github/**' 10 | 11 | jobs: 12 | actionlint: 13 | runs-on: ubuntu-latest 14 | steps: 15 | - uses: actions/checkout@v4 16 | - name: Download actionlint 17 | id: get_actionlint 18 | run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 19 | shell: bash 20 | - name: Check workflow files 21 | run: SHELLCHECK_OPTS="-S error" ${{ steps.get_actionlint.outputs.executable }} -color 22 | shell: bash 23 | -------------------------------------------------------------------------------- /.github/workflows/release-dist.yml: -------------------------------------------------------------------------------- 1 | # This workflow auto-publishes Reth to external package managers such as 2 | # Homebrew when a release is published. 3 | 4 | name: release externally 5 | 6 | on: 7 | release: 8 | types: [published] 9 | 10 | jobs: 11 | release-homebrew: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Update Homebrew formula 15 | uses: dawidd6/action-homebrew-bump-formula@v3 16 | with: 17 | token: ${{ secrets.HOMEBREW }} 18 | no_fork: true 19 | tap: paradigmxyz/brew 20 | formula: reth 21 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | # Marks issues as stale. 2 | 3 | name: stale issues 4 | 5 | on: 6 | workflow_dispatch: {} 7 | schedule: 8 | - cron: "30 1 * * *" 9 | 10 | jobs: 11 | close-issues: 12 | runs-on: ubuntu-latest 13 | permissions: 14 | issues: write 15 | pull-requests: write 16 | steps: 17 | - uses: actions/stale@v9 18 | with: 19 | days-before-stale: 21 20 | days-before-close: 7 21 | stale-issue-label: "S-stale" 22 | stale-pr-label: "S-stale" 23 | exempt-issue-labels: "M-prevent-stale" 24 | exempt-pr-labels: "M-prevent-stale" 25 | stale-issue-message: "This issue is stale because it has been open for 21 days with no activity." 26 | close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale." 27 | exempt-all-milestones: true 28 | exempt-all-assignees: true 29 | repo-token: ${{ secrets.GITHUB_TOKEN }} 30 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | ./debug/ 4 | target/ 5 | 6 | # These are backup files generated by rustfmt 7 | **/*.rs.bk 8 | 9 | # MSVC Windows builds of rustc generate these, which store debugging information 10 | *.pdb 11 | 12 | # Generated by Intellij-based IDEs. 13 | .idea 14 | 15 | # Generated by MacOS 16 | .DS_Store 17 | 18 | # Generated test-vectors for DB 19 | testdata/micro/db 20 | 21 | # Generated data for stage benchmarks 22 | crates/stages/testdata 23 | 24 | # Prometheus data dir 25 | data/ 26 | 27 | # Proptest data 28 | proptest-regressions/ 29 | 30 | # Release artifacts 31 | dist/ 32 | 33 | # Database debugging tools 34 | db-tools/ 35 | 36 | # VSCode 37 | .vscode 38 | 39 | # Coverage report 40 | lcov.info 41 | 42 | # Generated by ./etc/generate-jwt.sh 43 | jwttoken/ 44 | 45 | # Cache directory for CCLS, if using it with MDBX sources 46 | .ccls-cache/ 47 | 48 | # Generated by CMake due to MDBX sources 49 | crates/storage/libmdbx-rs/mdbx-sys/libmdbx/cmake-build-debug 50 | 51 | # Rust bug report 52 | rustc-ice-* -------------------------------------------------------------------------------- /Cross.toml: -------------------------------------------------------------------------------- 1 | [build] 2 | pre-build = [ 3 | # rust-bindgen dependencies: llvm-dev libclang-dev (>= 5.0) clang (>= 5.0) 4 | "apt-get update && apt-get install --assume-yes --no-install-recommends llvm-dev libclang-6.0-dev clang-6.0" 5 | ] 6 | 7 | [build.env] 8 | passthrough = [ 9 | "JEMALLOC_SYS_WITH_LG_PAGE", 10 | ] -------------------------------------------------------------------------------- /Dockerfile.cross: -------------------------------------------------------------------------------- 1 | # This image is meant to enable cross-architecture builds. 2 | # It assumes the reth binary has already been compiled for `$TARGETPLATFORM` and is 3 | # locatable in `./dist/bin/$TARGETARCH` 4 | FROM --platform=$TARGETPLATFORM ubuntu:22.04 5 | 6 | LABEL org.opencontainers.image.source=https://github.com/paradigmxyz/reth 7 | LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0" 8 | 9 | # Filled by docker buildx 10 | ARG TARGETARCH 11 | 12 | COPY ./dist/bin/$TARGETARCH/reth /usr/local/bin/reth 13 | 14 | EXPOSE 30303 30303/udp 9001 8545 8546 15 | ENTRYPOINT ["/usr/local/bin/reth"] 16 | -------------------------------------------------------------------------------- /DockerfileOp.cross: -------------------------------------------------------------------------------- 1 | # This image is meant to enable cross-architecture builds. 2 | # It assumes the reth binary has already been compiled for `$TARGETPLATFORM` and is 3 | # locatable in `./dist/bin/$TARGETARCH` 4 | FROM --platform=$TARGETPLATFORM ubuntu:22.04 5 | 6 | LABEL org.opencontainers.image.source=https://github.com/paradigmxyz/reth 7 | LABEL org.opencontainers.image.licenses="MIT OR Apache-2.0" 8 | 9 | # Filled by docker buildx 10 | ARG TARGETARCH 11 | 12 | COPY ./dist/bin/$TARGETARCH/op-reth /usr/local/bin/op-reth 13 | 14 | EXPOSE 30303 30303/udp 9001 8545 8546 15 | ENTRYPOINT ["/usr/local/bin/op-reth"] 16 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | Contact georgios at paradigm.xyz. 6 | -------------------------------------------------------------------------------- /assets/reth-alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megaeth-labs/reth/29058ad7ee64d993de6c301a9d688002cb698f03/assets/reth-alpha.png -------------------------------------------------------------------------------- /assets/reth-beta.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megaeth-labs/reth/29058ad7ee64d993de6c301a9d688002cb698f03/assets/reth-beta.png -------------------------------------------------------------------------------- /assets/reth-docs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megaeth-labs/reth/29058ad7ee64d993de6c301a9d688002cb698f03/assets/reth-docs.png -------------------------------------------------------------------------------- /assets/reth-prod.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megaeth-labs/reth/29058ad7ee64d993de6c301a9d688002cb698f03/assets/reth-prod.png -------------------------------------------------------------------------------- /assets/reth.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megaeth-labs/reth/29058ad7ee64d993de6c301a9d688002cb698f03/assets/reth.jpg -------------------------------------------------------------------------------- /audit/sigma_prime_audit_v2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megaeth-labs/reth/29058ad7ee64d993de6c301a9d688002cb698f03/audit/sigma_prime_audit_v2.pdf -------------------------------------------------------------------------------- /bin/reth/src/commands/mod.rs: -------------------------------------------------------------------------------- 1 | //! This contains all of the `reth` commands 2 | 3 | pub mod debug_cmd; 4 | -------------------------------------------------------------------------------- /bin/reth/src/macros.rs: -------------------------------------------------------------------------------- 1 | //! Helper macros 2 | 3 | /// Creates the block executor type based on the configured feature. 4 | /// 5 | /// Note(mattsse): This is incredibly horrible and will be replaced 6 | #[cfg(not(feature = "optimism"))] 7 | macro_rules! block_executor { 8 | ($chain_spec:expr) => { 9 | reth_node_ethereum::EthExecutorProvider::ethereum($chain_spec) 10 | }; 11 | } 12 | 13 | #[cfg(feature = "optimism")] 14 | macro_rules! block_executor { 15 | ($chain_spec:expr) => { 16 | reth_node_optimism::OpExecutorProvider::optimism($chain_spec) 17 | }; 18 | } 19 | 20 | pub(crate) use block_executor; 21 | -------------------------------------------------------------------------------- /book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | authors = ["reth Core Contributors"] 3 | language = "en" 4 | multilingual = false 5 | src = "book" 6 | title = "reth Book" 7 | description = "A book on all things Reth" 8 | 9 | [output.html] 10 | theme = "book/theme" 11 | git-repository-url = "https://github.com/paradigmxyz/reth" 12 | default-theme = "ayu" 13 | no-section-label = true 14 | 15 | [output.html.fold] 16 | enable = true 17 | level = 1 18 | 19 | [build] 20 | build-dir = "target/book" 21 | 22 | [preprocessor.template] 23 | before = ["links"] 24 | 25 | [preprocessor.index] 26 | 27 | [preprocessor.links] 28 | -------------------------------------------------------------------------------- /book/cli/cli.md: -------------------------------------------------------------------------------- 1 | # CLI Reference 2 | 3 | The Reth node is operated via the CLI by running the `reth node` command. To stop it, press `ctrl-c`. You may need to wait a bit as Reth tears down existing p2p connections or other cleanup tasks. 4 | 5 | However, Reth has more commands: 6 | 7 | {{#include ./SUMMARY.md}} 8 | -------------------------------------------------------------------------------- /book/cli/update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -eo pipefail 3 | 4 | BOOK_ROOT="$(dirname "$(dirname "$0")")" 5 | RETH=${1:-"$(dirname "$BOOK_ROOT")/target/debug/reth"} 6 | 7 | cmd=( 8 | "$(dirname "$0")/help.py" 9 | --root-dir "$BOOK_ROOT/" 10 | --root-indentation 2 11 | --root-summary 12 | --out-dir "$BOOK_ROOT/cli/" 13 | "$RETH" 14 | ) 15 | echo "Running: $" "${cmd[*]}" 16 | "${cmd[@]}" 17 | -------------------------------------------------------------------------------- /book/developers/contribute.md: -------------------------------------------------------------------------------- 1 | # Contribute 2 | 3 | 4 | 5 | Reth has docs specifically geared for developers and contributors, including documentation on the structure and architecture of reth, the general workflow we employ, and other useful tips. 6 | 7 | You can find these docs [here](https://github.com/paradigmxyz/reth/tree/main/docs). 8 | 9 | Check out our contributing guidelines [here](https://github.com/paradigmxyz/reth/blob/main/CONTRIBUTING.md). 10 | -------------------------------------------------------------------------------- /book/developers/developers.md: -------------------------------------------------------------------------------- 1 | # Developers 2 | 3 | Reth is composed of several crates that can be used in standalone projects. If you are interested in using one or more of the crates, you can get an overview of them in the [developer docs](https://github.com/paradigmxyz/reth/tree/main/docs), or take a look at the [crate docs](https://paradigmxyz.github.io/reth/docs). 4 | -------------------------------------------------------------------------------- /book/developers/exex/assets/remote_exex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megaeth-labs/reth/29058ad7ee64d993de6c301a9d688002cb698f03/book/developers/exex/assets/remote_exex.png -------------------------------------------------------------------------------- /book/installation/priorities.md: -------------------------------------------------------------------------------- 1 | # Update Priorities 2 | 3 | When publishing releases, reth will include an "Update Priority" section in the release notes, in the same manner Lighthouse does. 4 | 5 | The "Update Priority" section will include a table which may appear like so: 6 | 7 | | User Class | Priority | 8 | |----------------------|-----------------| 9 | | Payload Builders | Medium Priority | 10 | | Non-Payload Builders | Low Priority | 11 | 12 | To understand this table, the following terms are important: 13 | 14 | - *Payload builders* are those who use reth to build and validate payloads. 15 | - *Non-payload builders* are those who run reth for other purposes (e.g., data analysis, RPC or applications). 16 | - *High priority* updates should be completed as soon as possible (e.g., hours or days). 17 | - *Medium priority* updates should be completed at the next convenience (e.g., days or a week). 18 | - *Low priority* updates should be completed in the next routine update cycle (e.g., two weeks). 19 | -------------------------------------------------------------------------------- /book/jsonrpc/eth.md: -------------------------------------------------------------------------------- 1 | # `eth` Namespace 2 | 3 | Documentation for the API methods in the `eth` namespace can be found on [ethereum.org](https://ethereum.org/en/developers/docs/apis/json-rpc/). 4 | -------------------------------------------------------------------------------- /book/jsonrpc/web3.md: -------------------------------------------------------------------------------- 1 | # `web3` Namespace 2 | 3 | The `web3` API provides utility functions for the web3 client. 4 | 5 | ## `web3_clientVersion` 6 | 7 | Get the web3 client version. 8 | 9 | 10 | | Client | Method invocation | 11 | |--------|------------------------------------| 12 | | RPC | `{"method": "web3_clientVersion"}` | 13 | 14 | ### Example 15 | 16 | ```js 17 | // > {"jsonrpc":"2.0","id":1,"method":"web3_clientVersion","params":[]} 18 | {"jsonrpc":"2.0","id":1,"result":"reth/v0.0.1/x86_64-unknown-linux-gnu"} 19 | ``` 20 | 21 | ## `web3_sha3` 22 | 23 | Get the Keccak-256 hash of the given data. 24 | 25 | | Client | Method invocation | 26 | |--------|----------------------------------------------| 27 | | RPC | `{"method": "web3_sha3", "params": [bytes]}` | 28 | 29 | ### Example 30 | 31 | ```js 32 | // > {"jsonrpc":"2.0","id":1,"method":"web3_sha3","params":["rust is awesome"]} 33 | {"jsonrpc":"2.0","id":1,"result":"0xe421b3428564a5c509ac118bad93a3b84485ec3f927e214b0c4c23076d4bc4e0"} 34 | ``` -------------------------------------------------------------------------------- /book/run/run-a-node.md: -------------------------------------------------------------------------------- 1 | # Run a Node 2 | 3 | Congratulations, now that you have installed Reth, it's time to run it! 4 | 5 | In this chapter we'll go through a few different topics you'll encounter when running Reth, including: 6 | 1. [Running on mainnet or official testnets](./mainnet.md) 7 | 1. [Running on OP Stack chains](./optimism.md) 8 | 1. [Logs and Observability](./observability.md) 9 | 1. [Configuring reth.toml](./config.md) 10 | 1. [Transaction types](./transactions.md) 11 | 1. [Pruning & Full Node](./pruning.md) 12 | 1. [Ports](./ports.md) 13 | 1. [Troubleshooting](./troubleshooting.md) 14 | 15 | In the future, we also intend to support the [OP Stack](https://stack.optimism.io/docs/understand/explainer/), which will allow you to run Reth as a Layer 2 client. More there soon! 16 | -------------------------------------------------------------------------------- /book/templates/source_and_github.md: -------------------------------------------------------------------------------- 1 | [File: [[ #path ]]](https://github.com/paradigmxyz/reth/blob/main/[[ #path ]]) 2 | ```rust,no_run,noplayground 3 | {{#include [[ #path_to_root ]][[ #path ]]:[[ #anchor ]]}} 4 | ``` -------------------------------------------------------------------------------- /book/theme/head.hbs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /clippy.toml: -------------------------------------------------------------------------------- 1 | msrv = "1.80" 2 | too-large-for-stack = 128 3 | -------------------------------------------------------------------------------- /crates/blockchain-tree-api/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-blockchain-tree-api" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | reth-consensus.workspace = true 15 | reth-execution-errors.workspace = true 16 | reth-primitives.workspace = true 17 | reth-storage-errors.workspace = true 18 | 19 | # misc 20 | thiserror.workspace = true 21 | -------------------------------------------------------------------------------- /crates/blockchain-tree/docs/mermaid/tree.mmd: -------------------------------------------------------------------------------- 1 | flowchart BT 2 | subgraph canonical chain 3 | CanonState:::state 4 | block0canon:::canon -->block1canon:::canon -->block2canon:::canon -->block3canon:::canon --> 5 | block4canon:::canon --> block5canon:::canon 6 | end 7 | block5canon --> block6pending1:::pending 8 | block5canon --> block6pending2:::pending 9 | subgraph sidechain2 10 | S2State:::state 11 | block3canon --> block4s2:::sidechain --> block5s2:::sidechain 12 | end 13 | subgraph sidechain1 14 | S1State:::state 15 | block2canon --> block3s1:::sidechain --> block4s1:::sidechain --> block5s1:::sidechain --> 16 | block6s1:::sidechain 17 | end 18 | classDef state fill:#1882C4 19 | classDef canon fill:#8AC926 20 | classDef pending fill:#FFCA3A 21 | classDef sidechain fill:#FF595E 22 | -------------------------------------------------------------------------------- /crates/chain-state/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Reth state related types and functionality. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | mod in_memory; 12 | pub use in_memory::*; 13 | 14 | mod chain_info; 15 | pub use chain_info::ChainInfoTracker; 16 | 17 | mod notifications; 18 | pub use notifications::{ 19 | CanonStateNotification, CanonStateNotificationSender, CanonStateNotificationStream, 20 | CanonStateNotifications, CanonStateSubscriptions, ForkChoiceNotifications, ForkChoiceStream, 21 | ForkChoiceSubscriptions, 22 | }; 23 | 24 | mod memory_overlay; 25 | pub use memory_overlay::MemoryOverlayStateProvider; 26 | 27 | #[cfg(any(test, feature = "test-utils"))] 28 | /// Common test helpers 29 | pub mod test_utils; 30 | -------------------------------------------------------------------------------- /crates/chainspec/res/genesis/optimism.json: -------------------------------------------------------------------------------- 1 | {"config":{"ChainName":"optimism-mainnet","chainId":10,"homesteadBlock":0,"eip150Block":0,"eip155Block":0,"eip158Block":0,"byzantiumBlock":0,"constantinopleBlock":0,"petersburgBlock":0,"istanbulBlock":0,"muirGlacierBlock":0,"berlinBlock":3950000,"londonBlock":105235063,"arrowGlacierBlock":105235063,"grayGlacierBlock":105235063,"mergeNetsplitBlock":105235063,"bedrockBlock":105235063,"terminalTotalDifficulty":0,"terminalTotalDifficultyPassed":true,"optimism":{"eip1559Elasticity":6,"eip1559Denominator":50},"regolithTime":0},"difficulty":"1","gasLimit":"15000000","extradata":"0x000000000000000000000000000000000000000000000000000000000000000000000398232e2064f896018496b4b44b3d62751f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","stateRoot":"0xeddb4c1786789419153a27c4c80ff44a2226b6eda04f7e22ce5bae892ea568eb","alloc":{}} -------------------------------------------------------------------------------- /crates/chainspec/src/api.rs: -------------------------------------------------------------------------------- 1 | use crate::ChainSpec; 2 | use alloy_chains::Chain; 3 | 4 | /// Trait representing type configuring a chain spec. 5 | pub trait EthChainSpec: Send + Sync + Unpin + 'static { 6 | // todo: make chain spec type generic over hardfork 7 | //type Hardfork: Clone + Copy + 'static; 8 | 9 | /// Chain id. 10 | fn chain(&self) -> Chain; 11 | } 12 | 13 | impl EthChainSpec for ChainSpec { 14 | fn chain(&self) -> Chain { 15 | self.chain 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /crates/chainspec/src/constants.rs: -------------------------------------------------------------------------------- 1 | use crate::spec::DepositContract; 2 | use alloy_primitives::{address, b256}; 3 | 4 | /// Deposit contract address: `0x00000000219ab540356cbb839cbe05303d7705fa` 5 | pub(crate) const MAINNET_DEPOSIT_CONTRACT: DepositContract = DepositContract::new( 6 | address!("00000000219ab540356cbb839cbe05303d7705fa"), 7 | 11052984, 8 | b256!("649bbc62d0e31342afea4e5cd82d4049e7e1ee912fc0889aa790803be39038c5"), 9 | ); 10 | 11 | /// Max gas limit on Base Sepolia: 12 | #[cfg(feature = "optimism")] 13 | pub(crate) const BASE_SEPOLIA_MAX_GAS_LIMIT: u64 = 45_000_000; 14 | 15 | /// Max gas limit on Base: 16 | #[cfg(feature = "optimism")] 17 | pub(crate) const BASE_MAINNET_MAX_GAS_LIMIT: u64 = 105_000_000; 18 | -------------------------------------------------------------------------------- /crates/chainspec/src/info.rs: -------------------------------------------------------------------------------- 1 | use alloy_eips::BlockNumHash; 2 | use alloy_primitives::{BlockNumber, B256}; 3 | 4 | /// Current status of the blockchain's head. 5 | #[derive(Default, Copy, Clone, Debug, Eq, PartialEq)] 6 | pub struct ChainInfo { 7 | /// The block hash of the highest fully synced block. 8 | pub best_hash: B256, 9 | /// The block number of the highest fully synced block. 10 | pub best_number: BlockNumber, 11 | } 12 | 13 | impl From for BlockNumHash { 14 | fn from(value: ChainInfo) -> Self { 15 | Self { number: value.best_number, hash: value.best_hash } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /crates/cli/cli/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-cli" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | 14 | [dependencies] 15 | # reth 16 | reth-cli-runner.workspace = true 17 | reth-chainspec.workspace = true 18 | 19 | # misc 20 | clap.workspace = true 21 | eyre.workspace = true 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /crates/cli/cli/src/chainspec.rs: -------------------------------------------------------------------------------- 1 | use clap::builder::TypedValueParser; 2 | use reth_chainspec::ChainSpec; 3 | use std::sync::Arc; 4 | 5 | /// Trait for parsing chain specifications. 6 | /// 7 | /// This trait extends [`clap::builder::TypedValueParser`] to provide a parser for chain 8 | /// specifications. Implementers of this trait must provide a list of supported chains and a 9 | /// function to parse a given string into a [`ChainSpec`]. 10 | pub trait ChainSpecParser: TypedValueParser> + Default { 11 | /// List of supported chains. 12 | const SUPPORTED_CHAINS: &'static [&'static str]; 13 | 14 | /// Parses the given string into a [`ChainSpec`]. 15 | /// 16 | /// # Arguments 17 | /// 18 | /// * `s` - A string slice that holds the chain spec to be parsed. 19 | /// 20 | /// # Errors 21 | /// 22 | /// This function will return an error if the input string cannot be parsed into a valid 23 | /// [`ChainSpec`]. 24 | fn parse(s: &str) -> eyre::Result>; 25 | } 26 | -------------------------------------------------------------------------------- /crates/cli/commands/src/init_cmd.rs: -------------------------------------------------------------------------------- 1 | //! Command that initializes the node from a genesis file. 2 | 3 | use crate::common::{AccessRights, Environment, EnvironmentArgs}; 4 | use clap::Parser; 5 | use reth_provider::BlockHashReader; 6 | use tracing::info; 7 | 8 | /// Initializes the database with the genesis block. 9 | #[derive(Debug, Parser)] 10 | pub struct InitCommand { 11 | #[command(flatten)] 12 | env: EnvironmentArgs, 13 | } 14 | 15 | impl InitCommand { 16 | /// Execute the `init` command 17 | pub async fn execute(self) -> eyre::Result<()> { 18 | info!(target: "reth::cli", "reth init starting"); 19 | 20 | let Environment { provider_factory, .. } = self.env.init(AccessRights::RW)?; 21 | 22 | let hash = provider_factory 23 | .block_hash(0)? 24 | .ok_or_else(|| eyre::eyre!("Genesis hash not found."))?; 25 | 26 | info!(target: "reth::cli", hash = ?hash, "Genesis block written"); 27 | Ok(()) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /crates/cli/commands/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Commonly used reth CLI commands. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | pub mod common; 12 | pub mod config_cmd; 13 | pub mod db; 14 | pub mod dump_genesis; 15 | pub mod import; 16 | pub mod init_cmd; 17 | pub mod init_state; 18 | pub mod node; 19 | pub mod p2p; 20 | pub mod prune; 21 | pub mod recover; 22 | pub mod stage; 23 | #[cfg(feature = "dev")] 24 | pub mod test_vectors; 25 | -------------------------------------------------------------------------------- /crates/cli/commands/src/recover/mod.rs: -------------------------------------------------------------------------------- 1 | //! `reth recover` command. 2 | 3 | use clap::{Parser, Subcommand}; 4 | use reth_cli_runner::CliContext; 5 | 6 | mod storage_tries; 7 | 8 | /// `reth recover` command 9 | #[derive(Debug, Parser)] 10 | pub struct Command { 11 | #[command(subcommand)] 12 | command: Subcommands, 13 | } 14 | 15 | /// `reth recover` subcommands 16 | #[derive(Subcommand, Debug)] 17 | pub enum Subcommands { 18 | /// Recover the node by deleting dangling storage tries. 19 | StorageTries(storage_tries::Command), 20 | } 21 | 22 | impl Command { 23 | /// Execute `recover` command 24 | pub async fn execute(self, ctx: CliContext) -> eyre::Result<()> { 25 | match self.command { 26 | Subcommands::StorageTries(command) => command.execute(ctx).await, 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /crates/cli/commands/src/test_vectors/mod.rs: -------------------------------------------------------------------------------- 1 | //! Command for generating test vectors. 2 | 3 | use clap::{Parser, Subcommand}; 4 | 5 | mod tables; 6 | 7 | /// Generate test-vectors for different data types. 8 | #[derive(Debug, Parser)] 9 | pub struct Command { 10 | #[command(subcommand)] 11 | command: Subcommands, 12 | } 13 | 14 | #[derive(Subcommand, Debug)] 15 | /// `reth test-vectors` subcommands 16 | pub enum Subcommands { 17 | /// Generates test vectors for specified tables. If no table is specified, generate for all. 18 | Tables { 19 | /// List of table names. Case-sensitive. 20 | names: Vec, 21 | }, 22 | } 23 | 24 | impl Command { 25 | /// Execute the command 26 | pub async fn execute(self) -> eyre::Result<()> { 27 | match self.command { 28 | Subcommands::Tables { names } => { 29 | tables::generate_vectors(names)?; 30 | } 31 | } 32 | Ok(()) 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /crates/cli/runner/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-cli-runner" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-tasks.workspace = true 16 | 17 | # async 18 | tokio = { workspace = true, features = ["macros", "rt-multi-thread", "signal"] } 19 | 20 | # misc 21 | tracing.workspace = true 22 | -------------------------------------------------------------------------------- /crates/cli/util/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-cli-util" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-fs-util.workspace = true 16 | 17 | # eth 18 | alloy-primitives.workspace = true 19 | alloy-eips.workspace = true 20 | 21 | secp256k1 = { workspace = true, features = ["rand"] } 22 | rand.workspace = true 23 | 24 | # misc 25 | thiserror.workspace = true 26 | eyre.workspace = true 27 | 28 | [target.'cfg(unix)'.dependencies] 29 | libc = "0.2" 30 | -------------------------------------------------------------------------------- /crates/config/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-config" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-network-types = { workspace = true, features = ["serde"] } 16 | reth-prune-types.workspace = true 17 | reth-stages-types.workspace = true 18 | 19 | # serde 20 | serde.workspace = true 21 | humantime-serde.workspace = true 22 | 23 | # toml 24 | toml.workspace = true 25 | eyre.workspace = true 26 | 27 | [dev-dependencies] 28 | tempfile.workspace = true 29 | reth-network-peers.workspace = true 30 | -------------------------------------------------------------------------------- /crates/config/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Standalone crate for Reth configuration types. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | pub mod config; 12 | pub use config::{BodiesConfig, Config, PruneConfig}; 13 | -------------------------------------------------------------------------------- /crates/consensus/beacon/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Beacon consensus implementation. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | pub use reth_ethereum_consensus::EthBeaconConsensus; 12 | 13 | mod engine; 14 | pub use engine::*; 15 | -------------------------------------------------------------------------------- /crates/consensus/common/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-consensus-common" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-chainspec.workspace = true 16 | reth-primitives.workspace = true 17 | reth-consensus.workspace = true 18 | 19 | [dev-dependencies] 20 | reth-storage-api.workspace = true 21 | rand.workspace = true 22 | mockall = "0.12" 23 | -------------------------------------------------------------------------------- /crates/consensus/common/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Commonly used consensus methods. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | /// Collection of consensus validation methods. 12 | pub mod validation; 13 | 14 | /// Various calculation methods (e.g. block rewards) 15 | pub mod calc; 16 | -------------------------------------------------------------------------------- /crates/consensus/consensus/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-consensus" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-primitives.workspace = true 16 | 17 | # misc 18 | auto_impl.workspace = true 19 | derive_more.workspace = true 20 | 21 | [features] 22 | default = ["std"] 23 | std = [] 24 | test-utils = [] 25 | -------------------------------------------------------------------------------- /crates/consensus/debug-client/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-consensus-debug-client" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-node-api.workspace = true 16 | reth-node-core.workspace = true 17 | reth-rpc-api.workspace = true 18 | reth-rpc-types.workspace = true 19 | reth-rpc-builder.workspace = true 20 | reth-tracing.workspace = true 21 | 22 | # ethereum 23 | alloy-consensus = { workspace = true, features = ["serde"] } 24 | alloy-eips.workspace = true 25 | alloy-provider = { workspace = true, features = ["ws"] } 26 | 27 | auto_impl.workspace = true 28 | futures.workspace = true 29 | eyre.workspace = true 30 | reqwest = { workspace = true, features = ["rustls-tls", "json"] } 31 | serde = { workspace = true, features = ["derive"] } 32 | tokio = { workspace = true, features = ["time"] } 33 | 34 | ringbuffer = "0.15.0" 35 | -------------------------------------------------------------------------------- /crates/consensus/debug-client/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Debug consensus client. 2 | //! 3 | //! This is a worker that sends FCUs and new payloads by fetching recent blocks from an external 4 | //! provider like Etherscan or an RPC endpoint. This allows to quickly test the execution client 5 | //! without running a consensus node. 6 | 7 | #![doc( 8 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 9 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 10 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 11 | )] 12 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 13 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 14 | 15 | mod client; 16 | mod providers; 17 | 18 | pub use client::{rich_block_to_execution_payload_v3, BlockProvider, DebugConsensusClient}; 19 | pub use providers::{EtherscanBlockProvider, RpcBlockProvider}; 20 | -------------------------------------------------------------------------------- /crates/consensus/debug-client/src/providers/mod.rs: -------------------------------------------------------------------------------- 1 | mod etherscan; 2 | mod rpc; 3 | 4 | pub use etherscan::EtherscanBlockProvider; 5 | pub use rpc::RpcBlockProvider; 6 | -------------------------------------------------------------------------------- /crates/e2e-test-utils/src/traits.rs: -------------------------------------------------------------------------------- 1 | use reth::rpc::types::{ 2 | engine::{ExecutionPayloadEnvelopeV3, OptimismExecutionPayloadEnvelopeV3}, 3 | ExecutionPayloadV3, 4 | }; 5 | 6 | /// The execution payload envelope type. 7 | pub trait PayloadEnvelopeExt: Send + Sync + std::fmt::Debug { 8 | /// Returns the execution payload V3 from the payload 9 | fn execution_payload(&self) -> ExecutionPayloadV3; 10 | } 11 | 12 | impl PayloadEnvelopeExt for OptimismExecutionPayloadEnvelopeV3 { 13 | fn execution_payload(&self) -> ExecutionPayloadV3 { 14 | self.execution_payload.clone() 15 | } 16 | } 17 | 18 | impl PayloadEnvelopeExt for ExecutionPayloadEnvelopeV3 { 19 | fn execution_payload(&self) -> ExecutionPayloadV3 { 20 | self.execution_payload.clone() 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /crates/engine/primitives/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-engine-primitives" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-chainspec.workspace = true 16 | reth-payload-primitives.workspace = true 17 | 18 | # misc 19 | serde.workspace = true -------------------------------------------------------------------------------- /crates/engine/service/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Engine service implementation. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 9 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 10 | 11 | /// Engine Service 12 | pub mod service; 13 | -------------------------------------------------------------------------------- /crates/engine/tree/src/metrics.rs: -------------------------------------------------------------------------------- 1 | use reth_metrics::{ 2 | metrics::{Gauge, Histogram}, 3 | Metrics, 4 | }; 5 | 6 | /// Metrics for the `BasicBlockDownloader`. 7 | #[derive(Metrics)] 8 | #[metrics(scope = "consensus.engine.beacon")] 9 | pub(crate) struct BlockDownloaderMetrics { 10 | /// How many blocks are currently being downloaded. 11 | pub(crate) active_block_downloads: Gauge, 12 | } 13 | 14 | /// Metrics for the `PersistenceService` 15 | #[derive(Metrics)] 16 | #[metrics(scope = "consensus.engine.persistence")] 17 | pub(crate) struct PersistenceMetrics { 18 | /// How long it took for blocks to be removed 19 | pub(crate) remove_blocks_above_duration_seconds: Histogram, 20 | /// How long it took for blocks to be saved 21 | pub(crate) save_blocks_duration_seconds: Histogram, 22 | /// How long it took for blocks to be pruned 23 | pub(crate) prune_before_duration_seconds: Histogram, 24 | } 25 | -------------------------------------------------------------------------------- /crates/engine/tree/src/tree/metrics.rs: -------------------------------------------------------------------------------- 1 | use reth_metrics::{ 2 | metrics::{Counter, Gauge, Histogram}, 3 | Metrics, 4 | }; 5 | 6 | /// Metrics for the `EngineApi`. 7 | #[derive(Metrics)] 8 | #[metrics(scope = "consensus.engine.beacon")] 9 | pub(crate) struct EngineApiMetrics { 10 | /// How many executed blocks are currently stored. 11 | pub(crate) executed_blocks: Gauge, 12 | /// The number of times the pipeline was run. 13 | pub(crate) pipeline_runs: Counter, 14 | /// The total count of forkchoice updated messages received. 15 | pub(crate) forkchoice_updated_messages: Counter, 16 | /// The total count of new payload messages received. 17 | pub(crate) new_payload_messages: Counter, 18 | /// Histogram of persistence operation durations (in seconds) 19 | pub(crate) persistence_duration: Histogram, 20 | // TODO add latency metrics 21 | } 22 | -------------------------------------------------------------------------------- /crates/engine/tree/test-data/holesky/1.rlp: -------------------------------------------------------------------------------- 1 | f90218f90213a0b5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde4a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a069d8c9d72f6fa4ad42d4702b433707212f90db395eb54dc20bc85de253788783a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800184017dd79d808465156ad899d883010d02846765746888676f312e32312e31856c696e7578a0b5f7f912443c940f21fd611f12828d75b534364ed9e95ca4e307729a4661bde488000000000000000084342770c0c0c0 -------------------------------------------------------------------------------- /crates/engine/tree/test-data/holesky/2.rlp: -------------------------------------------------------------------------------- 1 | f90218f90213a0e9011e6d15a0d0c16f65a38f84375bf1a6b88201b0ad75a2660df0bb8d1ac381a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d4934794c6e2459991bfe27cca6d86722f35da23a1e4cb97a069d8c9d72f6fa4ad42d4702b433707212f90db395eb54dc20bc85de253788783a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800284017e3711808465156af099d883010d02846765746888676f312e32312e31856c696e7578a0b212724aac0df10d75b1b6d795fd4cd17e4ca4f9ee1bfe97871a16a3af64eed1880000000000000000842da282a8c0c0 -------------------------------------------------------------------------------- /crates/errors/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-errors" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | reth-blockchain-tree-api.workspace = true 15 | reth-consensus.workspace = true 16 | reth-execution-errors.workspace = true 17 | reth-fs-util.workspace = true 18 | reth-storage-errors.workspace = true 19 | 20 | # misc 21 | thiserror.workspace = true 22 | -------------------------------------------------------------------------------- /crates/errors/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! High level error types for the reth in general. 2 | //! 3 | //! ## Feature Flags 4 | //! 5 | //! - `test-utils`: Export utilities for testing 6 | 7 | #![doc( 8 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 9 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 10 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 11 | )] 12 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 13 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 14 | 15 | mod error; 16 | pub use error::{RethError, RethResult}; 17 | 18 | pub use reth_blockchain_tree_api::error::{BlockchainTreeError, CanonicalError}; 19 | pub use reth_consensus::ConsensusError; 20 | pub use reth_execution_errors::{BlockExecutionError, BlockValidationError}; 21 | pub use reth_storage_errors::{ 22 | db::DatabaseError, 23 | provider::{ProviderError, ProviderResult}, 24 | }; 25 | -------------------------------------------------------------------------------- /crates/ethereum-forks/src/hardforks/optimism.rs: -------------------------------------------------------------------------------- 1 | use crate::{ChainHardforks, EthereumHardforks, OptimismHardfork}; 2 | 3 | /// Extends [`crate::EthereumHardforks`] with optimism helper methods. 4 | pub trait OptimismHardforks: EthereumHardforks { 5 | /// Convenience method to check if [`OptimismHardfork::Bedrock`] is active at a given block 6 | /// number. 7 | fn is_bedrock_active_at_block(&self, block_number: u64) -> bool { 8 | self.fork(OptimismHardfork::Bedrock).active_at_block(block_number) 9 | } 10 | } 11 | 12 | impl OptimismHardforks for ChainHardforks {} 13 | -------------------------------------------------------------------------------- /crates/ethereum/cli/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-ethereum-cli" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | reth-cli.workspace = true 15 | reth-chainspec.workspace = true 16 | 17 | alloy-genesis.workspace = true 18 | 19 | eyre.workspace = true 20 | 21 | shellexpand.workspace = true 22 | serde_json.workspace = true 23 | clap = { workspace = true, features = ["derive", "env"] } -------------------------------------------------------------------------------- /crates/ethereum/cli/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Reth CLI implementation. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | /// Chain specification parser. 12 | pub mod chainspec; 13 | -------------------------------------------------------------------------------- /crates/ethereum/consensus/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-ethereum-consensus" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-chainspec.workspace = true 16 | reth-consensus-common.workspace = true 17 | reth-primitives.workspace = true 18 | reth-consensus.workspace = true 19 | 20 | tracing.workspace = true 21 | -------------------------------------------------------------------------------- /crates/ethereum/engine-primitives/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-ethereum-engine-primitives" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-chainspec.workspace = true 16 | reth-evm-ethereum.workspace = true 17 | reth-primitives.workspace = true 18 | reth-engine-primitives.workspace = true 19 | reth-payload-primitives.workspace = true 20 | reth-rpc-types.workspace = true 21 | reth-rpc-types-compat.workspace = true 22 | revm-primitives.workspace = true 23 | alloy-rlp.workspace = true 24 | 25 | # misc 26 | serde.workspace = true 27 | sha2.workspace = true 28 | 29 | [dev-dependencies] 30 | serde_json.workspace = true 31 | -------------------------------------------------------------------------------- /crates/ethereum/node/src/evm.rs: -------------------------------------------------------------------------------- 1 | //! Ethereum EVM support 2 | 3 | #[doc(inline)] 4 | pub use reth_evm_ethereum::execute::EthExecutorProvider; 5 | #[doc(inline)] 6 | pub use reth_evm_ethereum::EthEvmConfig; 7 | -------------------------------------------------------------------------------- /crates/ethereum/node/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Standalone crate for ethereum-specific Reth configuration and builder types. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | pub use reth_ethereum_engine_primitives::EthEngineTypes; 12 | 13 | pub mod evm; 14 | pub use evm::{EthEvmConfig, EthExecutorProvider}; 15 | 16 | pub mod node; 17 | pub use node::EthereumNode; 18 | -------------------------------------------------------------------------------- /crates/ethereum/node/tests/e2e/main.rs: -------------------------------------------------------------------------------- 1 | mod blobs; 2 | mod dev; 3 | mod eth; 4 | mod p2p; 5 | mod utils; 6 | 7 | const fn main() {} 8 | -------------------------------------------------------------------------------- /crates/ethereum/node/tests/e2e/utils.rs: -------------------------------------------------------------------------------- 1 | use alloy_primitives::{Address, B256}; 2 | use reth::rpc::types::engine::PayloadAttributes; 3 | use reth_e2e_test_utils::NodeHelperType; 4 | use reth_node_ethereum::{node::EthereumAddOns, EthereumNode}; 5 | use reth_payload_builder::EthPayloadBuilderAttributes; 6 | 7 | /// Ethereum Node Helper type 8 | pub(crate) type EthNode = NodeHelperType; 9 | 10 | /// Helper function to create a new eth payload attributes 11 | pub(crate) fn eth_payload_attributes(timestamp: u64) -> EthPayloadBuilderAttributes { 12 | let attributes = PayloadAttributes { 13 | timestamp, 14 | prev_randao: B256::ZERO, 15 | suggested_fee_recipient: Address::ZERO, 16 | withdrawals: Some(vec![]), 17 | parent_beacon_block_root: Some(B256::ZERO), 18 | }; 19 | EthPayloadBuilderAttributes::new(B256::ZERO, attributes) 20 | } 21 | -------------------------------------------------------------------------------- /crates/ethereum/node/tests/it/main.rs: -------------------------------------------------------------------------------- 1 | mod builder; 2 | mod exex; 3 | 4 | const fn main() {} 5 | -------------------------------------------------------------------------------- /crates/ethereum/payload/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-ethereum-payload-builder" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "A basic ethereum payload builder for reth that uses the txpool API to build payloads." 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-primitives.workspace = true 17 | reth-revm.workspace = true 18 | reth-transaction-pool.workspace = true 19 | reth-provider.workspace = true 20 | reth-payload-builder.workspace = true 21 | reth-execution-types.workspace = true 22 | reth-basic-payload-builder.workspace = true 23 | reth-evm.workspace = true 24 | reth-evm-ethereum.workspace = true 25 | reth-errors.workspace = true 26 | 27 | # ethereum 28 | revm.workspace = true 29 | 30 | # misc 31 | tracing.workspace = true 32 | -------------------------------------------------------------------------------- /crates/etl/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-etl" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | tempfile.workspace = true 15 | reth-db-api.workspace = true 16 | rayon.workspace = true 17 | 18 | [dev-dependencies] 19 | alloy-primitives.workspace = true 20 | -------------------------------------------------------------------------------- /crates/evm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-evm" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-chainspec.workspace = true 16 | reth-execution-errors.workspace = true 17 | reth-primitives.workspace = true 18 | revm-primitives.workspace = true 19 | reth-prune-types.workspace = true 20 | reth-storage-errors.workspace = true 21 | reth-execution-types.workspace = true 22 | 23 | revm.workspace = true 24 | alloy-eips.workspace = true 25 | auto_impl.workspace = true 26 | futures-util.workspace = true 27 | parking_lot = { workspace = true, optional = true } 28 | 29 | [dev-dependencies] 30 | parking_lot.workspace = true 31 | 32 | [features] 33 | default = ["std"] 34 | std = [] 35 | test-utils = ["dep:parking_lot"] 36 | -------------------------------------------------------------------------------- /crates/evm/execution-errors/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-execution-errors" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-consensus.workspace = true 16 | reth-storage-errors.workspace = true 17 | reth-prune-types.workspace = true 18 | 19 | alloy-primitives.workspace = true 20 | alloy-rlp.workspace = true 21 | alloy-eips.workspace = true 22 | revm-primitives.workspace = true 23 | nybbles.workspace = true 24 | 25 | derive_more.workspace = true 26 | 27 | [features] 28 | default = ["std"] 29 | std = ["reth-consensus/std"] 30 | -------------------------------------------------------------------------------- /crates/evm/execution-types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-execution-types" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | reth-primitives.workspace = true 15 | reth-chainspec = { workspace = true, optional = true } 16 | reth-execution-errors.workspace = true 17 | reth-trie.workspace = true 18 | 19 | revm.workspace = true 20 | 21 | serde = { workspace = true, optional = true } 22 | 23 | [dev-dependencies] 24 | reth-primitives = { workspace = true, features = ["test-utils"] } 25 | alloy-primitives.workspace = true 26 | alloy-eips.workspace = true 27 | 28 | [features] 29 | default = ["std"] 30 | optimism = ["dep:reth-chainspec"] 31 | serde = ["dep:serde", "reth-trie/serde", "revm/serde"] 32 | std = [] 33 | -------------------------------------------------------------------------------- /crates/evm/execution-types/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Commonly used types for (EVM) block execution. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | #[cfg(not(feature = "std"))] 12 | extern crate alloc; 13 | 14 | mod chain; 15 | pub use chain::*; 16 | 17 | mod execute; 18 | pub use execute::*; 19 | 20 | mod execution_outcome; 21 | pub use execution_outcome::*; 22 | -------------------------------------------------------------------------------- /crates/exex/exex/src/backfill/mod.rs: -------------------------------------------------------------------------------- 1 | mod factory; 2 | mod job; 3 | mod stream; 4 | #[cfg(test)] 5 | mod test_utils; 6 | 7 | pub use factory::BackfillJobFactory; 8 | pub use job::{BackfillJob, SingleBlockBackfillJob}; 9 | pub use stream::StreamBackfillJob; 10 | -------------------------------------------------------------------------------- /crates/exex/exex/src/event.rs: -------------------------------------------------------------------------------- 1 | use reth_primitives::BlockNumber; 2 | 3 | /// Events emitted by an `ExEx`. 4 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] 5 | pub enum ExExEvent { 6 | /// Highest block processed by the `ExEx`. 7 | /// 8 | /// The `ExEx` must guarantee that it will not require all earlier blocks in the future, 9 | /// meaning that Reth is allowed to prune them. 10 | /// 11 | /// On reorgs, it's possible for the height to go down. 12 | FinishedHeight(BlockNumber), 13 | } 14 | -------------------------------------------------------------------------------- /crates/exex/types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-exex-types" 3 | version.workspace = true 4 | edition.workspace = true 5 | homepage.workspace = true 6 | license.workspace = true 7 | repository.workspace = true 8 | rust-version.workspace = true 9 | description = "Commonly used types for exex usage in reth." 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-provider.workspace = true 17 | 18 | # reth 19 | alloy-primitives.workspace = true 20 | 21 | # misc 22 | serde = { workspace = true, optional = true } 23 | 24 | [features] 25 | default = [] 26 | serde = ["dep:serde", "reth-provider/serde"] 27 | -------------------------------------------------------------------------------- /crates/exex/types/src/finished_height.rs: -------------------------------------------------------------------------------- 1 | use alloy_primitives::BlockNumber; 2 | 3 | /// The finished height of all `ExEx`'s. 4 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] 5 | pub enum FinishedExExHeight { 6 | /// No `ExEx`'s are installed, so there is no finished height. 7 | NoExExs, 8 | /// Not all `ExExs` have emitted a `FinishedHeight` event yet. 9 | NotReady, 10 | /// The finished height of all `ExEx`'s. 11 | /// 12 | /// This is the lowest common denominator between all `ExEx`'s. 13 | /// 14 | /// This block is used to (amongst other things) determine what blocks are safe to prune. 15 | /// 16 | /// The number is inclusive, i.e. all blocks `<= finished_height` are safe to prune. 17 | Height(BlockNumber), 18 | } 19 | 20 | impl FinishedExExHeight { 21 | /// Returns `true` if not all `ExExs` have emitted a `FinishedHeight` event yet. 22 | pub const fn is_not_ready(&self) -> bool { 23 | matches!(self, Self::NotReady) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /crates/exex/types/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Commonly used types for exex usage. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | mod finished_height; 12 | mod notification; 13 | 14 | pub use finished_height::FinishedExExHeight; 15 | pub use notification::ExExNotification; 16 | -------------------------------------------------------------------------------- /crates/fs-util/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-fs-util" 3 | version.workspace = true 4 | edition.workspace = true 5 | homepage.workspace = true 6 | license.workspace = true 7 | repository.workspace = true 8 | rust-version.workspace = true 9 | description = "Commonly used fs utils in reth." 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | 16 | # misc 17 | serde_json.workspace = true 18 | serde.workspace = true 19 | thiserror.workspace = true 20 | -------------------------------------------------------------------------------- /crates/metrics/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-metrics" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "reth metrics utilities" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-metrics-derive.workspace = true 17 | 18 | # metrics 19 | metrics.workspace = true 20 | 21 | # async 22 | tokio = { workspace = true, features = ["full"], optional = true } 23 | futures = { workspace = true, optional = true } 24 | tokio-util = { workspace = true, optional = true } 25 | 26 | [features] 27 | common = ["tokio", "futures", "tokio-util"] 28 | -------------------------------------------------------------------------------- /crates/metrics/metrics-derive/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-metrics-derive" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [lib] 14 | proc-macro = true 15 | 16 | [dependencies] 17 | proc-macro2.workspace = true 18 | syn = { workspace = true, features = ["extra-traits"] } 19 | quote.workspace = true 20 | regex = "1.6.0" 21 | 22 | [dev-dependencies] 23 | metrics.workspace = true 24 | serial_test.workspace = true 25 | trybuild = "1.0" 26 | -------------------------------------------------------------------------------- /crates/metrics/metrics-derive/src/with_attrs.rs: -------------------------------------------------------------------------------- 1 | use syn::{Attribute, DeriveInput, Field}; 2 | 3 | pub(crate) trait WithAttrs { 4 | fn attrs(&self) -> &[Attribute]; 5 | } 6 | 7 | impl WithAttrs for DeriveInput { 8 | fn attrs(&self) -> &[Attribute] { 9 | &self.attrs 10 | } 11 | } 12 | 13 | impl WithAttrs for Field { 14 | fn attrs(&self) -> &[Attribute] { 15 | &self.attrs 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /crates/metrics/metrics-derive/tests/trybuild.rs: -------------------------------------------------------------------------------- 1 | #[test] 2 | fn compile_test() { 3 | let t = trybuild::TestCases::new(); 4 | t.compile_fail("tests/compile-fail/*.rs"); 5 | } 6 | -------------------------------------------------------------------------------- /crates/metrics/src/common/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod mpsc; 2 | -------------------------------------------------------------------------------- /crates/metrics/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Collection of metrics utilities. 2 | //! 3 | //! ## Feature Flags 4 | //! 5 | //! - `common`: Common metrics utilities, such as wrappers around tokio senders and receivers. Pulls 6 | //! in `tokio`. 7 | 8 | #![doc( 9 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 10 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 11 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 12 | )] 13 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 14 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 15 | 16 | /// Metrics derive macro. 17 | pub use reth_metrics_derive::Metrics; 18 | 19 | /// Implementation of common metric utilities. 20 | #[cfg(feature = "common")] 21 | pub mod common; 22 | 23 | /// Re-export core metrics crate. 24 | pub use metrics; 25 | -------------------------------------------------------------------------------- /crates/net/banlist/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-net-banlist" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Banlist for peers and IPs" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # ethereum 16 | alloy-primitives.workspace = true -------------------------------------------------------------------------------- /crates/net/discv4/src/node.rs: -------------------------------------------------------------------------------- 1 | use alloy_primitives::keccak256; 2 | use generic_array::GenericArray; 3 | use reth_network_peers::{NodeRecord, PeerId}; 4 | 5 | /// The key type for the table. 6 | #[derive(Debug, Copy, Clone, Eq, PartialEq)] 7 | pub(crate) struct NodeKey(pub(crate) PeerId); 8 | 9 | impl From for NodeKey { 10 | fn from(value: PeerId) -> Self { 11 | Self(value) 12 | } 13 | } 14 | 15 | impl From for discv5::Key { 16 | fn from(value: NodeKey) -> Self { 17 | let hash = keccak256(value.0.as_slice()); 18 | let hash = *GenericArray::from_slice(hash.as_slice()); 19 | Self::new_raw(value, hash) 20 | } 21 | } 22 | 23 | impl From<&NodeRecord> for NodeKey { 24 | fn from(node: &NodeRecord) -> Self { 25 | Self(node.id) 26 | } 27 | } 28 | 29 | /// Converts a `PeerId` into the required `Key` type for the table 30 | #[inline] 31 | pub(crate) fn kad_key(node: PeerId) -> discv5::Key { 32 | discv5::kbucket::Key::from(NodeKey::from(node)) 33 | } 34 | -------------------------------------------------------------------------------- /crates/net/discv5/README.md: -------------------------------------------------------------------------------- 1 | # Discv5 2 | 3 | Thin wrapper around sigp/discv5. -------------------------------------------------------------------------------- /crates/net/downloaders/src/bodies/mod.rs: -------------------------------------------------------------------------------- 1 | /// A naive concurrent downloader. 2 | #[allow(clippy::module_inception)] 3 | pub mod bodies; 4 | 5 | /// A body downloader that does nothing. Useful to build unwind-only pipelines. 6 | pub mod noop; 7 | 8 | /// A downloader implementation that spawns a downloader to a task 9 | pub mod task; 10 | 11 | mod queue; 12 | mod request; 13 | 14 | #[cfg(any(test, feature = "test-utils"))] 15 | pub mod test_utils; 16 | -------------------------------------------------------------------------------- /crates/net/downloaders/src/bodies/noop.rs: -------------------------------------------------------------------------------- 1 | use futures::Stream; 2 | use reth_network_p2p::{ 3 | bodies::{downloader::BodyDownloader, response::BlockResponse}, 4 | error::{DownloadError, DownloadResult}, 5 | }; 6 | use reth_primitives::BlockNumber; 7 | use std::ops::RangeInclusive; 8 | 9 | /// A [`BodyDownloader`] implementation that does nothing. 10 | #[derive(Debug, Default)] 11 | #[non_exhaustive] 12 | pub struct NoopBodiesDownloader; 13 | 14 | impl BodyDownloader for NoopBodiesDownloader { 15 | fn set_download_range(&mut self, _: RangeInclusive) -> DownloadResult<()> { 16 | Ok(()) 17 | } 18 | } 19 | 20 | impl Stream for NoopBodiesDownloader { 21 | type Item = Result, DownloadError>; 22 | 23 | fn poll_next( 24 | self: std::pin::Pin<&mut Self>, 25 | _: &mut std::task::Context<'_>, 26 | ) -> std::task::Poll> { 27 | panic!("NoopBodiesDownloader shouldn't be polled.") 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /crates/net/downloaders/src/headers/mod.rs: -------------------------------------------------------------------------------- 1 | /// A Linear downloader implementation. 2 | pub mod reverse_headers; 3 | 4 | /// A header downloader that does nothing. Useful to build unwind-only pipelines. 5 | pub mod noop; 6 | 7 | /// A downloader implementation that spawns a downloader to a task 8 | pub mod task; 9 | 10 | #[cfg(any(test, feature = "test-utils"))] 11 | pub mod test_utils; 12 | -------------------------------------------------------------------------------- /crates/net/downloaders/src/headers/noop.rs: -------------------------------------------------------------------------------- 1 | use futures::Stream; 2 | use reth_network_p2p::headers::{ 3 | downloader::{HeaderDownloader, SyncTarget}, 4 | error::HeadersDownloaderError, 5 | }; 6 | use reth_primitives::SealedHeader; 7 | 8 | /// A [`HeaderDownloader`] implementation that does nothing. 9 | #[derive(Debug, Default)] 10 | #[non_exhaustive] 11 | pub struct NoopHeaderDownloader; 12 | 13 | impl HeaderDownloader for NoopHeaderDownloader { 14 | fn update_local_head(&mut self, _: SealedHeader) {} 15 | 16 | fn update_sync_target(&mut self, _: SyncTarget) {} 17 | 18 | fn set_batch_size(&mut self, _: usize) {} 19 | } 20 | 21 | impl Stream for NoopHeaderDownloader { 22 | type Item = Result, HeadersDownloaderError>; 23 | 24 | fn poll_next( 25 | self: std::pin::Pin<&mut Self>, 26 | _: &mut std::task::Context<'_>, 27 | ) -> std::task::Poll> { 28 | panic!("NoopHeaderDownloader shouldn't be polled.") 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /crates/net/downloaders/src/headers/test_utils.rs: -------------------------------------------------------------------------------- 1 | //! Test helper impls for generating bodies 2 | 3 | #![allow(dead_code)] 4 | 5 | use reth_primitives::SealedHeader; 6 | 7 | /// Returns a new [`SealedHeader`] that's the child header of the given `parent`. 8 | pub(crate) fn child_header(parent: &SealedHeader) -> SealedHeader { 9 | let mut child = parent.as_ref().clone(); 10 | child.number += 1; 11 | child.parent_hash = parent.hash_slow(); 12 | child.seal_slow() 13 | } 14 | -------------------------------------------------------------------------------- /crates/net/ecies/src/util.rs: -------------------------------------------------------------------------------- 1 | //! Utility functions for hashing and encoding. 2 | 3 | use alloy_primitives::B256; 4 | use hmac::{Hmac, Mac}; 5 | use sha2::{Digest, Sha256}; 6 | 7 | /// Hashes the input data with SHA256. 8 | pub(crate) fn sha256(data: &[u8]) -> B256 { 9 | B256::from(Sha256::digest(data).as_ref()) 10 | } 11 | 12 | /// Produces a `HMAC_SHA256` digest of the `input_data` and `auth_data` with the given `key`. 13 | /// This is done by accumulating each slice in `input_data` into the HMAC state, then accumulating 14 | /// the `auth_data` and returning the resulting digest. 15 | pub(crate) fn hmac_sha256(key: &[u8], input: &[&[u8]], auth_data: &[u8]) -> B256 { 16 | let mut hmac = Hmac::::new_from_slice(key).unwrap(); 17 | for input in input { 18 | hmac.update(input); 19 | } 20 | hmac.update(auth_data); 21 | B256::from_slice(&hmac.finalize().into_bytes()) 22 | } 23 | -------------------------------------------------------------------------------- /crates/net/eth-wire/src/errors/mod.rs: -------------------------------------------------------------------------------- 1 | //! Error types for stream variants 2 | 3 | mod eth; 4 | mod p2p; 5 | 6 | pub use eth::*; 7 | pub use p2p::*; 8 | -------------------------------------------------------------------------------- /crates/net/eth-wire/tests/new_pooled_transactions.rs: -------------------------------------------------------------------------------- 1 | //! Decoding tests for [`NewPooledTransactions`] 2 | 3 | use alloy_rlp::Decodable; 4 | use reth_eth_wire::NewPooledTransactionHashes66; 5 | use reth_primitives::hex; 6 | use std::{fs, path::PathBuf}; 7 | 8 | #[test] 9 | fn decode_new_pooled_transaction_hashes_network() { 10 | let network_data_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) 11 | .join("testdata/new_pooled_transactions_network_rlp"); 12 | let data = fs::read_to_string(network_data_path).expect("Unable to read file"); 13 | let hex_data = hex::decode(data.trim()).unwrap(); 14 | let _txs = NewPooledTransactionHashes66::decode(&mut &hex_data[..]).unwrap(); 15 | } 16 | -------------------------------------------------------------------------------- /crates/net/nat/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-net-nat" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Helpers for working around NAT" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | futures-util.workspace = true 16 | reqwest.workspace = true 17 | serde_with = { workspace = true, optional = true } 18 | thiserror.workspace = true 19 | tokio = { workspace = true, features = ["time"] } 20 | 21 | [dev-dependencies] 22 | reth-tracing.workspace = true 23 | tokio = { workspace = true, features = ["macros"] } 24 | 25 | [features] 26 | default = ["serde"] 27 | serde = ["dep:serde_with"] 28 | -------------------------------------------------------------------------------- /crates/net/network-api/src/downloaders.rs: -------------------------------------------------------------------------------- 1 | //! API related to syncing blocks. 2 | 3 | use futures::Future; 4 | use reth_network_p2p::BlockClient; 5 | use tokio::sync::oneshot; 6 | 7 | /// Provides client for downloading blocks. 8 | #[auto_impl::auto_impl(&, Arc)] 9 | pub trait BlockDownloaderProvider { 10 | /// Returns a new [`BlockClient`], used for fetching blocks from peers. 11 | /// 12 | /// The client is the entrypoint for sending block requests to the network. 13 | fn fetch_client( 14 | &self, 15 | ) -> impl Future> + Send; 16 | } 17 | -------------------------------------------------------------------------------- /crates/net/network-api/src/error.rs: -------------------------------------------------------------------------------- 1 | use thiserror::Error; 2 | use tokio::sync::{mpsc, oneshot}; 3 | 4 | /// Network Errors 5 | #[derive(Error, Debug, Clone, PartialEq, Eq)] 6 | pub enum NetworkError { 7 | /// Indicates that the sender has been dropped. 8 | #[error("sender has been dropped")] 9 | ChannelClosed, 10 | } 11 | 12 | impl From> for NetworkError { 13 | fn from(_: mpsc::error::SendError) -> Self { 14 | Self::ChannelClosed 15 | } 16 | } 17 | 18 | impl From for NetworkError { 19 | fn from(_: oneshot::error::RecvError) -> Self { 20 | Self::ChannelClosed 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /crates/net/network-api/src/test_utils/mod.rs: -------------------------------------------------------------------------------- 1 | //! API for integration testing network components. 2 | 3 | pub mod peers_manager; 4 | 5 | pub use peers_manager::{PeerCommand, PeersHandle, PeersHandleProvider}; 6 | -------------------------------------------------------------------------------- /crates/net/network-types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-network-types" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Commonly used network types" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-network-peers.workspace = true 17 | reth-net-banlist.workspace = true 18 | reth-ethereum-forks.workspace = true 19 | 20 | # misc 21 | serde = { workspace = true, optional = true } 22 | humantime-serde = { workspace = true, optional = true } 23 | serde_json = { workspace = true } 24 | 25 | # misc 26 | tracing.workspace = true 27 | 28 | [features] 29 | serde = ["dep:serde", "dep:humantime-serde"] 30 | test-utils = [] 31 | -------------------------------------------------------------------------------- /crates/net/network-types/src/backoff.rs: -------------------------------------------------------------------------------- 1 | /// Describes the type of backoff should be applied. 2 | #[derive(Debug, Clone, PartialEq, Eq)] 3 | pub enum BackoffKind { 4 | /// Use the lowest configured backoff duration. 5 | /// 6 | /// This applies to connection problems where there is a chance that they will be resolved 7 | /// after the short duration. 8 | Low, 9 | /// Use a slightly higher duration to put a peer in timeout 10 | /// 11 | /// This applies to more severe connection problems where there is a lower chance that they 12 | /// will be resolved. 13 | Medium, 14 | /// Use the max configured backoff duration. 15 | /// 16 | /// This is intended for spammers, or bad peers in general. 17 | High, 18 | } 19 | 20 | // === impl BackoffKind === 21 | 22 | impl BackoffKind { 23 | /// Returns true if the backoff is considered severe. 24 | pub const fn is_severe(&self) -> bool { 25 | matches!(self, Self::Medium | Self::High) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /crates/net/network-types/src/peers/kind.rs: -------------------------------------------------------------------------------- 1 | //! Classification of a peer based on trust. 2 | 3 | /// Represents the kind of peer 4 | #[derive(Debug, Clone, Copy, Default, Eq, PartialEq)] 5 | pub enum PeerKind { 6 | /// Basic peer kind. 7 | #[default] 8 | Basic, 9 | /// Static peer, added via JSON-RPC. 10 | Static, 11 | /// Trusted peer. 12 | Trusted, 13 | } 14 | 15 | impl PeerKind { 16 | /// Returns `true` if the peer is trusted. 17 | pub const fn is_trusted(&self) -> bool { 18 | matches!(self, Self::Trusted) 19 | } 20 | 21 | /// Returns `true` if the peer is static. 22 | pub const fn is_static(&self) -> bool { 23 | matches!(self, Self::Static) 24 | } 25 | 26 | /// Returns `true` if the peer is basic. 27 | pub const fn is_basic(&self) -> bool { 28 | matches!(self, Self::Basic) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /crates/net/network-types/src/session/mod.rs: -------------------------------------------------------------------------------- 1 | //! Peer sessions configuration. 2 | 3 | pub mod config; 4 | pub use config::{SessionLimits, SessionsConfig}; 5 | -------------------------------------------------------------------------------- /crates/net/network/README.md: -------------------------------------------------------------------------------- 1 | # RETH network implementation -------------------------------------------------------------------------------- /crates/net/network/docs/mermaid/network-manager.mmd: -------------------------------------------------------------------------------- 1 | graph TB 2 | handle(NetworkHandle) 3 | events(NetworkEvents) 4 | transactions(Transactions Task) 5 | ethrequest(ETH Request Task) 6 | discovery(Discovery Task) 7 | subgraph NetworkManager 8 | direction LR 9 | subgraph Swarm 10 | direction TB 11 | B1[(Session Manager)] 12 | B2[(Connection Lister)] 13 | B3[(Network State)] 14 | end 15 | end 16 | handle <--> |request response channel| NetworkManager 17 | NetworkManager --> |Network events| events 18 | transactions <--> |transactions| NetworkManager 19 | ethrequest <--> |ETH request handing| NetworkManager 20 | discovery --> |Discovered peers| NetworkManager 21 | -------------------------------------------------------------------------------- /crates/net/network/docs/mermaid/swarm.mmd: -------------------------------------------------------------------------------- 1 | graph TB 2 | connections(TCP Listener) 3 | Discovery[(Discovery)] 4 | fetchRequest(Client Interfaces) 5 | Sessions[(SessionManager)] 6 | SessionTask[(Peer Session)] 7 | State[(State)] 8 | StateFetch[(State Fetcher)] 9 | connections --> |incoming| Sessions 10 | State --> |initiate outgoing| Sessions 11 | Discovery --> |update peers| State 12 | Sessions --> |spawns| SessionTask 13 | SessionTask <--> |handle state requests| State 14 | fetchRequest --> |request Headers, Bodies| StateFetch 15 | State --> |poll pending requests| StateFetch 16 | -------------------------------------------------------------------------------- /crates/net/network/src/flattened_response.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | pin::Pin, 3 | task::{Context, Poll}, 4 | }; 5 | 6 | use futures::Future; 7 | use pin_project::pin_project; 8 | use tokio::sync::oneshot::{error::RecvError, Receiver}; 9 | 10 | /// Flatten a [Receiver] message in order to get rid of the [RecvError] result 11 | #[derive(Debug)] 12 | #[pin_project] 13 | pub struct FlattenedResponse { 14 | #[pin] 15 | receiver: Receiver, 16 | } 17 | 18 | impl Future for FlattenedResponse> 19 | where 20 | E: From, 21 | { 22 | type Output = Result; 23 | 24 | fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { 25 | let this = self.project(); 26 | 27 | this.receiver.poll(cx).map(|r| match r { 28 | Ok(r) => r, 29 | Err(err) => Err(err.into()), 30 | }) 31 | } 32 | } 33 | 34 | impl From> for FlattenedResponse { 35 | fn from(value: Receiver) -> Self { 36 | Self { receiver: value } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /crates/net/network/src/test_utils/mod.rs: -------------------------------------------------------------------------------- 1 | //! Common helpers for network testing. 2 | 3 | mod init; 4 | mod testnet; 5 | 6 | pub use init::{ 7 | enr_to_peer_id, unused_port, unused_tcp_addr, unused_tcp_and_udp_port, unused_tcp_udp, 8 | unused_udp_addr, unused_udp_port, GETH_TIMEOUT, 9 | }; 10 | pub use testnet::{NetworkEventStream, Peer, PeerConfig, PeerHandle, Testnet, TestnetHandle}; 11 | -------------------------------------------------------------------------------- /crates/net/network/tests/it/main.rs: -------------------------------------------------------------------------------- 1 | mod big_pooled_txs_req; 2 | mod connect; 3 | mod multiplex; 4 | mod requests; 5 | mod session; 6 | mod startup; 7 | mod txgossip; 8 | 9 | const fn main() {} 10 | -------------------------------------------------------------------------------- /crates/net/p2p/src/bodies/downloader.rs: -------------------------------------------------------------------------------- 1 | use super::response::BlockResponse; 2 | use crate::error::DownloadResult; 3 | use futures::Stream; 4 | use reth_primitives::BlockNumber; 5 | use std::ops::RangeInclusive; 6 | 7 | /// Body downloader return type. 8 | pub type BodyDownloaderResult = DownloadResult>; 9 | 10 | /// A downloader capable of fetching and yielding block bodies from block headers. 11 | /// 12 | /// A downloader represents a distinct strategy for submitting requests to download block bodies, 13 | /// while a [`BodiesClient`][crate::bodies::client::BodiesClient] represents a client capable of 14 | /// fulfilling these requests. 15 | pub trait BodyDownloader: Send + Sync + Stream + Unpin { 16 | /// Method for setting the download range. 17 | fn set_download_range(&mut self, range: RangeInclusive) -> DownloadResult<()>; 18 | } 19 | -------------------------------------------------------------------------------- /crates/net/p2p/src/bodies/mod.rs: -------------------------------------------------------------------------------- 1 | /// Traits and types for block body clients. 2 | pub mod client; 3 | 4 | /// Block body downloaders. 5 | pub mod downloader; 6 | 7 | /// Block response 8 | pub mod response; 9 | -------------------------------------------------------------------------------- /crates/net/p2p/src/download.rs: -------------------------------------------------------------------------------- 1 | use reth_network_peers::PeerId; 2 | use std::fmt::Debug; 3 | 4 | /// Generic download client for peer penalization 5 | #[auto_impl::auto_impl(&, Arc, Box)] 6 | pub trait DownloadClient: Send + Sync + Debug { 7 | /// Penalize the peer for responding with a message 8 | /// that violates validation rules 9 | fn report_bad_message(&self, peer_id: PeerId); 10 | 11 | /// Returns how many peers the network is currently connected to. 12 | fn num_connected_peers(&self) -> usize; 13 | } 14 | -------------------------------------------------------------------------------- /crates/net/p2p/src/headers/mod.rs: -------------------------------------------------------------------------------- 1 | /// Trait definition for [`HeadersClient`] 2 | /// 3 | /// [`HeadersClient`]: client::HeadersClient 4 | pub mod client; 5 | 6 | /// A downloader that receives and verifies block headers, is generic 7 | /// over the Consensus and the `HeadersClient` being used. 8 | /// 9 | /// [`Consensus`]: reth_consensus::Consensus 10 | /// [`HeadersClient`]: client::HeadersClient 11 | pub mod downloader; 12 | 13 | /// Header downloader error. 14 | pub mod error; 15 | -------------------------------------------------------------------------------- /crates/net/p2p/src/priority.rs: -------------------------------------------------------------------------------- 1 | /// `BlockHeader` and `BodyHeader` `DownloadRequest` priority 2 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] 3 | pub enum Priority { 4 | /// Queued from the back for download requests. 5 | #[default] 6 | Normal, 7 | 8 | /// Queued from the front for download requests. 9 | High, 10 | } 11 | 12 | impl Priority { 13 | /// Returns `true` if this is [`Priority::High`] 14 | pub const fn is_high(&self) -> bool { 15 | matches!(self, Self::High) 16 | } 17 | 18 | /// Returns `true` if this is [`Priority::Normal`] 19 | pub const fn is_normal(&self) -> bool { 20 | matches!(self, Self::Normal) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /crates/net/p2p/src/test_utils/mod.rs: -------------------------------------------------------------------------------- 1 | mod bodies; 2 | mod full_block; 3 | mod headers; 4 | 5 | pub use bodies::*; 6 | pub use full_block::*; 7 | pub use headers::*; 8 | -------------------------------------------------------------------------------- /crates/node/api/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-node-api" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | # reth 15 | reth-evm.workspace = true 16 | reth-provider.workspace = true 17 | reth-chainspec.workspace = true 18 | reth-db-api.workspace = true 19 | reth-engine-primitives.workspace = true 20 | reth-transaction-pool.workspace = true 21 | reth-payload-builder.workspace = true 22 | reth-payload-primitives.workspace = true 23 | reth-tasks.workspace = true 24 | reth-rpc-eth-api.workspace = true 25 | reth-network-api.workspace = true 26 | -------------------------------------------------------------------------------- /crates/node/api/src/primitives.rs: -------------------------------------------------------------------------------- 1 | //! Type abstraction for node primitive types. 2 | 3 | /// Configures all the primitive types of the node. 4 | // TODO(mattsse): this is currently a placeholder 5 | pub trait NodePrimitives {} 6 | 7 | // TODO(mattsse): Placeholder 8 | impl NodePrimitives for () {} 9 | -------------------------------------------------------------------------------- /crates/node/builder/README.md: -------------------------------------------------------------------------------- 1 | ## reth-node-builder 2 | 3 | A declarative way to configure a reth ethereum node. 4 | 5 | ### Examples 6 | 7 | The [examples](../../../examples) folder contains various examples of how to use the builder to configure a reth node. -------------------------------------------------------------------------------- /crates/node/builder/docs/mermaid/builder.mmd: -------------------------------------------------------------------------------- 1 | graph TD; 2 | CLI::parse-->NodeCommand 3 | NodeCommand--execute-->NodeBuilder 4 | subgraph "Builder" 5 | NodeBuilder--"with_types"-->NodeBuilderT 6 | NodeBuilderT("NodeBuilder(Types)")--"with_components"-->NodeBuilderC 7 | NodeBuilderC("NodeBuilder(Types, Components)")--"extend_rpc_modules"-->NodeBuilderC 8 | NodeBuilderC--"on_rpc_started"-->NodeBuilderC 9 | end 10 | NodeBuilderC--"launch"-->launch 11 | subgraph launch 12 | database("database init")-->tree("blockchain tree init") 13 | tree--BuilderContext-->components{"build_components"} 14 | subgraph components 15 | ComponentsBuilder--"first creates"-->Pool 16 | Pool--"then creates"-->PayloadService 17 | Pool--"then creates"-->Network 18 | end 19 | components--"launch rpc"-->RpcContext 20 | RpcContext--invokes-->extend_rpc_modules 21 | RpcContext--invokes-->on_rpc_started 22 | end 23 | launch--"FullNode"-->NodeHandle 24 | -------------------------------------------------------------------------------- /crates/node/builder/src/components/pool.rs: -------------------------------------------------------------------------------- 1 | //! Pool component for the node builder. 2 | 3 | use std::future::Future; 4 | 5 | use reth_transaction_pool::TransactionPool; 6 | 7 | use crate::{BuilderContext, FullNodeTypes}; 8 | 9 | /// A type that knows how to build the transaction pool. 10 | pub trait PoolBuilder: Send { 11 | /// The transaction pool to build. 12 | type Pool: TransactionPool + Unpin + 'static; 13 | 14 | /// Creates the transaction pool. 15 | fn build_pool( 16 | self, 17 | ctx: &BuilderContext, 18 | ) -> impl Future> + Send; 19 | } 20 | 21 | impl PoolBuilder for F 22 | where 23 | Node: FullNodeTypes, 24 | Pool: TransactionPool + Unpin + 'static, 25 | F: FnOnce(&BuilderContext) -> Fut + Send, 26 | Fut: Future> + Send, 27 | { 28 | type Pool = Pool; 29 | 30 | fn build_pool( 31 | self, 32 | ctx: &BuilderContext, 33 | ) -> impl Future> { 34 | self(ctx) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /crates/node/core/build.rs: -------------------------------------------------------------------------------- 1 | #![allow(missing_docs)] 2 | 3 | use std::{env, error::Error}; 4 | use vergen::EmitBuilder; 5 | 6 | fn main() -> Result<(), Box> { 7 | // Emit the instructions 8 | EmitBuilder::builder() 9 | .git_describe(false, true, None) 10 | .git_dirty(true) 11 | .git_sha(false) 12 | .build_timestamp() 13 | .cargo_features() 14 | .cargo_target_triple() 15 | .emit_and_set()?; 16 | 17 | let sha = env::var("VERGEN_GIT_SHA")?; 18 | let sha_short = &sha[0..7]; 19 | 20 | let is_dirty = env::var("VERGEN_GIT_DIRTY")? == "true"; 21 | // > git describe --always --tags 22 | // if not on a tag: v0.2.0-beta.3-82-g1939939b 23 | // if on a tag: v0.2.0-beta.3 24 | let not_on_tag = env::var("VERGEN_GIT_DESCRIBE")?.ends_with(&format!("-g{sha_short}")); 25 | let is_dev = is_dirty || not_on_tag; 26 | println!("cargo:rustc-env=RETH_VERSION_SUFFIX={}", if is_dev { "-dev" } else { "" }); 27 | Ok(()) 28 | } 29 | -------------------------------------------------------------------------------- /crates/node/core/src/cli/mod.rs: -------------------------------------------------------------------------------- 1 | //! Additional CLI configuration support. 2 | 3 | pub mod config; 4 | -------------------------------------------------------------------------------- /crates/node/events/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-node-events" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | reth-provider.workspace = true 15 | reth-beacon-consensus.workspace = true 16 | reth-network = { workspace = true, features = ["serde"] } 17 | reth-network-api.workspace = true 18 | reth-stages.workspace = true 19 | reth-prune.workspace = true 20 | reth-static-file.workspace = true 21 | reth-primitives.workspace = true 22 | reth-primitives-traits.workspace = true 23 | 24 | # alloy 25 | alloy-rpc-types-engine.workspace = true 26 | 27 | # async 28 | tokio.workspace = true 29 | 30 | # async 31 | futures.workspace = true 32 | 33 | tracing.workspace = true 34 | 35 | #misc 36 | pin-project.workspace = true 37 | humantime.workspace = true 38 | -------------------------------------------------------------------------------- /crates/node/events/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Various event handlers for the node. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | pub mod cl; 12 | pub mod node; 13 | -------------------------------------------------------------------------------- /crates/node/metrics/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Metrics utilities for the node. 2 | #![doc( 3 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 4 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 5 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 6 | )] 7 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 8 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 9 | 10 | /// The metrics hooks for prometheus. 11 | pub mod hooks; 12 | pub mod recorder; 13 | /// The metric server serving the metrics. 14 | pub mod server; 15 | pub mod version; 16 | 17 | pub use metrics_exporter_prometheus::*; 18 | pub use metrics_process::*; 19 | -------------------------------------------------------------------------------- /crates/optimism/consensus/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-optimism-consensus" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | exclude.workspace = true 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-consensus-common.workspace = true 17 | reth-chainspec.workspace = true 18 | reth-primitives.workspace = true 19 | reth-consensus.workspace = true 20 | 21 | tracing.workspace = true 22 | 23 | [features] 24 | optimism = ["reth-primitives/optimism"] 25 | -------------------------------------------------------------------------------- /crates/optimism/node/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Standalone crate for Optimism-specific Reth configuration and builder types. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 9 | // The `optimism` feature must be enabled to use this crate. 10 | #![cfg(feature = "optimism")] 11 | 12 | /// CLI argument parsing for the optimism node. 13 | pub mod args; 14 | 15 | /// Exports optimism-specific implementations of the [`EngineTypes`](reth_node_api::EngineTypes) 16 | /// trait. 17 | pub mod engine; 18 | pub use engine::OptimismEngineTypes; 19 | 20 | pub mod node; 21 | pub use node::OptimismNode; 22 | 23 | pub mod txpool; 24 | 25 | pub mod rpc; 26 | 27 | pub use reth_optimism_payload_builder::{ 28 | OptimismBuiltPayload, OptimismPayloadBuilder, OptimismPayloadBuilderAttributes, 29 | }; 30 | 31 | pub use reth_evm_optimism::*; 32 | -------------------------------------------------------------------------------- /crates/optimism/node/tests/e2e/main.rs: -------------------------------------------------------------------------------- 1 | #[cfg(feature = "optimism")] 2 | mod p2p; 3 | 4 | #[cfg(feature = "optimism")] 5 | mod utils; 6 | 7 | const fn main() {} 8 | -------------------------------------------------------------------------------- /crates/optimism/node/tests/it/main.rs: -------------------------------------------------------------------------------- 1 | #[cfg(feature = "optimism")] 2 | mod builder; 3 | 4 | const fn main() {} 5 | -------------------------------------------------------------------------------- /crates/optimism/payload/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Optimism's payload builder implementation. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(all(not(test), feature = "optimism"), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | #![allow(clippy::useless_let_if_seq)] 11 | // The `optimism` feature must be enabled to use this crate. 12 | #![cfg(feature = "optimism")] 13 | 14 | pub mod builder; 15 | pub use builder::OptimismPayloadBuilder; 16 | pub mod error; 17 | pub mod payload; 18 | pub use payload::{ 19 | OptimismBuiltPayload, OptimismPayloadAttributes, OptimismPayloadBuilderAttributes, 20 | }; 21 | -------------------------------------------------------------------------------- /crates/optimism/primitives/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-optimism-primitives" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "OP primitive types" 10 | 11 | [lints] 12 | workspace = true 13 | -------------------------------------------------------------------------------- /crates/optimism/primitives/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Standalone crate for Optimism-specific Reth primitive types. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 9 | 10 | pub mod bedrock_import; 11 | -------------------------------------------------------------------------------- /crates/optimism/rpc/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! OP-Reth RPC support. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(all(not(test), feature = "optimism"), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | // The `optimism` feature must be enabled to use this crate. 11 | #![cfg(feature = "optimism")] 12 | 13 | pub mod api; 14 | pub mod error; 15 | pub mod eth; 16 | 17 | pub use api::OpEthApiServer; 18 | pub use error::OpEthApiError; 19 | pub use eth::{receipt::op_receipt_fields, transaction::OptimismTxMeta, OpEthApi}; 20 | -------------------------------------------------------------------------------- /crates/payload/basic/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-basic-payload-builder" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "A basic payload builder for reth that uses the txpool API to build payloads." 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-chainspec.workspace = true 17 | reth-primitives.workspace = true 18 | reth-revm.workspace = true 19 | reth-transaction-pool.workspace = true 20 | reth-provider.workspace = true 21 | reth-payload-builder.workspace = true 22 | reth-payload-primitives.workspace = true 23 | reth-tasks.workspace = true 24 | 25 | # ethereum 26 | alloy-rlp.workspace = true 27 | revm.workspace = true 28 | 29 | # async 30 | tokio = { workspace = true, features = ["sync", "time"] } 31 | futures-core.workspace = true 32 | futures-util.workspace = true 33 | 34 | # metrics 35 | reth-metrics.workspace = true 36 | metrics.workspace = true 37 | 38 | # misc 39 | tracing.workspace = true 40 | -------------------------------------------------------------------------------- /crates/payload/basic/src/metrics.rs: -------------------------------------------------------------------------------- 1 | //! Metrics for the payload builder impl 2 | 3 | use reth_metrics::{metrics::Counter, Metrics}; 4 | 5 | /// Transaction pool metrics 6 | #[derive(Metrics)] 7 | #[metrics(scope = "payloads")] 8 | pub(crate) struct PayloadBuilderMetrics { 9 | /// Number of active jobs 10 | pub(crate) requested_empty_payload: Counter, 11 | /// Total number of initiated payload build attempts 12 | pub(crate) initiated_payload_builds: Counter, 13 | /// Total number of failed payload build attempts 14 | pub(crate) failed_payload_builds: Counter, 15 | } 16 | 17 | impl PayloadBuilderMetrics { 18 | pub(crate) fn inc_requested_empty_payload(&self) { 19 | self.requested_empty_payload.increment(1); 20 | } 21 | 22 | pub(crate) fn inc_initiated_payload_builds(&self) { 23 | self.initiated_payload_builds.increment(1); 24 | } 25 | 26 | pub(crate) fn inc_failed_payload_builds(&self) { 27 | self.failed_payload_builds.increment(1); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /crates/payload/builder/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-payload-builder" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "reth payload builder" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-primitives.workspace = true 17 | reth-rpc-types.workspace = true 18 | reth-transaction-pool.workspace = true 19 | reth-errors.workspace = true 20 | reth-provider.workspace = true 21 | reth-payload-primitives.workspace = true 22 | reth-ethereum-engine-primitives.workspace = true 23 | 24 | # async 25 | tokio = { workspace = true, features = ["sync"] } 26 | tokio-stream.workspace = true 27 | futures-util.workspace = true 28 | pin-project.workspace = true 29 | 30 | # metrics 31 | reth-metrics.workspace = true 32 | metrics.workspace = true 33 | 34 | # misc 35 | thiserror.workspace = true 36 | tracing.workspace = true 37 | 38 | [dev-dependencies] 39 | revm.workspace = true 40 | 41 | [features] 42 | test-utils = [] -------------------------------------------------------------------------------- /crates/payload/primitives/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-payload-primitives" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | exclude.workspace = true 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-chainspec.workspace = true 17 | reth-errors.workspace = true 18 | reth-primitives.workspace = true 19 | reth-transaction-pool.workspace = true 20 | reth-rpc-types.workspace = true 21 | reth-chain-state.workspace = true 22 | 23 | # async 24 | tokio = { workspace = true, features = ["sync"] } 25 | 26 | # misc 27 | thiserror.workspace = true 28 | serde.workspace = true -------------------------------------------------------------------------------- /crates/payload/validator/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-payload-validator" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Payload validation support" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-chainspec.workspace = true 17 | reth-primitives.workspace = true 18 | reth-rpc-types.workspace = true 19 | reth-rpc-types-compat.workspace = true 20 | -------------------------------------------------------------------------------- /crates/primitives-traits/src/header/error.rs: -------------------------------------------------------------------------------- 1 | /// Errors that can occur during header sanity checks. 2 | #[derive(Debug, PartialEq, Eq)] 3 | pub enum HeaderError { 4 | /// Represents an error when the block difficulty is too large. 5 | LargeDifficulty, 6 | /// Represents an error when the block extradata is too large. 7 | LargeExtraData, 8 | } 9 | -------------------------------------------------------------------------------- /crates/primitives/src/basefee.rs: -------------------------------------------------------------------------------- 1 | //! Helpers for working with EIP-1559 base fee 2 | 3 | // re-export 4 | #[doc(inline)] 5 | pub use alloy_eips::eip1559::calc_next_block_base_fee; 6 | -------------------------------------------------------------------------------- /crates/primitives/src/compression/receipt_dictionary.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megaeth-labs/reth/29058ad7ee64d993de6c301a9d688002cb698f03/crates/primitives/src/compression/receipt_dictionary.bin -------------------------------------------------------------------------------- /crates/primitives/src/compression/transaction_dictionary.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megaeth-labs/reth/29058ad7ee64d993de6c301a9d688002cb698f03/crates/primitives/src/compression/transaction_dictionary.bin -------------------------------------------------------------------------------- /crates/primitives/src/constants/mod.rs: -------------------------------------------------------------------------------- 1 | //! Ethereum protocol-related constants 2 | 3 | pub use reth_primitives_traits::constants::*; 4 | 5 | /// [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844#parameters) constants. 6 | pub mod eip4844; 7 | -------------------------------------------------------------------------------- /crates/primitives/src/eip4844.rs: -------------------------------------------------------------------------------- 1 | //! Helpers for working with EIP-4844 blob fee. 2 | 3 | // re-exports from revm for calculating blob fee 4 | pub use crate::revm_primitives::{ 5 | calc_blob_gasprice, calc_excess_blob_gas as calculate_excess_blob_gas, 6 | }; 7 | 8 | #[doc(inline)] 9 | pub use alloy_eips::eip4844::kzg_to_versioned_hash; 10 | -------------------------------------------------------------------------------- /crates/primitives/src/eip7702.rs: -------------------------------------------------------------------------------- 1 | //! Types for working with EIP-7702 transactions. 2 | 3 | /// Re-export from `alloy_eips`. 4 | #[doc(inline)] 5 | pub use alloy_eips::eip7702::{Authorization, OptionalNonce, SignedAuthorization}; 6 | -------------------------------------------------------------------------------- /crates/primitives/src/genesis.rs: -------------------------------------------------------------------------------- 1 | //! Types for genesis configuration of a chain. 2 | 3 | // re-export genesis types 4 | #[doc(inline)] 5 | pub use alloy_genesis::*; 6 | -------------------------------------------------------------------------------- /crates/primitives/src/transaction/meta.rs: -------------------------------------------------------------------------------- 1 | use crate::B256; 2 | 3 | /// Additional fields in the context of a block that contains this transaction. 4 | #[derive(Debug, Clone, Copy, Default, Eq, PartialEq)] 5 | pub struct TransactionMeta { 6 | /// Hash of the transaction. 7 | pub tx_hash: B256, 8 | /// Index of the transaction in the block 9 | pub index: u64, 10 | /// Hash of the block. 11 | pub block_hash: B256, 12 | /// Number of the block. 13 | pub block_number: u64, 14 | /// Base fee of the block. 15 | pub base_fee: Option, 16 | /// The excess blob gas of the block. 17 | pub excess_blob_gas: Option, 18 | /// The block's timestamp. 19 | pub timestamp: u64, 20 | } 21 | -------------------------------------------------------------------------------- /crates/prune/prune/src/error.rs: -------------------------------------------------------------------------------- 1 | use reth_db::DatabaseError; 2 | use reth_errors::RethError; 3 | use reth_provider::ProviderError; 4 | use reth_prune_types::PruneSegmentError; 5 | use thiserror::Error; 6 | 7 | /// Errors that can occur during pruning. 8 | #[derive(Error, Debug)] 9 | pub enum PrunerError { 10 | #[error(transparent)] 11 | PruneSegment(#[from] PruneSegmentError), 12 | 13 | #[error("inconsistent data: {0}")] 14 | InconsistentData(&'static str), 15 | 16 | #[error(transparent)] 17 | Database(#[from] DatabaseError), 18 | 19 | #[error(transparent)] 20 | Provider(#[from] ProviderError), 21 | } 22 | 23 | impl From for RethError { 24 | fn from(err: PrunerError) -> Self { 25 | match err { 26 | PrunerError::PruneSegment(_) | PrunerError::InconsistentData(_) => Self::other(err), 27 | PrunerError::Database(err) => Self::Database(err), 28 | PrunerError::Provider(err) => Self::Provider(err), 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /crates/prune/prune/src/event.rs: -------------------------------------------------------------------------------- 1 | use alloy_primitives::BlockNumber; 2 | use reth_prune_types::{PruneProgress, PruneSegment}; 3 | use std::time::Duration; 4 | 5 | /// An event emitted by a [Pruner][crate::Pruner]. 6 | #[derive(Debug, PartialEq, Eq, Clone)] 7 | pub enum PrunerEvent { 8 | /// Emitted when pruner started running. 9 | Started { tip_block_number: BlockNumber }, 10 | /// Emitted when pruner finished running. 11 | Finished { 12 | tip_block_number: BlockNumber, 13 | elapsed: Duration, 14 | stats: Vec<(PruneSegment, usize, PruneProgress)>, 15 | }, 16 | } 17 | -------------------------------------------------------------------------------- /crates/prune/prune/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Pruning implementation. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![allow(missing_docs)] 10 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 11 | 12 | mod builder; 13 | mod error; 14 | mod event; 15 | mod metrics; 16 | mod pruner; 17 | pub mod segments; 18 | 19 | use crate::metrics::Metrics; 20 | pub use builder::PrunerBuilder; 21 | pub use error::PrunerError; 22 | pub use event::PrunerEvent; 23 | pub use pruner::{Pruner, PrunerResult, PrunerWithResult}; 24 | 25 | // Re-export prune types 26 | #[doc(inline)] 27 | pub use reth_prune_types::*; 28 | -------------------------------------------------------------------------------- /crates/prune/prune/src/segments/static_file/mod.rs: -------------------------------------------------------------------------------- 1 | mod headers; 2 | mod receipts; 3 | mod transactions; 4 | 5 | pub use headers::Headers; 6 | pub use receipts::Receipts; 7 | pub use transactions::Transactions; 8 | -------------------------------------------------------------------------------- /crates/prune/prune/src/segments/user/mod.rs: -------------------------------------------------------------------------------- 1 | mod account_history; 2 | mod history; 3 | mod receipts; 4 | mod receipts_by_logs; 5 | mod sender_recovery; 6 | mod storage_history; 7 | mod transaction_lookup; 8 | 9 | pub use account_history::AccountHistory; 10 | pub use receipts::Receipts; 11 | pub use receipts_by_logs::ReceiptsByLogs; 12 | pub use sender_recovery::SenderRecovery; 13 | pub use storage_history::StorageHistory; 14 | pub use transaction_lookup::TransactionLookup; 15 | -------------------------------------------------------------------------------- /crates/prune/types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-prune-types" 3 | version.workspace = true 4 | edition.workspace = true 5 | homepage.workspace = true 6 | license.workspace = true 7 | repository.workspace = true 8 | rust-version.workspace = true 9 | description = "Commonly used types for prune usage in reth." 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | reth-codecs.workspace = true 16 | 17 | alloy-primitives.workspace = true 18 | bytes.workspace = true 19 | derive_more.workspace = true 20 | modular-bitfield.workspace = true 21 | serde.workspace = true 22 | thiserror.workspace = true 23 | 24 | [dev-dependencies] 25 | arbitrary = { workspace = true, features = ["derive"] } 26 | assert_matches.workspace = true 27 | proptest.workspace = true 28 | proptest-arbitrary-interop.workspace = true 29 | serde_json.workspace = true 30 | test-fuzz.workspace = true 31 | toml.workspace = true 32 | -------------------------------------------------------------------------------- /crates/prune/types/src/checkpoint.rs: -------------------------------------------------------------------------------- 1 | use crate::PruneMode; 2 | use alloy_primitives::{BlockNumber, TxNumber}; 3 | use reth_codecs::{add_arbitrary_tests, Compact}; 4 | use serde::{Deserialize, Serialize}; 5 | 6 | /// Saves the pruning progress of a stage. 7 | #[derive(Debug, PartialEq, Eq, Clone, Copy, Serialize, Deserialize, Compact)] 8 | #[cfg_attr(test, derive(Default, arbitrary::Arbitrary))] 9 | #[add_arbitrary_tests(compact)] 10 | pub struct PruneCheckpoint { 11 | /// Highest pruned block number. If it's [None], the pruning for block `0` is not finished yet. 12 | pub block_number: Option, 13 | /// Highest pruned transaction number, if applicable. 14 | pub tx_number: Option, 15 | /// Prune mode. 16 | pub prune_mode: PruneMode, 17 | } 18 | -------------------------------------------------------------------------------- /crates/revm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-revm" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "reth specific revm utilities" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-chainspec.workspace = true 17 | reth-primitives.workspace = true 18 | reth-storage-errors.workspace = true 19 | reth-execution-errors.workspace = true 20 | reth-consensus-common.workspace = true 21 | reth-prune-types.workspace = true 22 | reth-storage-api.workspace = true 23 | reth-trie = { workspace = true, optional = true } 24 | 25 | # revm 26 | revm.workspace = true 27 | 28 | # alloy 29 | alloy-eips.workspace = true 30 | 31 | [dev-dependencies] 32 | reth-trie.workspace = true 33 | reth-ethereum-forks.workspace = true 34 | 35 | [features] 36 | default = ["std", "c-kzg"] 37 | std = [] 38 | c-kzg = ["revm/c-kzg"] 39 | test-utils = ["dep:reth-trie"] 40 | optimism = ["revm/optimism"] 41 | -------------------------------------------------------------------------------- /crates/revm/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Revm utils and implementations specific to reth. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | #![cfg_attr(not(feature = "std"), no_std)] 11 | 12 | #[cfg(not(feature = "std"))] 13 | extern crate alloc; 14 | 15 | /// Contains glue code for integrating reth database into revm's [Database]. 16 | pub mod database; 17 | 18 | pub mod batch; 19 | 20 | /// State changes that are not related to transactions. 21 | pub mod state_change; 22 | 23 | /// Common test helpers 24 | #[cfg(any(test, feature = "test-utils"))] 25 | pub mod test_utils; 26 | 27 | // Convenience re-exports. 28 | pub use revm::{self, *}; 29 | -------------------------------------------------------------------------------- /crates/rpc/ipc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-ipc" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "IPC support for reth" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | 16 | # async/net 17 | futures.workspace = true 18 | tokio = { workspace = true, features = ["net", "time", "rt-multi-thread"] } 19 | tokio-util = { workspace = true, features = ["codec"] } 20 | tokio-stream.workspace = true 21 | async-trait.workspace = true 22 | pin-project.workspace = true 23 | tower.workspace = true 24 | 25 | # misc 26 | jsonrpsee = { workspace = true, features = ["server", "client"] } 27 | serde_json.workspace = true 28 | tracing.workspace = true 29 | bytes.workspace = true 30 | thiserror.workspace = true 31 | futures-util = "0.3.30" 32 | interprocess = { version = "2.2.0", features = ["tokio"] } 33 | 34 | [dev-dependencies] 35 | tokio-stream = { workspace = true, features = ["sync"] } 36 | reth-tracing.workspace = true 37 | rand.workspace = true 38 | -------------------------------------------------------------------------------- /crates/rpc/ipc/README.md: -------------------------------------------------------------------------------- 1 | #

reth-ipc

2 | 3 | IPC server and client implementation for [`jsonrpsee`](https://github.com/paritytech/jsonrpsee/). -------------------------------------------------------------------------------- /crates/rpc/ipc/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Reth IPC transport implementation 2 | //! 3 | //! ## Feature Flags 4 | //! 5 | //! - `client`: Enables JSON-RPC client support. 6 | 7 | #![doc( 8 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 9 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 10 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 11 | )] 12 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 13 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 14 | 15 | pub mod client; 16 | pub mod server; 17 | 18 | /// Json codec implementation 19 | pub mod stream_codec; 20 | -------------------------------------------------------------------------------- /crates/rpc/rpc-api/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-rpc-api" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Reth RPC interfaces" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-primitives.workspace = true 17 | reth-rpc-types.workspace = true 18 | reth-rpc-eth-api.workspace = true 19 | reth-engine-primitives.workspace = true 20 | reth-network-peers.workspace = true 21 | 22 | # ethereum 23 | alloy-json-rpc.workspace = true 24 | 25 | # misc 26 | jsonrpsee = { workspace = true, features = ["server", "macros"] } 27 | 28 | [dev-dependencies] 29 | serde_json.workspace = true 30 | 31 | [features] 32 | client = [ 33 | "jsonrpsee/client", 34 | "jsonrpsee/async-client", 35 | "reth-rpc-eth-api/client" 36 | ] 37 | -------------------------------------------------------------------------------- /crates/rpc/rpc-api/src/mev.rs: -------------------------------------------------------------------------------- 1 | use jsonrpsee::proc_macros::rpc; 2 | use reth_rpc_types::mev::{ 3 | SendBundleRequest, SendBundleResponse, SimBundleOverrides, SimBundleResponse, 4 | }; 5 | 6 | /// Mev rpc interface. 7 | #[cfg_attr(not(feature = "client"), rpc(server, namespace = "mev"))] 8 | #[cfg_attr(feature = "client", rpc(server, client, namespace = "mev"))] 9 | pub trait MevApi { 10 | /// Submitting bundles to the relay. It takes in a bundle and provides a bundle hash as a 11 | /// return value. 12 | #[method(name = "sendBundle")] 13 | async fn send_bundle( 14 | &self, 15 | request: SendBundleRequest, 16 | ) -> jsonrpsee::core::RpcResult; 17 | 18 | /// Similar to `mev_sendBundle` but instead of submitting a bundle to the relay, it returns 19 | /// a simulation result. Only fully matched bundles can be simulated. 20 | #[method(name = "simBundle")] 21 | async fn sim_bundle( 22 | &self, 23 | bundle: SendBundleRequest, 24 | sim_overrides: SimBundleOverrides, 25 | ) -> jsonrpsee::core::RpcResult; 26 | } 27 | -------------------------------------------------------------------------------- /crates/rpc/rpc-api/src/net.rs: -------------------------------------------------------------------------------- 1 | use jsonrpsee::{core::RpcResult, proc_macros::rpc}; 2 | use reth_primitives::U64; 3 | 4 | /// Net rpc interface. 5 | #[cfg_attr(not(feature = "client"), rpc(server, namespace = "net"))] 6 | #[cfg_attr(feature = "client", rpc(server, client, namespace = "net"))] 7 | pub trait NetApi { 8 | /// Returns the network ID. 9 | #[method(name = "version")] 10 | fn version(&self) -> RpcResult; 11 | 12 | /// Returns number of peers connected to node. 13 | #[method(name = "peerCount")] 14 | fn peer_count(&self) -> RpcResult; 15 | 16 | /// Returns true if client is actively listening for network connections. 17 | /// Otherwise false. 18 | #[method(name = "listening")] 19 | fn is_listening(&self) -> RpcResult; 20 | } 21 | -------------------------------------------------------------------------------- /crates/rpc/rpc-api/src/reth.rs: -------------------------------------------------------------------------------- 1 | use jsonrpsee::{core::RpcResult, proc_macros::rpc}; 2 | use reth_primitives::{Address, BlockId, U256}; 3 | use std::collections::HashMap; 4 | 5 | /// Reth API namespace for reth-specific methods 6 | #[cfg_attr(not(feature = "client"), rpc(server, namespace = "reth"))] 7 | #[cfg_attr(feature = "client", rpc(server, client, namespace = "reth"))] 8 | pub trait RethApi { 9 | /// Returns all ETH balance changes in a block 10 | #[method(name = "getBalanceChangesInBlock")] 11 | async fn reth_get_balance_changes_in_block( 12 | &self, 13 | block_id: BlockId, 14 | ) -> RpcResult>; 15 | } 16 | -------------------------------------------------------------------------------- /crates/rpc/rpc-api/src/rpc.rs: -------------------------------------------------------------------------------- 1 | use jsonrpsee::{core::RpcResult, proc_macros::rpc}; 2 | use reth_rpc_types::RpcModules; 3 | 4 | /// RPC namespace, used to find the versions of all rpc modules 5 | #[cfg_attr(not(feature = "client"), rpc(server, namespace = "rpc"))] 6 | #[cfg_attr(feature = "client", rpc(server, client, namespace = "rpc"))] 7 | pub trait RpcApi { 8 | /// Lists enabled APIs and the version of each. 9 | #[method(name = "modules")] 10 | fn rpc_modules(&self) -> RpcResult; 11 | } 12 | -------------------------------------------------------------------------------- /crates/rpc/rpc-api/src/validation.rs: -------------------------------------------------------------------------------- 1 | //! API for block submission validation. 2 | 3 | use jsonrpsee::proc_macros::rpc; 4 | use reth_rpc_types::beacon::relay::{ 5 | BuilderBlockValidationRequest, BuilderBlockValidationRequestV2, 6 | }; 7 | 8 | /// Block validation rpc interface. 9 | #[cfg_attr(not(feature = "client"), rpc(server, namespace = "flashbots"))] 10 | #[cfg_attr(feature = "client", rpc(server, client, namespace = "flashbots"))] 11 | pub trait BlockSubmissionValidationApi { 12 | /// A Request to validate a block submission. 13 | #[method(name = "validateBuilderSubmissionV1")] 14 | async fn validate_builder_submission_v1( 15 | &self, 16 | request: BuilderBlockValidationRequest, 17 | ) -> jsonrpsee::core::RpcResult<()>; 18 | 19 | /// A Request to validate a block submission. 20 | #[method(name = "validateBuilderSubmissionV2")] 21 | async fn validate_builder_submission_v2( 22 | &self, 23 | request: BuilderBlockValidationRequestV2, 24 | ) -> jsonrpsee::core::RpcResult<()>; 25 | } 26 | -------------------------------------------------------------------------------- /crates/rpc/rpc-api/src/web3.rs: -------------------------------------------------------------------------------- 1 | use jsonrpsee::{core::RpcResult, proc_macros::rpc}; 2 | use reth_primitives::{Bytes, B256}; 3 | 4 | /// Web3 rpc interface. 5 | #[cfg_attr(not(feature = "client"), rpc(server, namespace = "web3"))] 6 | #[cfg_attr(feature = "client", rpc(server, client, namespace = "web3"))] 7 | pub trait Web3Api { 8 | /// Returns current client version. 9 | #[method(name = "clientVersion")] 10 | async fn client_version(&self) -> RpcResult; 11 | 12 | /// Returns sha3 of the given data. 13 | #[method(name = "sha3")] 14 | fn sha3(&self, input: Bytes) -> RpcResult; 15 | } 16 | -------------------------------------------------------------------------------- /crates/rpc/rpc-builder/tests/it/main.rs: -------------------------------------------------------------------------------- 1 | mod auth; 2 | mod http; 3 | mod middleware; 4 | mod serde; 5 | mod startup; 6 | pub mod utils; 7 | 8 | const fn main() {} 9 | -------------------------------------------------------------------------------- /crates/rpc/rpc-engine-api/src/message.rs: -------------------------------------------------------------------------------- 1 | /// The version of Engine API message. 2 | #[derive(Debug, Clone, Copy, PartialEq, Eq)] 3 | pub enum EngineApiMessageVersion { 4 | /// Version 1 5 | V1, 6 | /// Version 2 7 | /// 8 | /// Added for shanghai hardfork. 9 | V2, 10 | /// Version 3 11 | /// 12 | /// Added for cancun hardfork. 13 | V3, 14 | } 15 | -------------------------------------------------------------------------------- /crates/rpc/rpc-engine-api/tests/it/main.rs: -------------------------------------------------------------------------------- 1 | mod payload; 2 | 3 | const fn main() {} 4 | -------------------------------------------------------------------------------- /crates/rpc/rpc-eth-api/src/pubsub.rs: -------------------------------------------------------------------------------- 1 | //! `eth_` RPC API for pubsub subscription. 2 | 3 | use alloy_json_rpc::RpcObject; 4 | use jsonrpsee::proc_macros::rpc; 5 | use reth_rpc_types::pubsub::{Params, SubscriptionKind}; 6 | 7 | /// Ethereum pub-sub rpc interface. 8 | #[rpc(server, namespace = "eth")] 9 | pub trait EthPubSubApi { 10 | /// Create an ethereum subscription for the given params 11 | #[subscription( 12 | name = "subscribe" => "subscription", 13 | unsubscribe = "unsubscribe", 14 | item = reth_rpc_types::pubsub::SubscriptionResult 15 | )] 16 | async fn subscribe( 17 | &self, 18 | kind: SubscriptionKind, 19 | params: Option, 20 | ) -> jsonrpsee::core::SubscriptionResult; 21 | } 22 | -------------------------------------------------------------------------------- /crates/rpc/rpc-eth-types/src/builder/mod.rs: -------------------------------------------------------------------------------- 1 | //! `eth` namespace API builder types. 2 | 3 | pub mod config; 4 | pub mod ctx; 5 | -------------------------------------------------------------------------------- /crates/rpc/rpc-eth-types/src/cache/metrics.rs: -------------------------------------------------------------------------------- 1 | //! Tracks state of RPC cache. 2 | 3 | use metrics::Counter; 4 | use reth_metrics::{metrics::Gauge, Metrics}; 5 | 6 | #[derive(Metrics)] 7 | #[metrics(scope = "rpc.eth_cache")] 8 | pub(crate) struct CacheMetrics { 9 | /// The number of entities in the cache. 10 | pub(crate) cached_count: Gauge, 11 | /// The number of queued consumers. 12 | pub(crate) queued_consumers_count: Gauge, 13 | /// The number of cache hits. 14 | pub(crate) hits_total: Counter, 15 | /// The number of cache misses. 16 | pub(crate) misses_total: Counter, 17 | } 18 | -------------------------------------------------------------------------------- /crates/rpc/rpc-eth-types/src/utils.rs: -------------------------------------------------------------------------------- 1 | //! Commonly used code snippets 2 | 3 | use reth_primitives::{Bytes, PooledTransactionsElement, PooledTransactionsElementEcRecovered}; 4 | 5 | use super::{EthApiError, EthResult}; 6 | 7 | /// Recovers a [`PooledTransactionsElementEcRecovered`] from an enveloped encoded byte stream. 8 | /// 9 | /// See [`PooledTransactionsElement::decode_enveloped`] 10 | pub fn recover_raw_transaction(data: Bytes) -> EthResult { 11 | if data.is_empty() { 12 | return Err(EthApiError::EmptyRawTransactionData) 13 | } 14 | 15 | let transaction = PooledTransactionsElement::decode_enveloped(&mut data.as_ref()) 16 | .map_err(|_| EthApiError::FailedToDecodeSignedTransaction)?; 17 | 18 | transaction.try_into_ecrecovered().or(Err(EthApiError::InvalidTransactionSignature)) 19 | } 20 | -------------------------------------------------------------------------------- /crates/rpc/rpc-layer/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-rpc-layer" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | alloy-rpc-types-engine.workspace = true 15 | 16 | http.workspace = true 17 | jsonrpsee-http-client.workspace = true 18 | pin-project.workspace = true 19 | tower.workspace = true 20 | 21 | tracing.workspace = true 22 | 23 | [dev-dependencies] 24 | reqwest.workspace = true 25 | tokio = { workspace = true, features = ["macros"] } 26 | jsonrpsee = { workspace = true, features = ["server"] } 27 | -------------------------------------------------------------------------------- /crates/rpc/rpc-server-types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-rpc-server-types" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "RPC server types and constants" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | reth-errors.workspace = true 16 | reth-network-api.workspace = true 17 | reth-primitives.workspace = true 18 | reth-rpc-types.workspace = true 19 | 20 | 21 | # ethereum 22 | alloy-primitives.workspace = true 23 | 24 | # rpc 25 | jsonrpsee-core.workspace = true 26 | jsonrpsee-types.workspace = true 27 | 28 | # misc 29 | strum = { workspace = true, features = ["derive"] } 30 | serde = { workspace = true, features = ["derive"] } 31 | 32 | -------------------------------------------------------------------------------- /crates/rpc/rpc-server-types/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Reth RPC server types. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 9 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 10 | 11 | /// Common RPC constants. 12 | pub mod constants; 13 | pub mod result; 14 | 15 | mod module; 16 | pub use module::{RethRpcModule, RpcModuleSelection}; 17 | 18 | pub use result::ToRpcResult; 19 | -------------------------------------------------------------------------------- /crates/rpc/rpc-testing-util/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-rpc-api-testing-util" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Reth RPC testing helpers" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-primitives.workspace = true 17 | reth-rpc-types.workspace = true 18 | reth-rpc-api = { workspace = true, features = ["client"] } 19 | 20 | # async 21 | futures.workspace = true 22 | 23 | # misc 24 | jsonrpsee = { workspace = true, features = ["client", "async-client"] } 25 | serde_json.workspace = true 26 | 27 | # assertions 28 | similar-asserts.workspace = true 29 | 30 | [dev-dependencies] 31 | tokio = { workspace = true, features = ["rt-multi-thread", "macros", "rt"] } 32 | reth-rpc-eth-api.workspace = true 33 | jsonrpsee-http-client.workspace = true 34 | -------------------------------------------------------------------------------- /crates/rpc/rpc-testing-util/assets/noop-tracer.js: -------------------------------------------------------------------------------- 1 | { 2 | // required function that is invoked when a step fails 3 | fault: function(log, db) { }, 4 | // required function that returns the result of the tracer: empty object 5 | result: function(ctx, db) { return {}; }, 6 | // optional function that is invoked for every opcode 7 | step: function(log, db) { } 8 | } -------------------------------------------------------------------------------- /crates/rpc/rpc-testing-util/assets/tracer-template.js: -------------------------------------------------------------------------------- 1 | { 2 | // called once 3 | setup: function(cfg) { 4 | // 5 | }, 6 | // required function that is invoked when a step fails 7 | fault: function(log, db) { 8 | // 9 | }, 10 | // required function that returns the result of the tracer: empty object 11 | result: function(ctx, db) { 12 | // 13 | }, 14 | // optional function that is invoked for every opcode 15 | step: function(log, db) { 16 | // 17 | }, 18 | enter: function(frame) { 19 | // 20 | }, 21 | exit: function(res) { 22 | // 23 | } 24 | } -------------------------------------------------------------------------------- /crates/rpc/rpc-testing-util/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Reth RPC testing utilities. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | pub mod debug; 12 | pub mod trace; 13 | 14 | pub mod utils; 15 | -------------------------------------------------------------------------------- /crates/rpc/rpc-testing-util/src/utils.rs: -------------------------------------------------------------------------------- 1 | //! Utils for testing RPC. 2 | 3 | /// This will read the value of the given environment variable and parse it as a URL. 4 | /// 5 | /// If the value has no http(s) scheme, it will be appended: `http://{var}`. 6 | pub fn parse_env_url(var: &str) -> Result { 7 | let var = std::env::var(var)?; 8 | if var.starts_with("http") { 9 | Ok(var) 10 | } else { 11 | Ok(format!("http://{var}")) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /crates/rpc/rpc-testing-util/tests/it/main.rs: -------------------------------------------------------------------------------- 1 | mod trace; 2 | 3 | const fn main() {} 4 | -------------------------------------------------------------------------------- /crates/rpc/rpc-types-compat/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-rpc-types-compat" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Compatibility layer for reth-primitives and ethereum RPC types" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | reth-primitives.workspace = true 16 | reth-rpc-types.workspace = true 17 | reth-trie-common.workspace = true 18 | alloy-rlp.workspace = true 19 | alloy-rpc-types.workspace = true 20 | 21 | [dev-dependencies] 22 | serde_json.workspace = true 23 | 24 | [features] 25 | optimism = ["reth-primitives/optimism"] 26 | -------------------------------------------------------------------------------- /crates/rpc/rpc-types-compat/src/engine/mod.rs: -------------------------------------------------------------------------------- 1 | //! Standalone functions for engine specific rpc type conversions 2 | pub mod payload; 3 | pub use payload::{block_to_payload_v1, try_into_sealed_block, try_payload_v1_to_block}; 4 | -------------------------------------------------------------------------------- /crates/rpc/rpc-types-compat/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Reth compatibility and utils for RPC types 2 | //! 3 | //! This crate various helper functions to convert between reth primitive types and rpc types. 4 | 5 | #![doc( 6 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 7 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 8 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 9 | )] 10 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 11 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 12 | 13 | pub mod block; 14 | pub mod engine; 15 | pub mod proof; 16 | pub mod transaction; 17 | -------------------------------------------------------------------------------- /crates/rpc/rpc-types/src/eth/error.rs: -------------------------------------------------------------------------------- 1 | //! Implementation specific Errors for the `eth_` namespace. 2 | 3 | /// A trait to convert an error to an RPC error. 4 | #[cfg(feature = "jsonrpsee-types")] 5 | pub trait ToRpcError: std::error::Error + Send + Sync + 'static { 6 | /// Converts the error to a JSON-RPC error object. 7 | fn to_rpc_error(&self) -> jsonrpsee_types::ErrorObject<'static>; 8 | } 9 | 10 | #[cfg(feature = "jsonrpsee-types")] 11 | impl ToRpcError for jsonrpsee_types::ErrorObject<'static> { 12 | fn to_rpc_error(&self) -> jsonrpsee_types::ErrorObject<'static> { 13 | self.clone() 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /crates/rpc/rpc-types/src/eth/mod.rs: -------------------------------------------------------------------------------- 1 | //! Ethereum related types 2 | 3 | pub(crate) mod error; 4 | pub mod transaction; 5 | 6 | // re-export 7 | #[cfg(feature = "jsonrpsee-types")] 8 | pub use alloy_rpc_types_engine as engine; 9 | -------------------------------------------------------------------------------- /crates/rpc/rpc-types/src/eth/transaction/mod.rs: -------------------------------------------------------------------------------- 1 | //! RPC types for transactions 2 | mod request; 3 | mod typed; 4 | pub use request::TransactionRequest; 5 | pub use typed::*; 6 | -------------------------------------------------------------------------------- /crates/rpc/rpc-types/src/eth/transaction/request.rs: -------------------------------------------------------------------------------- 1 | pub use alloy_rpc_types::request::TransactionRequest; 2 | -------------------------------------------------------------------------------- /crates/rpc/rpc/src/eth/helpers/block.rs: -------------------------------------------------------------------------------- 1 | //! Contains RPC handler implementations specific to blocks. 2 | 3 | use reth_provider::{BlockReaderIdExt, HeaderProvider}; 4 | use reth_rpc_eth_api::helpers::{EthBlocks, LoadBlock, LoadPendingBlock, SpawnBlocking}; 5 | use reth_rpc_eth_types::EthStateCache; 6 | 7 | use crate::EthApi; 8 | 9 | impl EthBlocks for EthApi 10 | where 11 | Self: LoadBlock, 12 | Provider: HeaderProvider, 13 | { 14 | #[inline] 15 | fn provider(&self) -> impl HeaderProvider { 16 | self.inner.provider() 17 | } 18 | } 19 | 20 | impl LoadBlock for EthApi 21 | where 22 | Self: LoadPendingBlock + SpawnBlocking, 23 | Provider: BlockReaderIdExt, 24 | { 25 | #[inline] 26 | fn provider(&self) -> impl BlockReaderIdExt { 27 | self.inner.provider() 28 | } 29 | 30 | #[inline] 31 | fn cache(&self) -> &EthStateCache { 32 | self.inner.cache() 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /crates/rpc/rpc/src/eth/helpers/call.rs: -------------------------------------------------------------------------------- 1 | //! Contains RPC handler implementations specific to endpoints that call/execute within evm. 2 | 3 | use reth_evm::ConfigureEvm; 4 | use reth_rpc_eth_api::helpers::{Call, EthCall, LoadPendingBlock, LoadState, SpawnBlocking}; 5 | 6 | use crate::EthApi; 7 | 8 | impl EthCall for EthApi where 9 | Self: Call + LoadPendingBlock 10 | { 11 | } 12 | 13 | impl Call for EthApi 14 | where 15 | Self: LoadState + SpawnBlocking, 16 | EvmConfig: ConfigureEvm, 17 | { 18 | #[inline] 19 | fn call_gas_limit(&self) -> u64 { 20 | self.inner.gas_cap() 21 | } 22 | 23 | #[inline] 24 | fn evm_config(&self) -> &impl ConfigureEvm { 25 | self.inner.evm_config() 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /crates/rpc/rpc/src/eth/helpers/mod.rs: -------------------------------------------------------------------------------- 1 | //! The entire implementation of the namespace is quite large, hence it is divided across several 2 | //! files. 3 | 4 | pub mod signer; 5 | 6 | mod block; 7 | mod call; 8 | mod fees; 9 | mod pending_block; 10 | mod receipt; 11 | mod spec; 12 | mod state; 13 | mod trace; 14 | mod transaction; 15 | -------------------------------------------------------------------------------- /crates/rpc/rpc/src/eth/helpers/receipt.rs: -------------------------------------------------------------------------------- 1 | //! Builds an RPC receipt response w.r.t. data layout of network. 2 | 3 | use reth_rpc_eth_api::helpers::LoadReceipt; 4 | use reth_rpc_eth_types::EthStateCache; 5 | 6 | use crate::EthApi; 7 | 8 | impl LoadReceipt for EthApi 9 | where 10 | Self: Send + Sync, 11 | { 12 | #[inline] 13 | fn cache(&self) -> &EthStateCache { 14 | self.inner.cache() 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /crates/rpc/rpc/src/eth/helpers/trace.rs: -------------------------------------------------------------------------------- 1 | //! Contains RPC handler implementations specific to tracing. 2 | 3 | use reth_evm::ConfigureEvm; 4 | use reth_rpc_eth_api::helpers::{LoadState, Trace}; 5 | 6 | use crate::EthApi; 7 | 8 | impl Trace for EthApi 9 | where 10 | Self: LoadState, 11 | EvmConfig: ConfigureEvm, 12 | { 13 | #[inline] 14 | fn evm_config(&self) -> &impl ConfigureEvm { 15 | self.inner.evm_config() 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /crates/rpc/rpc/src/eth/mod.rs: -------------------------------------------------------------------------------- 1 | //! Sever implementation of `eth` namespace API. 2 | 3 | pub mod bundle; 4 | pub mod core; 5 | pub mod filter; 6 | pub mod helpers; 7 | pub mod pubsub; 8 | 9 | /// Implementation of `eth` namespace API. 10 | pub use bundle::EthBundle; 11 | pub use core::EthApi; 12 | pub use filter::EthFilter; 13 | pub use pubsub::EthPubSub; 14 | 15 | pub use helpers::signer::DevSigner; 16 | 17 | pub use reth_rpc_eth_api::{EthApiServer, RawTransactionForwarder}; 18 | -------------------------------------------------------------------------------- /crates/rpc/rpc/src/rpc.rs: -------------------------------------------------------------------------------- 1 | use jsonrpsee::core::RpcResult; 2 | use reth_rpc_api::RpcApiServer; 3 | use reth_rpc_types::RpcModules; 4 | use std::{collections::HashMap, sync::Arc}; 5 | 6 | /// `rpc` API implementation. 7 | /// 8 | /// This type provides the functionality for handling `rpc` requests 9 | #[derive(Debug, Clone, Default)] 10 | pub struct RPCApi { 11 | /// The implementation of the Arc api 12 | rpc_modules: Arc, 13 | } 14 | 15 | impl RPCApi { 16 | /// Return a new `RPCApi` struct, with given `module_map` 17 | pub fn new(module_map: HashMap) -> Self { 18 | Self { rpc_modules: Arc::new(RpcModules::new(module_map)) } 19 | } 20 | } 21 | 22 | impl RpcApiServer for RPCApi { 23 | fn rpc_modules(&self) -> RpcResult { 24 | Ok(self.rpc_modules.as_ref().clone()) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /crates/stages/api/docs/mermaid/pipeline.mmd: -------------------------------------------------------------------------------- 1 | graph TB 2 | Start[Start] 3 | Done[Done] 4 | Error[Error] 5 | subgraph Unwind 6 | StartUnwind(Unwind in reverse order of execution) 7 | UnwindStage(Unwind stage) 8 | NextStageToUnwind(Next stage) 9 | end 10 | subgraph Single loop 11 | RunLoop(Run loop) 12 | NextStage(Next stage) 13 | LoopDone(Loop done) 14 | subgraph Stage Execution 15 | Execute(Execute stage) 16 | end 17 | end 18 | Start --> RunLoop --> NextStage 19 | NextStage --> |No stages left| LoopDone 20 | NextStage --> |Next stage| Execute 21 | Execute --> |Not done| Execute 22 | Execute --> |Unwind requested| StartUnwind 23 | Execute --> |Done| NextStage 24 | Execute --> |Error| Error 25 | StartUnwind --> NextStageToUnwind 26 | NextStageToUnwind --> |Next stage| UnwindStage 27 | NextStageToUnwind --> |No stages left| RunLoop 28 | UnwindStage --> |Error| Error 29 | UnwindStage --> |Unwound| NextStageToUnwind 30 | LoopDone --> |Target block reached| Done 31 | LoopDone --> |Target block not reached| RunLoop 32 | -------------------------------------------------------------------------------- /crates/stages/api/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Staged syncing primitives for reth. 2 | //! 3 | //! ## Feature Flags 4 | //! 5 | //! - `test-utils`: Utilities for testing 6 | 7 | #![doc( 8 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 9 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 10 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 11 | )] 12 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 13 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 14 | 15 | mod error; 16 | mod metrics; 17 | mod pipeline; 18 | mod stage; 19 | #[cfg(any(test, feature = "test-utils"))] 20 | pub mod test_utils; 21 | mod util; 22 | 23 | pub use crate::metrics::*; 24 | pub use error::*; 25 | pub use pipeline::*; 26 | pub use stage::*; 27 | 28 | use aquamarine as _; 29 | 30 | // re-export the stages types for convenience 31 | pub use reth_stages_types::*; 32 | -------------------------------------------------------------------------------- /crates/stages/api/src/metrics/mod.rs: -------------------------------------------------------------------------------- 1 | mod listener; 2 | mod sync_metrics; 3 | 4 | pub use listener::{MetricEvent, MetricEventsSender, MetricsListener}; 5 | use sync_metrics::*; 6 | -------------------------------------------------------------------------------- /crates/stages/stages/benches/README.md: -------------------------------------------------------------------------------- 1 | # Stage Benchmarks 2 | 3 | Test vectors are automatically generated if they cannot be found. Furthermore, for certain stages you can link an external database to run the benchmarks. 4 | 5 | ## Usage 6 | 7 | It will run the normal criterion benchmark. 8 | ``` 9 | cargo bench --package reth-stages --bench criterion --features test-utils 10 | ``` 11 | 12 | It will generate a flamegraph report without running any criterion analysis. 13 | ``` 14 | cargo bench --package reth-stages --bench criterion --features test-utils -- --profile-time=2 15 | ``` 16 | Flamegraph reports can be find at `target/criterion/Stages/$STAGE_LABEL/profile/flamegraph.svg` 17 | 18 | 19 | ## External DB support 20 | To choose an external DB, just pass an environment variable to the `cargo bench` command. 21 | 22 | * Account Hashing Stage: `ACCOUNT_HASHING_DB=` -------------------------------------------------------------------------------- /crates/stages/stages/benches/setup/constants.rs: -------------------------------------------------------------------------------- 1 | #![allow(unreachable_pub)] 2 | pub const ACCOUNT_HASHING_DB: &str = "ACCOUNT_HASHING_DB"; 3 | -------------------------------------------------------------------------------- /crates/stages/stages/src/prelude.rs: -------------------------------------------------------------------------------- 1 | pub use crate::sets::{ 2 | DefaultStages, ExecutionStages, HashingStages, HistoryIndexingStages, OfflineStages, 3 | OnlineStages, 4 | }; 5 | -------------------------------------------------------------------------------- /crates/stages/stages/src/test_utils/mod.rs: -------------------------------------------------------------------------------- 1 | use reth_stages_api::StageId; 2 | 3 | #[cfg(test)] 4 | mod macros; 5 | #[cfg(test)] 6 | pub(crate) use macros::*; 7 | 8 | #[cfg(test)] 9 | mod runner; 10 | #[cfg(test)] 11 | pub(crate) use runner::{ 12 | ExecuteStageTestRunner, StageTestRunner, TestRunnerError, UnwindStageTestRunner, 13 | }; 14 | 15 | mod test_db; 16 | pub use test_db::{StorageKind, TestStageDB}; 17 | 18 | mod set; 19 | pub use set::TestStages; 20 | 21 | /// The test stage id 22 | pub const TEST_STAGE_ID: StageId = StageId::Other("TestStage"); 23 | -------------------------------------------------------------------------------- /crates/stages/stages/src/test_utils/set.rs: -------------------------------------------------------------------------------- 1 | use super::TEST_STAGE_ID; 2 | use crate::{StageSet, StageSetBuilder}; 3 | use reth_db_api::database::Database; 4 | use reth_stages_api::{test_utils::TestStage, ExecOutput, StageError, UnwindOutput}; 5 | use std::collections::VecDeque; 6 | 7 | #[derive(Default, Debug)] 8 | pub struct TestStages { 9 | exec_outputs: VecDeque>, 10 | unwind_outputs: VecDeque>, 11 | } 12 | 13 | impl TestStages { 14 | pub const fn new( 15 | exec_outputs: VecDeque>, 16 | unwind_outputs: VecDeque>, 17 | ) -> Self { 18 | Self { exec_outputs, unwind_outputs } 19 | } 20 | } 21 | 22 | impl StageSet for TestStages { 23 | fn builder(self) -> StageSetBuilder { 24 | StageSetBuilder::default().add_stage( 25 | TestStage::new(TEST_STAGE_ID) 26 | .with_exec(self.exec_outputs) 27 | .with_unwind(self.unwind_outputs), 28 | ) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /crates/stages/types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-stages-types" 3 | version.workspace = true 4 | edition.workspace = true 5 | homepage.workspace = true 6 | license.workspace = true 7 | repository.workspace = true 8 | rust-version.workspace = true 9 | description = "Commonly used types for stages usage in reth." 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | reth-codecs.workspace = true 16 | reth-trie-common.workspace = true 17 | alloy-primitives.workspace = true 18 | 19 | modular-bitfield.workspace = true 20 | bytes.workspace = true 21 | serde.workspace = true 22 | 23 | [dev-dependencies] 24 | arbitrary = { workspace = true, features = ["derive"] } 25 | proptest.workspace = true 26 | proptest-arbitrary-interop.workspace = true 27 | test-fuzz.workspace = true 28 | rand.workspace = true 29 | -------------------------------------------------------------------------------- /crates/static-file/static-file/src/event.rs: -------------------------------------------------------------------------------- 1 | use crate::StaticFileTargets; 2 | use std::time::Duration; 3 | 4 | /// An event emitted by a [`StaticFileProducer`][crate::StaticFileProducer]. 5 | #[derive(Debug, PartialEq, Eq, Clone)] 6 | pub enum StaticFileProducerEvent { 7 | /// Emitted when static file producer started running. 8 | Started { 9 | /// Targets that will be moved to static files 10 | targets: StaticFileTargets, 11 | }, 12 | /// Emitted when static file producer finished running. 13 | Finished { 14 | /// Targets that were moved to static files 15 | targets: StaticFileTargets, 16 | /// Time it took to run the static file producer 17 | elapsed: Duration, 18 | }, 19 | } 20 | -------------------------------------------------------------------------------- /crates/static-file/static-file/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Static file producer implementation. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 9 | 10 | mod event; 11 | pub mod segments; 12 | mod static_file_producer; 13 | 14 | pub use event::StaticFileProducerEvent; 15 | pub use static_file_producer::{ 16 | StaticFileProducer, StaticFileProducerInner, StaticFileProducerResult, 17 | StaticFileProducerWithResult, StaticFileTargets, 18 | }; 19 | 20 | // Re-export for convenience. 21 | pub use reth_static_file_types::*; 22 | -------------------------------------------------------------------------------- /crates/static-file/types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-static-file-types" 3 | version.workspace = true 4 | edition.workspace = true 5 | homepage.workspace = true 6 | license.workspace = true 7 | repository.workspace = true 8 | rust-version.workspace = true 9 | description = "Commonly used types for static file usage in reth." 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | alloy-primitives.workspace = true 16 | 17 | clap = { workspace = true, features = ["derive"], optional = true } 18 | derive_more.workspace = true 19 | serde = { workspace = true, features = ["derive"] } 20 | strum = { workspace = true, features = ["derive"] } 21 | 22 | [features] 23 | clap = ["dep:clap"] -------------------------------------------------------------------------------- /crates/static-file/types/src/compression.rs: -------------------------------------------------------------------------------- 1 | use strum::AsRefStr; 2 | 3 | /// Static File compression types. 4 | #[derive(Debug, Copy, Clone, Default, AsRefStr)] 5 | #[cfg_attr(feature = "clap", derive(clap::ValueEnum))] 6 | pub enum Compression { 7 | /// LZ4 compression algorithm. 8 | #[strum(serialize = "lz4")] 9 | Lz4, 10 | /// Zstandard (Zstd) compression algorithm. 11 | #[strum(serialize = "zstd")] 12 | Zstd, 13 | /// Zstandard (Zstd) compression algorithm with a dictionary. 14 | #[strum(serialize = "zstd-dict")] 15 | ZstdWithDictionary, 16 | /// No compression. 17 | #[strum(serialize = "uncompressed")] 18 | #[default] 19 | Uncompressed, 20 | } 21 | -------------------------------------------------------------------------------- /crates/storage/codecs/derive/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-codecs-derive" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | readme = "../README.md" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [lib] 15 | proc-macro = true 16 | 17 | [dependencies] 18 | convert_case = "0.6.0" 19 | proc-macro2.workspace = true 20 | quote.workspace = true 21 | syn.workspace = true 22 | 23 | [dev-dependencies] 24 | similar-asserts.workspace = true 25 | syn = { workspace = true, features = ["full", "extra-traits"] } 26 | -------------------------------------------------------------------------------- /crates/storage/codecs/src/alloy/mod.rs: -------------------------------------------------------------------------------- 1 | mod access_list; 2 | mod authorization_list; 3 | mod genesis_account; 4 | mod log; 5 | mod request; 6 | mod trie; 7 | mod txkind; 8 | mod withdrawal; 9 | -------------------------------------------------------------------------------- /crates/storage/db-api/src/common.rs: -------------------------------------------------------------------------------- 1 | use crate::{table::*, DatabaseError}; 2 | 3 | /// A key-value pair for table `T`. 4 | pub type KeyValue = (::Key, ::Value); 5 | 6 | /// A fallible key-value pair that may or may not exist. 7 | /// 8 | /// The `Result` represents that the operation might fail, while the `Option` represents whether or 9 | /// not the entry exists. 10 | pub type PairResult = Result>, DatabaseError>; 11 | 12 | /// A key-value pair coming from an iterator. 13 | /// 14 | /// The `Result` represents that the operation might fail, while the `Option` represents whether or 15 | /// not there is another entry. 16 | pub type IterPairResult = Option, DatabaseError>>; 17 | 18 | /// A value only result for table `T`. 19 | pub type ValueOnlyResult = Result::Value>, DatabaseError>; 20 | -------------------------------------------------------------------------------- /crates/storage/db-api/src/models/integer_list.rs: -------------------------------------------------------------------------------- 1 | //! Implements [`Compress`] and [`Decompress`] for [`IntegerList`] 2 | 3 | use crate::{ 4 | table::{Compress, Decompress}, 5 | DatabaseError, 6 | }; 7 | use reth_primitives_traits::IntegerList; 8 | 9 | impl Compress for IntegerList { 10 | type Compressed = Vec; 11 | 12 | fn compress(self) -> Self::Compressed { 13 | self.to_bytes() 14 | } 15 | fn compress_to_buf>(self, buf: &mut B) { 16 | self.to_mut_bytes(buf) 17 | } 18 | } 19 | 20 | impl Decompress for IntegerList { 21 | fn decompress>(value: B) -> Result { 22 | Self::from_bytes(value.as_ref()).map_err(|_| DatabaseError::Decode) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /crates/storage/db-common/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Common db operations 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | pub mod init; 12 | 13 | mod db_tool; 14 | pub use db_tool::*; 15 | -------------------------------------------------------------------------------- /crates/storage/db-models/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Models used in storage module 2 | 3 | /// Accounts 4 | pub mod accounts; 5 | pub use accounts::AccountBeforeTx; 6 | 7 | /// Blocks 8 | pub mod blocks; 9 | pub use blocks::StoredBlockBodyIndices; 10 | -------------------------------------------------------------------------------- /crates/storage/db/benches/README.md: -------------------------------------------------------------------------------- 1 | # DB Benchmarks 2 | 3 | ## Codecs 4 | 5 | Currently only benchmarking the encoding/decoding of `Header`. It can be benchmarked with two different codecs at the moment `main/scale` and `postcard`: 6 | 7 | ### Main/Scale: 8 | ```bash 9 | $ cargo bench --features bench 10 | ``` 11 | -------------------------------------------------------------------------------- /crates/storage/db/src/implementation/mod.rs: -------------------------------------------------------------------------------- 1 | #[cfg(feature = "mdbx")] 2 | pub(crate) mod mdbx; 3 | -------------------------------------------------------------------------------- /crates/storage/db/src/static_file/masks.rs: -------------------------------------------------------------------------------- 1 | use super::{ReceiptMask, TransactionMask}; 2 | use crate::{ 3 | add_static_file_mask, 4 | static_file::mask::{ColumnSelectorOne, ColumnSelectorTwo, HeaderMask}, 5 | HeaderTerminalDifficulties, RawValue, Receipts, Transactions, 6 | }; 7 | use reth_db_api::table::Table; 8 | use reth_primitives::{BlockHash, Header}; 9 | 10 | // HEADER MASKS 11 | add_static_file_mask!(HeaderMask, Header, 0b001); 12 | add_static_file_mask!(HeaderMask, ::Value, 0b010); 13 | add_static_file_mask!(HeaderMask, BlockHash, 0b100); 14 | add_static_file_mask!(HeaderMask, Header, BlockHash, 0b101); 15 | add_static_file_mask!(HeaderMask, ::Value, BlockHash, 0b110); 16 | 17 | // RECEIPT MASKS 18 | add_static_file_mask!(ReceiptMask, ::Value, 0b1); 19 | 20 | // TRANSACTION MASKS 21 | add_static_file_mask!(TransactionMask, ::Value, 0b1); 22 | add_static_file_mask!(TransactionMask, RawValue<::Value>, 0b1); 23 | -------------------------------------------------------------------------------- /crates/storage/db/src/tables/codecs/fuzz/inputs.rs: -------------------------------------------------------------------------------- 1 | //! Curates the input coming from the fuzzer for certain types. 2 | 3 | use reth_primitives_traits::IntegerList; 4 | use serde::{Deserialize, Serialize}; 5 | 6 | /// Makes sure that the list provided by the fuzzer is not empty and pre-sorted 7 | #[derive(Debug, Clone, Deserialize, Serialize, Default)] 8 | pub struct IntegerListInput(pub Vec); 9 | 10 | impl From for IntegerList { 11 | fn from(list: IntegerListInput) -> Self { 12 | let mut v = list.0; 13 | 14 | // Empty lists are not supported by `IntegerList`, so we want to skip these cases. 15 | if v.is_empty() { 16 | return vec![1u64].into() 17 | } 18 | v.sort(); 19 | v.into() 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /crates/storage/db/src/tables/codecs/mod.rs: -------------------------------------------------------------------------------- 1 | //! Integrates different codecs into `table::Encode` and `table::Decode`. 2 | 3 | pub mod fuzz; 4 | -------------------------------------------------------------------------------- /crates/storage/errors/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-storage-errors" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | 10 | [lints] 11 | workspace = true 12 | 13 | [dependencies] 14 | alloy-rlp.workspace = true 15 | reth-primitives.workspace = true 16 | reth-fs-util.workspace = true 17 | 18 | # misc 19 | derive_more.workspace = true 20 | 21 | [features] 22 | default = ["std"] 23 | std = [] -------------------------------------------------------------------------------- /crates/storage/errors/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Commonly used error types used when interacting with storage. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | #![cfg_attr(not(feature = "std"), no_std)] 11 | 12 | #[cfg(not(feature = "std"))] 13 | extern crate alloc; 14 | 15 | /// Database error 16 | pub mod db; 17 | 18 | /// Lockfile error 19 | pub mod lockfile; 20 | 21 | /// Provider error 22 | pub mod provider; 23 | 24 | /// Writer error 25 | pub mod writer; 26 | -------------------------------------------------------------------------------- /crates/storage/errors/src/lockfile.rs: -------------------------------------------------------------------------------- 1 | use reth_fs_util::FsPathError; 2 | 3 | #[cfg(not(feature = "std"))] 4 | use alloc::string::{String, ToString}; 5 | 6 | /// Storage lock error. 7 | #[derive(Debug, Clone, PartialEq, Eq, derive_more::Display)] 8 | pub enum StorageLockError { 9 | /// Write lock taken 10 | #[display("storage directory is currently in use as read-write by another process: PID {_0}")] 11 | Taken(usize), 12 | /// Indicates other unspecified errors. 13 | #[display("{_0}")] 14 | Other(String), 15 | } 16 | 17 | #[cfg(feature = "std")] 18 | impl std::error::Error for StorageLockError {} 19 | 20 | /// TODO: turn into variant once `ProviderError` 21 | impl From for StorageLockError { 22 | fn from(error: FsPathError) -> Self { 23 | Self::Other(error.to_string()) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /crates/storage/libmdbx-rs/README.md: -------------------------------------------------------------------------------- 1 | # libmdbx-rs 2 | 3 | 4 | Rust bindings for [libmdbx](https://libmdbx.dqdkfa.ru). 5 | 6 | Forked from an earlier Apache licenced version of the `libmdbx-rs` crate, before it changed licence to GPL. 7 | NOTE: Most of the repo came from [lmdb-rs bindings](https://github.com/mozilla/lmdb-rs). 8 | 9 | ## Updating the libmdbx Version 10 | 11 | To update the libmdbx version you must clone it and copy the `dist/` folder in `mdbx-sys/`. 12 | Make sure to follow the [building steps](https://libmdbx.dqdkfa.ru/usage.html#getting). 13 | 14 | ```bash 15 | # clone libmmdbx to a repository outside at specific tag 16 | git clone https://gitflic.ru/project/erthink/libmdbx.git ../libmdbx --branch v0.7.0 17 | make -C ../libmdbx dist 18 | 19 | # copy the `libmdbx/dist/` folder just created into `mdbx-sys/libmdbx` 20 | rm -rf mdbx-sys/libmdbx 21 | cp -R ../libmdbx/dist mdbx-sys/libmdbx 22 | 23 | # add the changes to the next commit you will make 24 | git add mdbx-sys/libmdbx 25 | ``` 26 | -------------------------------------------------------------------------------- /crates/storage/libmdbx-rs/benches/utils.rs: -------------------------------------------------------------------------------- 1 | #![allow(unreachable_pub)] 2 | use reth_libmdbx::{Environment, WriteFlags}; 3 | use tempfile::{tempdir, TempDir}; 4 | 5 | pub fn get_key(n: u32) -> String { 6 | format!("key{n}") 7 | } 8 | 9 | pub fn get_data(n: u32) -> String { 10 | format!("data{n}") 11 | } 12 | 13 | pub fn setup_bench_db(num_rows: u32) -> (TempDir, Environment) { 14 | let dir = tempdir().unwrap(); 15 | let env = Environment::builder().open(dir.path()).unwrap(); 16 | 17 | { 18 | let txn = env.begin_rw_txn().unwrap(); 19 | let db = txn.open_db(None).unwrap(); 20 | for i in 0..num_rows { 21 | txn.put(db.dbi(), get_key(i), get_data(i), WriteFlags::empty()).unwrap(); 22 | } 23 | txn.commit().unwrap(); 24 | } 25 | (dir, env) 26 | } 27 | -------------------------------------------------------------------------------- /crates/storage/libmdbx-rs/mdbx-sys/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-mdbx-sys" 3 | description = "Raw bindings for libmdbx" 4 | version.workspace = true 5 | edition.workspace = true 6 | rust-version.workspace = true 7 | license = "Apache-2.0" 8 | homepage.workspace = true 9 | repository.workspace = true 10 | 11 | [build-dependencies] 12 | cc = "1.0" 13 | bindgen = { version = "0.69", default-features = false, features = ["runtime"] } 14 | -------------------------------------------------------------------------------- /crates/storage/libmdbx-rs/mdbx-sys/libmdbx/Makefile: -------------------------------------------------------------------------------- 1 | # This is thunk-Makefile for calling GNU Make 3.80 or above 2 | 3 | all help options \ 4 | clean install install-no-strip install-strip strip tools uninstall \ 5 | bench bench-clean bench-couple bench-quartet bench-triplet re-bench \ 6 | lib libs lib-static lib-shared tools-static \ 7 | libmdbx mdbx mdbx_chk mdbx_copy mdbx_drop mdbx_dump mdbx_load mdbx_stat \ 8 | check dist memcheck cross-gcc cross-qemu doxygen gcc-analyzer reformat \ 9 | release-assets tags test build-test mdbx_test smoke smoke-fault smoke-singleprocess \ 10 | smoke-assertion test-assertion long-test-assertion \ 11 | test-asan test-leak test-singleprocess test-ubsan test-valgrind: 12 | @CC=$(CC) \ 13 | CXX=`if test -n "$(CXX)" && which "$(CXX)" > /dev/null; then echo "$(CXX)"; elif test -n "$(CCC)" && which "$(CCC)" > /dev/null; then echo "$(CCC)"; else echo "c++"; fi` \ 14 | `which gmake || which gnumake || echo 'echo "GNU Make 3.80 or above is required"; exit 2;'` \ 15 | $(MAKEFLAGS) -f GNUmakefile $@ 16 | -------------------------------------------------------------------------------- /crates/storage/libmdbx-rs/mdbx-sys/libmdbx/VERSION.txt: -------------------------------------------------------------------------------- 1 | 0.12.10.52 2 | -------------------------------------------------------------------------------- /crates/storage/libmdbx-rs/mdbx-sys/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! [`libmdbx`](https://github.com/erthink/libmdbx) bindings. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![allow(non_upper_case_globals, non_camel_case_types, non_snake_case, clippy::all)] 10 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 11 | 12 | include!(concat!(env!("OUT_DIR"), "/bindings.rs")); 13 | -------------------------------------------------------------------------------- /crates/storage/provider/src/bundle_state/mod.rs: -------------------------------------------------------------------------------- 1 | //! Bundle state module. 2 | //! This module contains all the logic related to bundle state. 3 | 4 | mod state_reverts; 5 | pub use state_reverts::StorageRevertsIter; 6 | -------------------------------------------------------------------------------- /crates/storage/provider/src/providers/state/mod.rs: -------------------------------------------------------------------------------- 1 | //! [`StateProvider`](crate::StateProvider) implementations 2 | pub(crate) mod historical; 3 | pub(crate) mod latest; 4 | pub(crate) mod macros; 5 | -------------------------------------------------------------------------------- /crates/storage/provider/src/traits/database_provider.rs: -------------------------------------------------------------------------------- 1 | use crate::DatabaseProviderRO; 2 | use reth_db_api::database::Database; 3 | use reth_storage_errors::provider::ProviderResult; 4 | 5 | /// Database provider factory. 6 | pub trait DatabaseProviderFactory { 7 | /// Create new read-only database provider. 8 | fn database_provider_ro(&self) -> ProviderResult>; 9 | } 10 | -------------------------------------------------------------------------------- /crates/storage/provider/src/traits/finalized_block.rs: -------------------------------------------------------------------------------- 1 | use reth_errors::ProviderResult; 2 | use reth_primitives::BlockNumber; 3 | 4 | /// Functionality to read the last known finalized block from the database. 5 | pub trait FinalizedBlockReader: Send + Sync { 6 | /// Returns the last finalized block number. 7 | /// 8 | /// If no finalized block has been written yet, this returns `None`. 9 | fn last_finalized_block_number(&self) -> ProviderResult>; 10 | } 11 | 12 | /// Functionality to write the last known finalized block to the database. 13 | pub trait FinalizedBlockWriter: Send + Sync { 14 | /// Saves the given finalized block number in the DB. 15 | fn save_finalized_block_number(&self, block_number: BlockNumber) -> ProviderResult<()>; 16 | } 17 | -------------------------------------------------------------------------------- /crates/storage/provider/src/traits/static_file_provider.rs: -------------------------------------------------------------------------------- 1 | use crate::providers::StaticFileProvider; 2 | 3 | /// Static file provider factory. 4 | pub trait StaticFileProviderFactory { 5 | /// Create new instance of static file provider. 6 | fn static_file_provider(&self) -> StaticFileProvider; 7 | } 8 | -------------------------------------------------------------------------------- /crates/storage/provider/src/traits/stats.rs: -------------------------------------------------------------------------------- 1 | use reth_db_api::table::Table; 2 | use reth_storage_errors::provider::ProviderResult; 3 | 4 | /// The trait for fetching provider statistics. 5 | #[auto_impl::auto_impl(&, Arc)] 6 | pub trait StatsReader: Send + Sync { 7 | /// Fetch the number of entries in the corresponding [Table]. Depending on the provider, it may 8 | /// route to different data sources other than [Table]. 9 | fn count_entries(&self) -> ProviderResult; 10 | } 11 | -------------------------------------------------------------------------------- /crates/storage/provider/src/traits/tree_viewer.rs: -------------------------------------------------------------------------------- 1 | use crate::BlockchainTreePendingStateProvider; 2 | use reth_blockchain_tree_api::{BlockchainTreeEngine, BlockchainTreeViewer}; 3 | use reth_chain_state::CanonStateSubscriptions; 4 | 5 | /// Helper trait to combine all the traits we need for the `BlockchainProvider` 6 | /// 7 | /// This is a temporary solution 8 | pub trait TreeViewer: 9 | BlockchainTreeViewer 10 | + BlockchainTreePendingStateProvider 11 | + CanonStateSubscriptions 12 | + BlockchainTreeEngine 13 | { 14 | } 15 | 16 | impl TreeViewer for T where 17 | T: BlockchainTreeViewer 18 | + BlockchainTreePendingStateProvider 19 | + CanonStateSubscriptions 20 | + BlockchainTreeEngine 21 | { 22 | } 23 | -------------------------------------------------------------------------------- /crates/storage/provider/src/writer/database.rs: -------------------------------------------------------------------------------- 1 | use reth_db::{ 2 | cursor::{DbCursorRO, DbCursorRW}, 3 | tables, 4 | }; 5 | use reth_errors::ProviderResult; 6 | use reth_primitives::{BlockNumber, Receipt, TxNumber}; 7 | use reth_storage_api::ReceiptWriter; 8 | 9 | pub(crate) struct DatabaseWriter<'a, W>(pub(crate) &'a mut W); 10 | 11 | impl<'a, W> ReceiptWriter for DatabaseWriter<'a, W> 12 | where 13 | W: DbCursorRO + DbCursorRW, 14 | { 15 | fn append_block_receipts( 16 | &mut self, 17 | first_tx_index: TxNumber, 18 | _: BlockNumber, 19 | receipts: Vec>, 20 | ) -> ProviderResult<()> { 21 | if !receipts.is_empty() { 22 | for (tx_idx, receipt) in receipts.into_iter().enumerate() { 23 | if let Some(receipt) = receipt { 24 | self.0.append(first_tx_index + tx_idx as u64, receipt)?; 25 | } 26 | } 27 | } 28 | Ok(()) 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /crates/storage/storage-api/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-storage-api" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Reth storage provider traits and types" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | # reth 16 | reth-chainspec.workspace = true 17 | reth-db-models.workspace = true 18 | reth-execution-types.workspace = true 19 | reth-primitives.workspace = true 20 | reth-prune-types.workspace = true 21 | reth-stages-types.workspace = true 22 | reth-storage-errors.workspace = true 23 | reth-trie.workspace = true 24 | 25 | revm.workspace = true 26 | 27 | auto_impl.workspace = true 28 | -------------------------------------------------------------------------------- /crates/storage/storage-api/src/prune_checkpoint.rs: -------------------------------------------------------------------------------- 1 | use reth_prune_types::{PruneCheckpoint, PruneSegment}; 2 | use reth_storage_errors::provider::ProviderResult; 3 | 4 | /// The trait for fetching prune checkpoint related data. 5 | #[auto_impl::auto_impl(&, Arc)] 6 | pub trait PruneCheckpointReader: Send + Sync { 7 | /// Fetch the prune checkpoint for the given segment. 8 | fn get_prune_checkpoint( 9 | &self, 10 | segment: PruneSegment, 11 | ) -> ProviderResult>; 12 | 13 | /// Fetch all the prune checkpoints. 14 | fn get_prune_checkpoints(&self) -> ProviderResult>; 15 | } 16 | 17 | /// The trait for updating prune checkpoint related data. 18 | #[auto_impl::auto_impl(&, Arc)] 19 | pub trait PruneCheckpointWriter: Send + Sync { 20 | /// Save prune checkpoint. 21 | fn save_prune_checkpoint( 22 | &self, 23 | segment: PruneSegment, 24 | checkpoint: PruneCheckpoint, 25 | ) -> ProviderResult<()>; 26 | } 27 | -------------------------------------------------------------------------------- /crates/storage/storage-api/src/requests.rs: -------------------------------------------------------------------------------- 1 | use reth_primitives::{BlockHashOrNumber, Requests}; 2 | use reth_storage_errors::provider::ProviderResult; 3 | 4 | /// Client trait for fetching EIP-7685 [Requests] for blocks. 5 | #[auto_impl::auto_impl(&, Arc)] 6 | pub trait RequestsProvider: Send + Sync { 7 | /// Get withdrawals by block id. 8 | fn requests_by_block( 9 | &self, 10 | id: BlockHashOrNumber, 11 | timestamp: u64, 12 | ) -> ProviderResult>; 13 | } 14 | -------------------------------------------------------------------------------- /crates/storage/storage-api/src/withdrawals.rs: -------------------------------------------------------------------------------- 1 | use reth_primitives::{BlockHashOrNumber, Withdrawal, Withdrawals}; 2 | use reth_storage_errors::provider::ProviderResult; 3 | 4 | /// Client trait for fetching [Withdrawal] related data. 5 | #[auto_impl::auto_impl(&, Arc)] 6 | pub trait WithdrawalsProvider: Send + Sync { 7 | /// Get withdrawals by block id. 8 | fn withdrawals_by_block( 9 | &self, 10 | id: BlockHashOrNumber, 11 | timestamp: u64, 12 | ) -> ProviderResult>; 13 | 14 | /// Get latest withdrawal from this block or earlier . 15 | fn latest_withdrawal(&self) -> ProviderResult>; 16 | } 17 | -------------------------------------------------------------------------------- /crates/tasks/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-tasks" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Task management" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | 16 | # async 17 | tokio = { workspace = true, features = ["sync", "rt"] } 18 | tracing-futures = "0.2" 19 | futures-util.workspace = true 20 | 21 | # metrics 22 | reth-metrics.workspace = true 23 | metrics.workspace = true 24 | 25 | # misc 26 | auto_impl.workspace = true 27 | tracing.workspace = true 28 | thiserror.workspace = true 29 | dyn-clone.workspace = true 30 | 31 | # feature `rayon` 32 | rayon = { workspace = true, optional = true } 33 | pin-project = { workspace = true, optional = true } 34 | 35 | [dev-dependencies] 36 | tokio = { workspace = true, features = ["sync", "rt", "rt-multi-thread", "time", "macros"] } 37 | 38 | [features] 39 | rayon = ["dep:rayon", "pin-project"] 40 | -------------------------------------------------------------------------------- /crates/tokio-util/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-tokio-util" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Additional utilities for working with Tokio in reth." 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | tracing.workspace = true 16 | 17 | # async 18 | tokio = { workspace = true, features = ["sync"] } 19 | tokio-stream = { workspace = true, features = ["sync"] } 20 | 21 | [dev-dependencies] 22 | tokio = { workspace = true, features = ["full", "macros"] } 23 | 24 | [features] 25 | time = ["tokio/time"] -------------------------------------------------------------------------------- /crates/tokio-util/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Event listeners 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | mod event_sender; 12 | mod event_stream; 13 | pub use event_sender::EventSender; 14 | pub use event_stream::EventStream; 15 | 16 | #[cfg(feature = "time")] 17 | pub mod ratelimit; 18 | -------------------------------------------------------------------------------- /crates/tracing/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-tracing" 3 | version.workspace = true 4 | edition.workspace = true 5 | rust-version.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "tracing helpers" 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | tracing.workspace = true 16 | tracing-subscriber = { version = "0.3", default-features = false, features = ["env-filter", "fmt", "json"] } 17 | tracing-appender.workspace = true 18 | tracing-journald = "0.3" 19 | tracing-logfmt = "0.3.3" 20 | rolling-file = "0.2.0" 21 | eyre.workspace = true 22 | clap = { workspace = true, features = ["derive"] } -------------------------------------------------------------------------------- /crates/tracing/src/test_tracer.rs: -------------------------------------------------------------------------------- 1 | use tracing_appender::non_blocking::WorkerGuard; 2 | use tracing_subscriber::EnvFilter; 3 | 4 | use crate::Tracer; 5 | 6 | /// Initializes a tracing subscriber for tests. 7 | /// 8 | /// The filter is configurable via `RUST_LOG`. 9 | /// 10 | /// # Note 11 | /// 12 | /// The subscriber will silently fail if it could not be installed. 13 | #[derive(Debug, Clone, Default)] 14 | #[non_exhaustive] 15 | pub struct TestTracer; 16 | 17 | impl Tracer for TestTracer { 18 | fn init(self) -> eyre::Result> { 19 | let _ = tracing_subscriber::fmt() 20 | .with_env_filter(EnvFilter::from_default_env()) 21 | .with_writer(std::io::stderr) 22 | .try_init(); 23 | Ok(None) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /crates/transaction-pool/docs/mermaid/txpool.mmd: -------------------------------------------------------------------------------- 1 | graph TB 2 | subgraph TxPool 3 | direction TB 4 | pool[(All Transactions)] 5 | subgraph Subpools 6 | direction TB 7 | B3[(Queued)] 8 | B1[(Pending)] 9 | B2[(Basefee)] 10 | B4[(Blob)] 11 | end 12 | end 13 | discard([discard]) 14 | production([Block Production]) 15 | new([New Block]) 16 | A[Incoming Tx] --> B[Validation] -->|insert| pool 17 | pool --> |if ready + blobfee too low| B4 18 | pool --> |if ready| B1 19 | pool --> |if ready + basfee too low| B2 20 | pool --> |nonce gap or lack of funds| B3 21 | pool --> |update| pool 22 | B1 --> |best| production 23 | B2 --> |worst| discard 24 | B3 --> |worst| discard 25 | B4 --> |worst| discard 26 | B1 --> |increased blob fee| B4 27 | B4 --> |decreased blob fee| B1 28 | B1 --> |increased base fee| B2 29 | B2 --> |decreased base fee| B1 30 | B3 --> |promote| B1 31 | B3 --> |promote| B2 32 | new --> |apply state changes| pool 33 | -------------------------------------------------------------------------------- /crates/transaction-pool/src/pool/size.rs: -------------------------------------------------------------------------------- 1 | //! Tracks a size value. 2 | 3 | use std::ops::{AddAssign, SubAssign}; 4 | 5 | /// Keeps track of accumulated size in bytes. 6 | /// 7 | /// Note: We do not assume that size tracking is always exact. Depending on the bookkeeping of the 8 | /// additions and subtractions the total size might be slightly off. Therefore, the underlying value 9 | /// is an `isize`, so that the value does not wrap. 10 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] 11 | pub struct SizeTracker(isize); 12 | 13 | impl SizeTracker { 14 | /// Reset the size tracker. 15 | pub fn reset(&mut self) { 16 | self.0 = 0; 17 | } 18 | } 19 | 20 | impl AddAssign for SizeTracker { 21 | fn add_assign(&mut self, rhs: usize) { 22 | self.0 += rhs as isize 23 | } 24 | } 25 | 26 | impl SubAssign for SizeTracker { 27 | fn sub_assign(&mut self, rhs: usize) { 28 | self.0 -= rhs as isize 29 | } 30 | } 31 | 32 | impl From for usize { 33 | fn from(value: SizeTracker) -> Self { 34 | value.0 as Self 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /crates/transaction-pool/src/pool/update.rs: -------------------------------------------------------------------------------- 1 | //! Support types for updating the pool. 2 | 3 | use crate::{identifier::TransactionId, pool::state::SubPool}; 4 | use reth_primitives::TxHash; 5 | 6 | /// A change of the transaction's location 7 | /// 8 | /// NOTE: this guarantees that `current` and `destination` differ. 9 | #[derive(Debug)] 10 | pub(crate) struct PoolUpdate { 11 | /// Internal tx id. 12 | pub(crate) id: TransactionId, 13 | /// Hash of the transaction. 14 | pub(crate) hash: TxHash, 15 | /// Where the transaction is currently held. 16 | pub(crate) current: SubPool, 17 | /// Where to move the transaction to. 18 | pub(crate) destination: Destination, 19 | } 20 | 21 | /// Where to move an existing transaction. 22 | #[derive(Debug)] 23 | pub(crate) enum Destination { 24 | /// Discard the transaction. 25 | Discard, 26 | /// Move transaction to pool 27 | Pool(SubPool), 28 | } 29 | -------------------------------------------------------------------------------- /crates/transaction-pool/tests/it/main.rs: -------------------------------------------------------------------------------- 1 | //! transaction-pool integration tests 2 | 3 | #[cfg(feature = "test-utils")] 4 | mod blobs; 5 | #[cfg(feature = "test-utils")] 6 | mod evict; 7 | #[cfg(feature = "test-utils")] 8 | mod listeners; 9 | #[cfg(feature = "test-utils")] 10 | mod pending; 11 | 12 | const fn main() {} 13 | -------------------------------------------------------------------------------- /crates/trie/common/src/hash_builder/mod.rs: -------------------------------------------------------------------------------- 1 | //! MPT hash builder implementation. 2 | 3 | mod state; 4 | pub use state::HashBuilderState; 5 | 6 | pub use alloy_trie::hash_builder::*; 7 | -------------------------------------------------------------------------------- /crates/trie/common/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Commonly used types for trie usage. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 9 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 10 | 11 | /// The implementation of hash builder. 12 | pub mod hash_builder; 13 | 14 | mod account; 15 | pub use account::TrieAccount; 16 | 17 | mod nibbles; 18 | pub use nibbles::{Nibbles, StoredNibbles, StoredNibblesSubKey}; 19 | 20 | mod storage; 21 | pub use storage::StorageTrieEntry; 22 | 23 | mod subnode; 24 | pub use subnode::StoredSubNode; 25 | 26 | mod proofs; 27 | #[cfg(any(test, feature = "test-utils"))] 28 | pub use proofs::triehash; 29 | pub use proofs::*; 30 | 31 | pub mod root; 32 | 33 | pub use alloy_trie::{nodes::*, proof, BranchNodeCompact, HashBuilder, TrieMask, EMPTY_ROOT_HASH}; 34 | -------------------------------------------------------------------------------- /crates/trie/db/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! An integration of [`reth-trie`] with [`reth-db`]. 2 | 3 | mod hashed_cursor; 4 | mod prefix_set; 5 | mod proof; 6 | mod state; 7 | mod storage; 8 | mod trie_cursor; 9 | mod witness; 10 | 11 | pub use hashed_cursor::{ 12 | DatabaseHashedAccountCursor, DatabaseHashedCursorFactory, DatabaseHashedStorageCursor, 13 | }; 14 | pub use prefix_set::PrefixSetLoader; 15 | pub use proof::DatabaseProof; 16 | pub use state::{DatabaseHashedPostState, DatabaseStateRoot}; 17 | pub use storage::{DatabaseHashedStorage, DatabaseStorageRoot}; 18 | pub use trie_cursor::{ 19 | DatabaseAccountTrieCursor, DatabaseStorageTrieCursor, DatabaseTrieCursorFactory, 20 | }; 21 | pub use witness::DatabaseTrieWitness; 22 | -------------------------------------------------------------------------------- /crates/trie/parallel/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Implementation of exotic state root computation approaches. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 9 | 10 | mod storage_root_targets; 11 | pub use storage_root_targets::StorageRootTargets; 12 | 13 | /// Parallel trie calculation stats. 14 | pub mod stats; 15 | 16 | /// Implementation of async state root computation. 17 | #[cfg(feature = "async")] 18 | pub mod async_root; 19 | 20 | /// Implementation of parallel state root computation. 21 | #[cfg(feature = "parallel")] 22 | pub mod parallel_root; 23 | 24 | /// Parallel state root metrics. 25 | #[cfg(feature = "metrics")] 26 | pub mod metrics; 27 | -------------------------------------------------------------------------------- /crates/trie/trie/testdata/proof-genesis.json: -------------------------------------------------------------------------------- 1 | {"config":{"chainId":12345,"homesteadBlock":0,"eip150Block":0,"eip155Block":0,"eip158Block":0,"byzantiumBlock":0,"constantinopleBlock":0,"petersburgBlock":0,"istanbulBlock":0,"berlinBlock":0,"londonBlock":0,"mergeNetsplitBlock":0,"terminalTotalDifficulty":0,"terminalTotalDifficultyPassed":true,"shanghaiTime":0},"alloc":{"0x2031f89b3ea8014eb51a78c316e42af3e0d7695f":{"balance":"0x270801d946c940000"},"0x33f0fc440b8477fcfbe9d0bf8649e7dea9baedb2":{"balance":"0x1"},"0x62b0dd4aab2b1a0a04e279e2b828791a10755528":{"balance":"0xf43fc2c04ee0000"},"0x1ed9b1dd266b607ee278726d324b855a093394a6":{"balance":"0x1aa535d3d0c0000"}},"coinbase":"0x0000000000000000000000000000000000000000","difficulty":"0x01","extraData":"","gasLimit":"0x17D7840","nonce":"0x1234","mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000","parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000","timestamp":"1695902100"} -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ## reth Contributor Documentation 2 | 3 | This directory contains documentation for contributors. 4 | 5 | - [Repository and Project Structure](./repo) 6 | - [Design](./design) 7 | - [Crates](./crates) 8 | 9 | ### Meta 10 | 11 | - [Workflow](./workflow.md): The lifecycle of PRs 12 | - [Releases](./release.md): How reth is released and when (for maintainers) -------------------------------------------------------------------------------- /docs/crates/README.md: -------------------------------------------------------------------------------- 1 | ## Crates 2 | 3 | A tour of the various crates that make up reth. 4 | 5 | - [`reth-db`](./db.md) 6 | - [`reth-discv4`](./discv4.md) 7 | - [`reth-eth-wire`](./eth-wire.md) 8 | - [`reth-network`](./network.md) 9 | - [`reth-stages`](./stages.md) 10 | -------------------------------------------------------------------------------- /docs/design/README.md: -------------------------------------------------------------------------------- 1 | ## Design 2 | 3 | Docs under this page contain some context on how we've iterated on the Reth design (still WIP, please contribute!): 4 | 5 | - [Database](./database.md) 6 | - Networking 7 | - [P2P](./p2p.md) 8 | - [Headers Downloader](./headers-downloader.md) 9 | - [Metrics](./metrics.md): Guidelines on metrics and traces. 10 | - [Review of Other Codebases](./review.md) 11 | -------------------------------------------------------------------------------- /docs/design/codecs.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/megaeth-labs/reth/29058ad7ee64d993de6c301a9d688002cb698f03/docs/design/codecs.md -------------------------------------------------------------------------------- /docs/design/p2p.md: -------------------------------------------------------------------------------- 1 | # P2P 2 | 3 | > Explanation of the [Reth P2P Stack](../../crates/net/p2p) design process 4 | 5 | * Our initial design exploration started in [#64](https://github.com/paradigmxyz/reth/issues/64), which focused on layering dependent subprotocols as generic async streams, then using those streams to construct higher level network abstractions. 6 | * Following the above design, we then implemented `P2PStream` and `EthStream`, corresponding to the `p2p` and `eth` subprotocol respectively. 7 | * The wire protocol used to decode messages in `EthStream` came from ethp2p, making it easy to get the full stack to work. 8 | -------------------------------------------------------------------------------- /docs/repo/README.md: -------------------------------------------------------------------------------- 1 | ## Repository and Project Structure 2 | 3 | ### Planning 4 | 5 | Documents on planning and process in the repository: what the labels mean, how issues are triaged, how a new release is cut and so on. 6 | 7 | - [Labels](./labels.md): Describes the labels in the repository. 8 | 9 | ### Structure 10 | 11 | - [Layout](./layout.md): Describes each of the crates in the repository and their function. 12 | - [CI](./ci.md): An overview of the CI workflows -------------------------------------------------------------------------------- /etc/.gitignore: -------------------------------------------------------------------------------- 1 | jwttoken 2 | -------------------------------------------------------------------------------- /etc/README.md: -------------------------------------------------------------------------------- 1 | ## Miscellaneous 2 | 3 | This directory contains miscellaneous files, such as example Grafana dashboards and Prometheus configuration. 4 | 5 | The files in this directory may undergo a lot of changes while reth is unstable, so do not expect them to necessarily be up to date. 6 | 7 | ### Overview 8 | 9 | - [**Prometheus**](./prometheus/prometheus.yml): An example Prometheus configuration. 10 | - [**Grafana**](./grafana/): Example Grafana dashboards & data sources. 11 | 12 | ### Docker Compose 13 | 14 | To run Reth, Grafana or Prometheus with Docker Compose, refer to the [docker docs](/book/installation/docker.md#using-docker-compose). 15 | 16 | ### Import Grafana dashboards 17 | 18 | Running Grafana in Docker makes it possible to import existing dashboards, refer to [docs on how to run only Grafana in Docker](/book/installation/docker.md#using-docker-compose#run-only-grafana-in-docker). -------------------------------------------------------------------------------- /etc/ethereum-metrics-exporter/config.yaml: -------------------------------------------------------------------------------- 1 | consensus: 2 | enabled: true 3 | url: "http://lighthouse:5052" 4 | name: "consensus-client" 5 | execution: 6 | enabled: true 7 | url: "http://reth:8545" 8 | name: "execution-client" 9 | modules: 10 | - "eth" 11 | - "net" 12 | - "web3" -------------------------------------------------------------------------------- /etc/generate-jwt.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Borrowed from EthStaker's prepare for the merge guide 3 | # See https://github.com/remyroy/ethstaker/blob/main/prepare-for-the-merge.md#configuring-a-jwt-token-file 4 | 5 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 6 | mkdir -p ${SCRIPT_DIR}/jwttoken 7 | if [[ ! -f ${SCRIPT_DIR}/jwttoken/jwt.hex ]] 8 | then 9 | openssl rand -hex 32 | tr -d "\n" | tee > ${SCRIPT_DIR}/jwttoken/jwt.hex 10 | else 11 | echo "${SCRIPT_DIR}/jwttoken/jwt.hex already exists!" 12 | fi 13 | -------------------------------------------------------------------------------- /etc/grafana/dashboards/dashboard.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | providers: 4 | - name: 'Folder' 5 | allowUiUpdates: true 6 | options: 7 | path: /etc/grafana/provisioning/dashboards 8 | -------------------------------------------------------------------------------- /etc/grafana/datasources/prometheus.yml: -------------------------------------------------------------------------------- 1 | apiVersion: 1 2 | 3 | datasources: 4 | - name: Prometheus 5 | type: prometheus 6 | access: proxy 7 | url: $PROMETHEUS_URL 8 | editable: true 9 | -------------------------------------------------------------------------------- /etc/prometheus/prometheus.yml: -------------------------------------------------------------------------------- 1 | scrape_configs: 2 | - job_name: reth 3 | metrics_path: "/" 4 | scrape_interval: 5s 5 | static_configs: 6 | - targets: ['reth:9001', 'localhost:9001', 'host.docker.internal:9001'] 7 | - job_name: ethereum-metrics-exporter 8 | metrics_path: "/metrics" 9 | scrape_interval: 5s 10 | static_configs: 11 | - targets: ['metrics-exporter:9091'] -------------------------------------------------------------------------------- /examples/beacon-api-sidecar-fetcher/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-beacon-api-sidecar-fetcher" 3 | version = "0.1.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth.workspace = true 10 | reth-node-ethereum.workspace = true 11 | 12 | alloy-rpc-types-beacon.workspace = true 13 | 14 | clap.workspace = true 15 | eyre.workspace = true 16 | futures-util.workspace = true 17 | reqwest.workspace = true 18 | serde_json.workspace = true 19 | serde.workspace = true 20 | thiserror.workspace = true 21 | -------------------------------------------------------------------------------- /examples/beacon-api-sse/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-beacon-api-sse" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth.workspace = true 10 | reth-node-ethereum.workspace = true 11 | 12 | alloy-rpc-types-beacon.workspace = true 13 | 14 | clap.workspace = true 15 | futures-util.workspace = true 16 | mev-share-sse = { version = "0.3.0", default-features = false } 17 | tokio = { workspace = true, features = ["time"] } 18 | tracing.workspace = true 19 | -------------------------------------------------------------------------------- /examples/bsc-p2p/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-bsc-p2p" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | reth-chainspec.workspace = true 12 | reth-discv4 = { workspace = true, features = ["test-utils"] } 13 | reth-network = { workspace = true, features = ["test-utils"] } 14 | reth-network-api.workspace = true 15 | reth-network-peers.workspace = true 16 | reth-primitives.workspace = true 17 | reth-tracing.workspace = true 18 | 19 | secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recovery"] } 20 | 21 | tokio.workspace = true 22 | tokio-stream.workspace = true 23 | 24 | serde_json.workspace = true 25 | -------------------------------------------------------------------------------- /examples/custom-dev-node/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-custom-dev-node" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | 9 | [dependencies] 10 | reth.workspace = true 11 | reth-chainspec.workspace = true 12 | reth-node-core.workspace = true 13 | reth-primitives.workspace = true 14 | reth-node-ethereum = { workspace = true, features = ["test-utils"] } 15 | futures-util.workspace = true 16 | 17 | eyre.workspace = true 18 | tokio.workspace = true 19 | serde_json.workspace = true 20 | -------------------------------------------------------------------------------- /examples/custom-engine-types/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-custom-engine-types" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth.workspace = true 10 | reth-chainspec.workspace = true 11 | reth-rpc-types.workspace = true 12 | reth-node-api.workspace = true 13 | reth-node-core.workspace = true 14 | reth-primitives.workspace = true 15 | reth-payload-builder.workspace = true 16 | reth-basic-payload-builder.workspace = true 17 | reth-ethereum-payload-builder.workspace = true 18 | reth-node-ethereum = { workspace = true, features = ["test-utils"] } 19 | reth-tracing.workspace = true 20 | alloy-genesis.workspace = true 21 | 22 | eyre.workspace = true 23 | tokio.workspace = true 24 | thiserror.workspace = true 25 | serde.workspace = true 26 | -------------------------------------------------------------------------------- /examples/custom-evm/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-custom-evm" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth.workspace = true 10 | reth-chainspec.workspace = true 11 | reth-evm-ethereum.workspace = true 12 | reth-node-api.workspace = true 13 | reth-node-core.workspace = true 14 | reth-primitives.workspace = true 15 | reth-node-ethereum = { workspace = true, features = ["test-utils"] } 16 | reth-tracing.workspace = true 17 | alloy-genesis.workspace = true 18 | 19 | eyre.workspace = true 20 | tokio.workspace = true 21 | -------------------------------------------------------------------------------- /examples/custom-inspector/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-custom-inspector" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth.workspace = true 10 | reth-node-ethereum.workspace = true 11 | reth-rpc-types.workspace = true 12 | clap = { workspace = true, features = ["derive"] } 13 | futures-util.workspace = true 14 | -------------------------------------------------------------------------------- /examples/custom-node-components/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-custom-node-components" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | 9 | [dependencies] 10 | reth.workspace = true 11 | reth-node-ethereum.workspace = true 12 | reth-transaction-pool.workspace = true 13 | reth-tracing.workspace = true 14 | 15 | eyre.workspace = true 16 | -------------------------------------------------------------------------------- /examples/custom-payload-builder/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-custom-payload-builder" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth.workspace = true 10 | reth-chainspec.workspace = true 11 | reth-primitives.workspace = true 12 | reth-node-api.workspace = true 13 | reth-basic-payload-builder.workspace = true 14 | reth-payload-builder.workspace = true 15 | reth-node-ethereum.workspace = true 16 | reth-ethereum-payload-builder.workspace = true 17 | 18 | tracing.workspace = true 19 | futures-util.workspace = true 20 | eyre.workspace = true 21 | -------------------------------------------------------------------------------- /examples/custom-rlpx-subprotocol/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-custom-rlpx-subprotocol" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | 9 | [dependencies] 10 | tokio = { workspace = true, features = ["full"] } 11 | futures.workspace = true 12 | reth-eth-wire.workspace = true 13 | reth-network.workspace = true 14 | reth-network-api.workspace = true 15 | reth-node-ethereum.workspace = true 16 | reth-provider = { workspace = true, features = ["test-utils"] } 17 | reth-primitives.workspace = true 18 | reth-rpc-types.workspace = true 19 | reth.workspace = true 20 | tokio-stream.workspace = true 21 | eyre.workspace = true 22 | rand.workspace = true 23 | tracing.workspace = true 24 | -------------------------------------------------------------------------------- /examples/custom-rlpx-subprotocol/src/subprotocol/mod.rs: -------------------------------------------------------------------------------- 1 | pub(crate) mod connection; 2 | pub(crate) mod protocol; 3 | -------------------------------------------------------------------------------- /examples/custom-rlpx-subprotocol/src/subprotocol/protocol/event.rs: -------------------------------------------------------------------------------- 1 | use crate::subprotocol::connection::CustomCommand; 2 | use reth_network::Direction; 3 | use reth_network_api::PeerId; 4 | use tokio::sync::mpsc; 5 | 6 | /// The events that can be emitted by our custom protocol. 7 | #[derive(Debug)] 8 | pub(crate) enum ProtocolEvent { 9 | Established { 10 | #[allow(dead_code)] 11 | direction: Direction, 12 | peer_id: PeerId, 13 | to_connection: mpsc::UnboundedSender, 14 | }, 15 | } 16 | -------------------------------------------------------------------------------- /examples/custom-rlpx-subprotocol/src/subprotocol/protocol/mod.rs: -------------------------------------------------------------------------------- 1 | pub(crate) mod event; 2 | pub(crate) mod handler; 3 | pub(crate) mod proto; 4 | -------------------------------------------------------------------------------- /examples/db-access/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-db-access" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | 9 | [dependencies] 10 | reth-chainspec.workspace = true 11 | reth-db.workspace = true 12 | reth-primitives.workspace = true 13 | reth-provider.workspace = true 14 | reth-rpc-types.workspace = true 15 | 16 | 17 | eyre.workspace = true 18 | -------------------------------------------------------------------------------- /examples/manual-p2p/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-manual-p2p" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth-chainspec.workspace = true 10 | reth-primitives.workspace = true 11 | reth-network.workspace = true 12 | reth-discv4.workspace = true 13 | reth-eth-wire.workspace = true 14 | reth-ecies.workspace = true 15 | reth-network-peers.workspace = true 16 | 17 | secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recovery"] } 18 | 19 | futures.workspace = true 20 | tokio.workspace = true 21 | 22 | eyre.workspace = true 23 | -------------------------------------------------------------------------------- /examples/network-txpool/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-network-txpool" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth-provider = { workspace = true, features = ["test-utils"] } 10 | eyre.workspace = true 11 | tokio.workspace = true 12 | reth-network.workspace = true 13 | reth-transaction-pool.workspace = true 14 | -------------------------------------------------------------------------------- /examples/network/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-network" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth-network.workspace = true 10 | reth-provider = { workspace = true, features = ["test-utils"] } 11 | futures.workspace = true 12 | tokio.workspace = true 13 | eyre.workspace = true 14 | -------------------------------------------------------------------------------- /examples/node-custom-rpc/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-node-custom-rpc" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth.workspace = true 10 | reth-transaction-pool.workspace = true 11 | reth-node-ethereum.workspace = true 12 | 13 | clap = { workspace = true, features = ["derive"] } 14 | jsonrpsee = { workspace = true, features = ["server", "macros"] } 15 | 16 | [dev-dependencies] 17 | tokio.workspace = true 18 | -------------------------------------------------------------------------------- /examples/node-event-hooks/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-node-event-hooks" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth.workspace = true 10 | reth-node-ethereum.workspace = true 11 | -------------------------------------------------------------------------------- /examples/polygon-p2p/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-polygon-p2p" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 9 | 10 | [dependencies] 11 | secp256k1 = { workspace = true, features = ["global-context", "rand-std", "recovery"] } 12 | tokio.workspace = true 13 | reth-network.workspace = true 14 | reth-chainspec.workspace = true 15 | reth-primitives.workspace = true 16 | serde_json.workspace = true 17 | reth-tracing.workspace = true 18 | tokio-stream.workspace = true 19 | reth-provider = { workspace = true, features = ["test-utils"] } 20 | reth-discv4 = { workspace = true, features = ["test-utils"] } 21 | -------------------------------------------------------------------------------- /examples/rpc-db/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-rpc-db" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | futures.workspace = true 10 | jsonrpsee.workspace = true 11 | reth.workspace = true 12 | reth-chainspec.workspace = true 13 | reth-db.workspace = true 14 | reth-db-api.workspace = true 15 | reth-node-ethereum.workspace = true 16 | reth-provider = { workspace = true, features = ["test-utils"] } 17 | tokio = { workspace = true, features = ["full"] } 18 | eyre.workspace = true 19 | -------------------------------------------------------------------------------- /examples/stateful-precompile/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-stateful-precompile" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth.workspace = true 10 | reth-chainspec.workspace = true 11 | reth-node-api.workspace = true 12 | reth-node-core.workspace = true 13 | reth-primitives.workspace = true 14 | reth-node-ethereum = { workspace = true, features = ["test-utils"] } 15 | reth-tracing.workspace = true 16 | alloy-genesis.workspace = true 17 | 18 | eyre.workspace = true 19 | parking_lot.workspace = true 20 | schnellru.workspace = true 21 | tokio.workspace = true 22 | -------------------------------------------------------------------------------- /examples/txpool-tracing/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "example-txpool-tracing" 3 | version = "0.0.0" 4 | publish = false 5 | edition.workspace = true 6 | license.workspace = true 7 | 8 | [dependencies] 9 | reth.workspace = true 10 | reth-node-ethereum.workspace = true 11 | clap = { workspace = true, features = ["derive"] } 12 | futures-util.workspace = true 13 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | reorder_imports = true 2 | imports_granularity = "Crate" 3 | use_small_heuristics = "Max" 4 | comment_width = 100 5 | wrap_comments = true 6 | binop_separator = "Back" 7 | trailing_comma = "Vertical" 8 | trailing_semicolon = false 9 | use_field_init_shorthand = true 10 | format_code_in_doc_comments = true 11 | doc_comment_code_block_width = 100 12 | -------------------------------------------------------------------------------- /testing/ef-tests/.gitignore: -------------------------------------------------------------------------------- 1 | ethereum-tests -------------------------------------------------------------------------------- /testing/ef-tests/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "ef-tests" 3 | version.workspace = true 4 | description = "EF testing support for reth." 5 | edition.workspace = true 6 | rust-version.workspace = true 7 | license.workspace = true 8 | homepage.workspace = true 9 | repository.workspace = true 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [features] 15 | ef-tests = [] 16 | asm-keccak = ["reth-primitives/asm-keccak"] 17 | 18 | [dependencies] 19 | reth-chainspec.workspace = true 20 | reth-primitives.workspace = true 21 | reth-db = { workspace = true, features = ["mdbx", "test-utils", "disable-lock"] } 22 | reth-db-api.workspace = true 23 | reth-provider = { workspace = true, features = ["test-utils"] } 24 | reth-stages.workspace = true 25 | reth-evm-ethereum.workspace = true 26 | 27 | alloy-rlp.workspace = true 28 | 29 | walkdir = "2.3.3" 30 | serde.workspace = true 31 | serde_json.workspace = true 32 | thiserror.workspace = true 33 | rayon.workspace = true 34 | -------------------------------------------------------------------------------- /testing/ef-tests/src/assert.rs: -------------------------------------------------------------------------------- 1 | //! Various assertion helpers. 2 | 3 | use crate::Error; 4 | use std::fmt::Debug; 5 | 6 | /// A helper like `assert_eq!` that instead returns `Err(Error::Assertion)` on failure. 7 | pub fn assert_equal(left: T, right: T, msg: &str) -> Result<(), Error> 8 | where 9 | T: PartialEq + Debug, 10 | { 11 | if left == right { 12 | Ok(()) 13 | } else { 14 | Err(Error::Assertion(format!("{msg}\n left `{left:?}`,\n right `{right:?}`"))) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /testing/ef-tests/src/cases/mod.rs: -------------------------------------------------------------------------------- 1 | //! Specific test case handler implementations. 2 | 3 | pub mod blockchain_test; 4 | -------------------------------------------------------------------------------- /testing/ef-tests/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Abstractions and runners for EF tests. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 9 | 10 | pub mod case; 11 | pub mod result; 12 | pub mod suite; 13 | 14 | pub mod assert; 15 | pub mod cases; 16 | pub mod models; 17 | 18 | pub use case::{Case, Cases}; 19 | pub use result::{CaseResult, Error}; 20 | pub use suite::Suite; 21 | -------------------------------------------------------------------------------- /testing/testing-utils/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "reth-testing-utils" 3 | description = "Testing utils for reth." 4 | version.workspace = true 5 | edition.workspace = true 6 | rust-version.workspace = true 7 | license.workspace = true 8 | homepage.workspace = true 9 | repository.workspace = true 10 | 11 | [lints] 12 | workspace = true 13 | 14 | [dependencies] 15 | reth-primitives = { workspace = true, features = ["secp256k1"] } 16 | 17 | alloy-eips.workspace = true 18 | alloy-genesis.workspace = true 19 | 20 | rand.workspace = true 21 | secp256k1 = { workspace = true, features = ["rand"] } 22 | -------------------------------------------------------------------------------- /testing/testing-utils/src/lib.rs: -------------------------------------------------------------------------------- 1 | //! Testing utilities. 2 | 3 | #![doc( 4 | html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", 5 | html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256", 6 | issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/" 7 | )] 8 | #![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))] 9 | #![cfg_attr(not(test), warn(unused_crate_dependencies))] 10 | 11 | pub mod genesis_allocator; 12 | 13 | pub use genesis_allocator::GenesisAllocator; 14 | 15 | pub mod generators; 16 | --------------------------------------------------------------------------------