Skip to content

Commit fb58c5e

Browse files
committed
commit updated code strucutre
1 parent 6d0fc65 commit fb58c5e

File tree

22 files changed

+330
-32
lines changed

22 files changed

+330
-32
lines changed

Cargo.lock

Lines changed: 45 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ members = [
1212
"crates/node",
1313
"crates/network",
1414
"crates/scroll-wire",
15-
"crates/primitives", "crates/l1", "crates/database"]
15+
"crates/primitives", "crates/l1", "crates/database", "crates/indexer", "crates/sequencer", "crates/pipeline", "crates/provider"]
1616

1717
resolver = "2"
1818

@@ -111,6 +111,7 @@ alloy-primitives = { version = "0.8.15", default-features = false }
111111
alloy-rpc-types-engine = { version = "0.11.0", default-features = false }
112112

113113
# scroll-alloy
114+
scroll-alloy-rpc-types-engine = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api" }
114115
scroll-alloy-provider = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api" }
115116
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api" }
116117

@@ -132,6 +133,8 @@ reth-scroll-primitives = { git = "https://github.com/scroll-tech/reth.git", bran
132133

133134
# rollup node
134135
scroll-engine = { path = "crates/engine" }
136+
scroll-indexer = { path = "crates/indexer" }
137+
scroll-l1 = { path = "crates/l1" }
135138
scroll-network = { path = "crates/network" }
136139
scroll-primitives = { path = "crates/primitives" }
137140
scroll-wire = { path = "crates/scroll-wire" }

crates/database/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1+
pub struct Database;

crates/engine/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ alloy-rpc-types-engine.workspace = true
1919
# scroll-alloy
2020
scroll-alloy-network.workspace = true
2121
scroll-alloy-provider.workspace = true
22-
scroll-alloy-rpc-types-engine = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api" }
22+
scroll-alloy-rpc-types-engine.workspace = true
2323

2424
# reth
2525
reth-engine-primitives = { git = "https://github.com/scroll-tech/reth.git", branch = "feat/add-deref-blanket-engine-api", default-features = false, features = ["scroll"] }

crates/indexer/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "scroll-indexer"
3+
version.workspace = true
4+
edition.workspace = true
5+
rust-version.workspace = true
6+
license.workspace = true
7+
exclude.workspace = true
8+
9+
[dependencies]
10+
# rollup-node
11+
scroll-l1.workspace = true
12+
scroll-primitives.workspace = true
13+
14+
[lints]
15+
workspace = true

crates/indexer/src/lib.rs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
//! A library responsible for indexing data relevant to the L1.
2+
3+
use scroll_l1::L1Event;
4+
use scroll_primitives::{BatchInput, L1Message};
5+
use std::sync::Arc;
6+
7+
/// The indexer is responsible for indexing data relevant to the L1.
8+
#[derive(Debug)]
9+
pub struct Indexer;
10+
11+
impl Indexer {
12+
/// Handles an event from the L1.
13+
pub async fn handle_l1_event(&mut self, event: L1Event) {
14+
match event {
15+
L1Event::CommitBatch(batch_input) => self.handle_batch_input(batch_input).await,
16+
L1Event::Reorg(block_number) => self.handle_reorg(block_number).await,
17+
L1Event::Finalized(block_number) => self.handle_finalized(block_number).await,
18+
L1Event::L1Message(l1_message) => self.handle_l1_message(l1_message).await,
19+
}
20+
}
21+
22+
async fn handle_reorg(&mut self, _block_number: u64) {
23+
todo!()
24+
}
25+
26+
async fn handle_finalized(&mut self, _block_number: u64) {
27+
todo!()
28+
}
29+
30+
async fn handle_l1_message(&mut self, _l1_message: Arc<L1Message>) {
31+
todo!()
32+
}
33+
34+
async fn handle_batch_input(&mut self, _batch_input: Arc<BatchInput>) {
35+
todo!()
36+
}
37+
}

crates/l1/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "l1"
2+
name = "scroll-l1"
33
version.workspace = true
44
edition.workspace = true
55
rust-version.workspace = true

crates/l1/src/constants.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ use alloy_primitives::{address, Address};
44

55
/// The address of the L1 Message Queue contract on mainnet.
66
pub const MAINNET_L1_MESSAGE_QUEUE_ADDRESS: Address =
7-
address!("00000000000000000000000000000000000");
7+
address!("0000000000000000000000000000000000000000");
88

99
/// The address of the Scroll Chain contract on mainnet.
1010
pub const MAINNET_L1_SCROLL_CHAIN_ADDRESS: Address =
11-
address!("00000000000000000000000000000000000");
11+
address!("0000000000000000000000000000000000000000");

crates/l1/src/event.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
use scroll_primitives::{BatchInput, L1Message};
2+
use std::sync::Arc;
3+
4+
/// An observation from the L1.
5+
#[derive(Debug)]
6+
pub enum L1Event {
7+
/// A new batch input has been committed to L1 with the given [`BatchInput`].
8+
CommitBatch(Arc<BatchInput>),
9+
/// A new [`L1Message`] has been added to the L1 message queue.
10+
L1Message(Arc<L1Message>),
11+
/// A reorg has occurred at the given block number.
12+
Reorg(u64),
13+
/// The L1 has been finalized at the given block number.
14+
Finalized(u64),
15+
}

crates/l1/src/indexer/mod.rs

Whitespace-only changes.

0 commit comments

Comments
 (0)