Skip to content

Commit ba5497a

Browse files
committed
Merge remote-tracking branch 'origin/main' into feat/self-healing-l1-events
2 parents 283bcf9 + ff96d5f commit ba5497a

File tree

16 files changed

+158
-34
lines changed

16 files changed

+158
-34
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/consolidation.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,13 @@ pub(crate) async fn reconcile_batch<L2P: Provider<Scroll>>(
3636
// Extract the block info with L1 messages.
3737
let block_info: L2BlockInfoWithL1Messages = (&current_block).into();
3838

39-
// The block matches the derived attributes and the block is below or equal to the
40-
// safe current safe head.
41-
if attributes.block_number <= fcs.finalized_block_info().number ||
42-
((attributes.block_number <= fcs.safe_block_info().number) &&
43-
batch.target_status.is_consolidated())
44-
{
39+
// The derived attributes match the L2 chain but are associated with a block
40+
// number less than or equal to the finalized block, so skip.
41+
if attributes.block_number <= fcs.finalized_block_info().number {
4542
Ok::<_, ChainOrchestratorError>(BlockConsolidationAction::Skip(block_info))
4643
} else {
47-
// The block matches the derived attributes, no action is needed.
44+
// The block matches the derived attributes but is above the finalized block,
45+
// so we need to update the fcs.
4846
Ok::<_, ChainOrchestratorError>(BlockConsolidationAction::UpdateFcs(block_info))
4947
}
5048
} else {

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
@@ -146,17 +146,17 @@ impl TestFixture {
146146
}
147147

148148
/// Start building a block using the sequencer.
149-
pub fn build_block(&mut self) -> BlockBuilder<'_> {
149+
pub const fn build_block(&mut self) -> BlockBuilder<'_> {
150150
BlockBuilder::new(self)
151151
}
152152

153153
/// Get L1 helper for managing L1 interactions.
154-
pub fn l1(&mut self) -> L1Helper<'_> {
154+
pub const fn l1(&mut self) -> L1Helper<'_> {
155155
L1Helper::new(self)
156156
}
157157

158158
/// Get transaction helper for creating and injecting transactions.
159-
pub fn tx(&mut self) -> TxHelper<'_> {
159+
pub const fn tx(&mut self) -> TxHelper<'_> {
160160
TxHelper::new(self)
161161
}
162162

@@ -484,7 +484,7 @@ impl TestFixtureBuilder {
484484
}
485485

486486
/// Get a mutable reference to the underlying config for advanced customization.
487-
pub fn config_mut(&mut self) -> &mut ScrollRollupNodeConfig {
487+
pub const fn config_mut(&mut self) -> &mut ScrollRollupNodeConfig {
488488
&mut self.config
489489
}
490490

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

0 commit comments

Comments
 (0)