Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,204 changes: 1,184 additions & 20 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ members = [
"crates/scroll-wire",
"crates/primitives",
"crates/l1",
"crates/database",
"crates/database/db",
"crates/database/migration",
"crates/indexer",
"crates/sequencer",
"crates/pipeline",
Expand Down Expand Up @@ -118,6 +119,7 @@ alloy-primitives = { version = "0.8.15", default-features = false }
alloy-rpc-types-engine = { version = "0.11.0", default-features = false }

# scroll-alloy
scroll-alloy-consensus = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api" }
scroll-alloy-rpc-types-engine = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api" }
scroll-alloy-provider = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api" }
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api" }
Expand All @@ -142,13 +144,15 @@ reth-scroll-primitives = { git = "https://github.com/scroll-tech/reth.git", bran
scroll-engine = { path = "crates/engine" }
scroll-indexer = { path = "crates/indexer" }
scroll-l1 = { path = "crates/l1" }
scroll-migration = { path = "crates/database/migration" }
scroll-network = { path = "crates/network" }
scroll-pipeline = { path = "crates/pipeline"}
scroll-primitives = { path = "crates/primitives" }
scroll-wire = { path = "crates/scroll-wire" }
rollup-node-manager = { path = "crates/node" }

# misc
arbitrary = { version = "1.3" }
eyre = "0.6"
futures = { version = "0.3", default-features = false }
secp256k1 = { version = "0.29", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion bin/bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ alloy-chains.workspace = true
alloy-rpc-types-engine.workspace = true

# scroll-alloy
scroll-alloy-consensus = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api" }
scroll-alloy-consensus.workspace = true
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api" }
scroll-alloy-rpc-types-engine= { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api" }
scroll-alloy-provider.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion bin/bridge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ mod import;
pub use import::BridgeBlockImport;

mod network;
pub use network::ScrollBridgeNetworkBuilder;
// pub use network::ScrollBridgeNetworkBuilder;
126 changes: 63 additions & 63 deletions bin/bridge/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,79 +13,79 @@ use scroll_network::NetworkManager as ScrollNetworkManager;
use scroll_wire::{ProtocolHandler, ScrollWireConfig};
use tracing::info;

/// The network builder for the eth-wire to scroll-wire bridge.
#[derive(Debug, Default)]
pub struct ScrollBridgeNetworkBuilder;
// The network builder for the eth-wire to scroll-wire bridge.
// #[derive(Debug, Default)]
// pub struct ScrollBridgeNetworkBuilder;

impl<Node, Pool> NetworkBuilder<Node, Pool> for ScrollBridgeNetworkBuilder
where
Node:
FullNodeTypes<Types: NodeTypes<ChainSpec = ScrollChainSpec, Primitives = ScrollPrimitives>>,
Pool: TransactionPool<
Transaction: PoolTransaction<
Consensus = TxTy<Node::Types>,
Pooled = scroll_alloy_consensus::ScrollPooledTransaction,
>,
> + Unpin
+ 'static,
{
type Primitives = reth_scroll_node::ScrollNetworkPrimitives;
// impl<Node, Pool> NetworkBuilder<Node, Pool> for ScrollBridgeNetworkBuilder
// where
// Node:
// FullNodeTypes<Types: NodeTypes<ChainSpec = ScrollChainSpec, Primitives =
// ScrollPrimitives>>, Pool: TransactionPool<
// Transaction: PoolTransaction<
// Consensus = TxTy<Node::Types>,
// Pooled = scroll_alloy_consensus::ScrollPooledTransaction,
// >,
// > + Unpin
// + 'static,
// {
// type Primitives = reth_scroll_node::ScrollNetworkPrimitives;

async fn build_network(
self,
ctx: &BuilderContext<Node>,
pool: Pool,
) -> eyre::Result<reth_network::NetworkHandle<Self::Primitives>> {
// Create a new block channel to bridge between eth-wire and scroll-wire protocols.
let (new_block_tx, new_block_rx) = tokio::sync::mpsc::unbounded_channel();
// async fn build_network(
// self,
// ctx: &BuilderContext<Node>,
// pool: Pool,
// ) -> eyre::Result<reth_network::NetworkHandle<Self::Primitives>> {
// // Create a new block channel to bridge between eth-wire and scroll-wire protocols.
// let (new_block_tx, new_block_rx) = tokio::sync::mpsc::unbounded_channel();

// Create a scroll-wire protocol handler.
let (scroll_wire_handler, events) = ProtocolHandler::new(ScrollWireConfig::new(true));
// // Create a scroll-wire protocol handler.
// let (scroll_wire_handler, events) = ProtocolHandler::new(ScrollWireConfig::new(true));

// Create the network configuration.
let config = ctx.network_config()?;
let mut config = NetworkConfig {
network_mode: NetworkMode::Work,
block_import: Box::new(super::BridgeBlockImport::new(new_block_tx.clone())),
..config
};
// // Create the network configuration.
// let config = ctx.network_config()?;
// let mut config = NetworkConfig {
// network_mode: NetworkMode::Work,
// block_import: Box::new(super::BridgeBlockImport::new(new_block_tx.clone())),
// ..config
// };

// Add the scroll-wire protocol handler to the network config.
config.extra_protocols.push(scroll_wire_handler);
// // Add the scroll-wire protocol handler to the network config.
// config.extra_protocols.push(scroll_wire_handler);

// Create the network manager.
let network = NetworkManager::<Self::Primitives>::builder(config).await?;
let handle = ctx.start_network(network, pool);
// // Create the network manager.
// let network = NetworkManager::<Self::Primitives>::builder(config).await?;
// let handle = ctx.start_network(network, pool);

// Create the scroll network manager.
let scroll_network_manager = ScrollNetworkManager::from_parts(handle.clone(), events);
// // Create the scroll network manager.
// let scroll_network_manager = ScrollNetworkManager::from_parts(handle.clone(), events);

// Spawn the scroll network manager.
let consensus = PoAConsensus::new(vec![]);
let payload_provider = NoopExecutionPayloadProvider;
// // Spawn the scroll network manager.
// let consensus = PoAConsensus::new(vec![]);
// let payload_provider = NoopExecutionPayloadProvider;

let auth_port = ctx.config().rpc.auth_port;
let auth_secret = ctx.config().rpc.auth_jwt_secret(ctx.config().datadir().jwt())?;
// let auth_port = ctx.config().rpc.auth_port;
// let auth_secret = ctx.config().rpc.auth_jwt_secret(ctx.config().datadir().jwt())?;

let engine_api = ScrollAuthEngineApiProvider::new(
auth_secret,
format!("http://localhost:{auth_port}").parse()?,
);
let engine = EngineDriver::new(engine_api, payload_provider);
// let engine_api = ScrollAuthEngineApiProvider::new(
// auth_secret,
// format!("http://localhost:{auth_port}").parse()?,
// );
// let engine = EngineDriver::new(engine_api, payload_provider);

let rollup_node_manager = RollupNodeManager::new(
scroll_network_manager,
engine,
ForkchoiceState::genesis(
ctx.config().chain.chain.try_into().expect("must be a named chain"),
),
consensus,
new_block_rx,
);
// // let rollup_node_manager = RollupNodeManager::new(
// // scroll_network_manager,
// // engine,
// // ForkchoiceState::genesis(
// // ctx.config().chain.chain.try_into().expect("must be a named chain"),
// // ),
// // consensus,
// // new_block_rx,
// // );

ctx.task_executor().spawn(rollup_node_manager);
// // ctx.task_executor().spawn(rollup_node_manager);

info!(target: "scroll::reth::cli", enode=%handle.local_node_record(), "P2P networking initialized");
Ok(handle)
}
}
// // info!(target: "scroll::reth::cli", enode=%handle.local_node_record(), "P2P networking
// // initialized"); Ok(handle)
// }
// }
Loading
Loading