Skip to content

Commit ff96d5f

Browse files
authored
add transaction cache to L1 watcher (#433)
1 parent 81c904c commit ff96d5f

File tree

15 files changed

+153
-27
lines changed

15 files changed

+153
-27
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[workspace.package]
22
version = "0.0.1"
33
edition = "2021"
4-
rust-version = "1.82"
4+
rust-version = "1.83"
55
license = "MIT OR Apache-2.0"
66
exclude = [".github/"]
77

@@ -220,6 +220,7 @@ clap = { version = "4", features = ["derive", "env"] }
220220
derive_more = { version = "2.0", default-features = false }
221221
eyre = "0.6"
222222
futures = { version = "0.3", default-features = false }
223+
lru = "0.13.0"
223224
metrics = "0.24.0"
224225
metrics-derive = "0.1"
225226
parking_lot = "0.12"

crates/chain-orchestrator/src/sync.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ impl SyncState {
2626
}
2727

2828
/// Returns a mutable reference to the sync mode of L1.
29-
pub fn l1_mut(&mut self) -> &mut SyncMode {
29+
pub const fn l1_mut(&mut self) -> &mut SyncMode {
3030
&mut self.l1
3131
}
3232

3333
/// Returns a mutable reference to the sync mode of L2.
34-
pub fn l2_mut(&mut self) -> &mut SyncMode {
34+
pub const fn l2_mut(&mut self) -> &mut SyncMode {
3535
&mut self.l2
3636
}
3737

@@ -64,12 +64,12 @@ impl SyncMode {
6464
}
6565

6666
/// Sets the sync mode to [`SyncMode::Synced`].
67-
pub fn set_synced(&mut self) {
67+
pub const fn set_synced(&mut self) {
6868
*self = Self::Synced;
6969
}
7070

7171
/// Sets the sync mode to [`SyncMode::Syncing`].
72-
pub fn set_syncing(&mut self) {
72+
pub const fn set_syncing(&mut self) {
7373
*self = Self::Syncing;
7474
}
7575
}

crates/node/src/test_utils/block_builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl L1MessagesAssertion {
4949

5050
impl<'a> BlockBuilder<'a> {
5151
/// Create a new block builder.
52-
pub(crate) fn new(fixture: &'a mut TestFixture) -> Self {
52+
pub(crate) const fn new(fixture: &'a mut TestFixture) -> Self {
5353
Self {
5454
fixture,
5555
expected_tx_hashes: Vec::new(),

crates/node/src/test_utils/event_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub struct EventWaiter<'a> {
2222

2323
impl<'a> EventWaiter<'a> {
2424
/// Create a new multi-node event waiter.
25-
pub fn new(fixture: &'a mut TestFixture, node_indices: Vec<usize>) -> Self {
25+
pub const fn new(fixture: &'a mut TestFixture, node_indices: Vec<usize>) -> Self {
2626
Self { fixture, node_indices, timeout_duration: Duration::from_secs(30) }
2727
}
2828

crates/node/src/test_utils/fixture.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,17 @@ impl TestFixture {
135135
}
136136

137137
/// Start building a block using the sequencer.
138-
pub fn build_block(&mut self) -> BlockBuilder<'_> {
138+
pub const fn build_block(&mut self) -> BlockBuilder<'_> {
139139
BlockBuilder::new(self)
140140
}
141141

142142
/// Get L1 helper for managing L1 interactions.
143-
pub fn l1(&mut self) -> L1Helper<'_> {
143+
pub const fn l1(&mut self) -> L1Helper<'_> {
144144
L1Helper::new(self)
145145
}
146146

147147
/// Get transaction helper for creating and injecting transactions.
148-
pub fn tx(&mut self) -> TxHelper<'_> {
148+
pub const fn tx(&mut self) -> TxHelper<'_> {
149149
TxHelper::new(self)
150150
}
151151

@@ -417,7 +417,7 @@ impl TestFixtureBuilder {
417417
}
418418

419419
/// Get a mutable reference to the underlying config for advanced customization.
420-
pub fn config_mut(&mut self) -> &mut ScrollRollupNodeConfig {
420+
pub const fn config_mut(&mut self) -> &mut ScrollRollupNodeConfig {
421421
&mut self.config
422422
}
423423

crates/node/src/test_utils/l1_helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub struct L1Helper<'a> {
1717

1818
impl<'a> L1Helper<'a> {
1919
/// Create a new L1 helper.
20-
pub(crate) fn new(fixture: &'a mut TestFixture) -> Self {
20+
pub(crate) const fn new(fixture: &'a mut TestFixture) -> Self {
2121
Self { fixture, target_node_index: None }
2222
}
2323

crates/node/src/test_utils/network_helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub struct ReputationChecker<'a> {
161161

162162
impl<'a> ReputationChecker<'a> {
163163
/// Create a new reputation checker.
164-
pub fn new(fixture: &'a mut TestFixture, observer_node: usize) -> Self {
164+
pub const fn new(fixture: &'a mut TestFixture, observer_node: usize) -> Self {
165165
Self {
166166
fixture,
167167
observer_node,

crates/node/src/test_utils/tx_helpers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub struct TxHelper<'a> {
1313

1414
impl<'a> TxHelper<'a> {
1515
/// Create a new transaction helper.
16-
pub(crate) fn new(fixture: &'a mut TestFixture) -> Self {
16+
pub(crate) const fn new(fixture: &'a mut TestFixture) -> Self {
1717
Self { fixture, target_node_index: 0 }
1818
}
1919

crates/providers/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ async-trait.workspace = true
3232
auto_impl.workspace = true
3333
eyre.workspace = true
3434
futures.workspace = true
35-
lru = "0.13.0"
35+
lru.workspace = true
3636
reqwest = { workspace = true, features = ["json"] }
3737
serde = { workspace = true, features = ["derive"] }
3838
thiserror.workspace = true

0 commit comments

Comments
 (0)