diff --git a/Cargo.lock b/Cargo.lock index e14f5db80..50fa59f01 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2845,29 +2845,6 @@ dependencies = [ "pin-project-lite", ] -[[package]] -name = "examples" -version = "0.0.0" -dependencies = [ - "async-trait", - "eyre", - "futures", - "reth-beacon-consensus", - "reth-blockchain-tree", - "reth-db", - "reth-network", - "reth-network-api", - "reth-primitives", - "reth-provider", - "reth-revm", - "reth-rpc-builder", - "reth-rpc-types", - "reth-rpc-types-compat", - "reth-tasks", - "reth-transaction-pool", - "tokio", -] - [[package]] name = "exex-minimal" version = "0.0.0" @@ -5066,6 +5043,17 @@ dependencies = [ "unsigned-varint 0.7.2", ] +[[package]] +name = "network" +version = "0.0.0" +dependencies = [ + "eyre", + "futures", + "reth-network", + "reth-provider", + "tokio", +] + [[package]] name = "network-txpool" version = "0.0.0" diff --git a/Cargo.toml b/Cargo.toml index e66aa3413..7edc96312 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -72,7 +72,6 @@ members = [ "crates/transaction-pool/", "crates/trie/", "crates/trie-parallel/", - "examples/", "examples/node-custom-rpc/", "examples/beacon-api-sse/", "examples/node-event-hooks/", @@ -82,6 +81,7 @@ members = [ "examples/custom-dev-node/", "examples/custom-payload-builder/", "examples/manual-p2p/", + "examples/network/", "examples/network-txpool/", "examples/rpc-db/", "examples/txpool-tracing/", diff --git a/examples/Cargo.toml b/examples/Cargo.toml deleted file mode 100644 index 02c571786..000000000 --- a/examples/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -[package] -name = "examples" -version = "0.0.0" -publish = false -edition.workspace = true -license.workspace = true - -[dev-dependencies] -reth-primitives.workspace = true -reth-db.workspace = true -reth-provider.workspace = true -reth-rpc-builder.workspace = true -reth-rpc-types.workspace = true -reth-rpc-types-compat.workspace = true -reth-revm.workspace = true -reth-blockchain-tree.workspace = true -reth-beacon-consensus.workspace = true -reth-network-api.workspace = true -reth-network.workspace = true -reth-transaction-pool.workspace = true -reth-tasks.workspace = true - -eyre.workspace = true -futures.workspace = true -async-trait.workspace = true -tokio.workspace = true - -[[example]] -name = "network" -path = "network.rs" \ No newline at end of file diff --git a/examples/README.md b/examples/README.md index 574efe961..ea2c87c1b 100644 --- a/examples/README.md +++ b/examples/README.md @@ -10,16 +10,16 @@ to make a PR! ## Node Builder -| Example | Description | -|---------------------------------------------------------------| ------------------------------------------------------------------------------------------------ | -| [Additional RPC namespace](./node-custom-rpc) | Illustrates how to add custom CLI parameters and set up a custom RPC namespace | -| [Custom event hooks](./node-event-hooks) | Illustrates how to hook to various node lifecycle events | -| [Custom dev node](./custom-dev-node) | Illustrates how to run a custom dev node programmatically and submit a transaction to it via RPC | -| [Custom EVM](./custom-evm) | Illustrates how to implement a node with a custom EVM | -| [Custom inspector](./custom-inspector) | Illustrates how to use a custom EVM inspector to trace new transactions | -| [Custom engine types](./custom-engine-types) | Illustrates how to create a node with custom engine types | -| [Custom node components](./custom-node-components) | Illustrates how to configure custom node components | -| [Custom payload builder](./custom-payload-builder) | Illustrates how to use a custom payload builder | +| Example | Description | +| -------------------------------------------------- | ------------------------------------------------------------------------------------------------ | +| [Additional RPC namespace](./node-custom-rpc) | Illustrates how to add custom CLI parameters and set up a custom RPC namespace | +| [Custom event hooks](./node-event-hooks) | Illustrates how to hook to various node lifecycle events | +| [Custom dev node](./custom-dev-node) | Illustrates how to run a custom dev node programmatically and submit a transaction to it via RPC | +| [Custom EVM](./custom-evm) | Illustrates how to implement a node with a custom EVM | +| [Custom inspector](./custom-inspector) | Illustrates how to use a custom EVM inspector to trace new transactions | +| [Custom engine types](./custom-engine-types) | Illustrates how to create a node with custom engine types | +| [Custom node components](./custom-node-components) | Illustrates how to configure custom node components | +| [Custom payload builder](./custom-payload-builder) | Illustrates how to use a custom payload builder | ## ExEx @@ -36,22 +36,22 @@ to make a PR! ## Database -| Example | Description | -| --------------------------- | --------------------------------------------------------------- | +| Example | Description | +| ------------------------ | --------------------------------------------------------------- | | [DB access](./db-access) | Illustrates how to access Reth's database in a separate process | ## Network -| Example | Description | -| ---------------------------------- | ------------------------------------------------------------ | -| [Standalone network](./network.rs) | Illustrates how to use the network as a standalone component | +| Example | Description | +| ------------------------------- | ------------------------------------------------------------ | +| [Standalone network](./network) | Illustrates how to use the network as a standalone component | ## Mempool -| Example | Description | -|------------------------------------------------------| -------------------------------------------------------------------------------------------------------------------------- | +| Example | Description | +| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | | [Trace pending transactions](./txpool-tracing) | Illustrates how to trace pending transactions as they arrive in the mempool | -| [Standalone txpool](./network-txpool) | Illustrates how to use the network as a standalone component together with a transaction pool with a custom pool validator | +| [Standalone txpool](./network-txpool) | Illustrates how to use the network as a standalone component together with a transaction pool with a custom pool validator | ## P2P diff --git a/examples/network/Cargo.toml b/examples/network/Cargo.toml new file mode 100644 index 000000000..b3b740dd8 --- /dev/null +++ b/examples/network/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "network" +version = "0.0.0" +publish = false +edition.workspace = true +license.workspace = true + +[dependencies] +reth-network.workspace = true +reth-provider = { workspace = true, features = ["test-utils"] } +futures.workspace = true +tokio.workspace = true +eyre.workspace = true \ No newline at end of file diff --git a/examples/network.rs b/examples/network/src/main.rs similarity index 96% rename from examples/network.rs rename to examples/network/src/main.rs index 18bf5cbcf..16482ca1f 100644 --- a/examples/network.rs +++ b/examples/network/src/main.rs @@ -3,7 +3,7 @@ //! Run with //! //! ```not_rust -//! cargo run --example network +//! cargo run --release -p network //! ``` use futures::StreamExt;