Skip to content

Commit c703985

Browse files
committed
Merge branch 'main' into morty-add-anvil-to-test-fixture
2 parents 46638aa + d6a78f9 commit c703985

File tree

13 files changed

+345
-251
lines changed

13 files changed

+345
-251
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 50 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -141,59 +141,59 @@ alloy-signer-local = { version = "1.0.37", default-features = false }
141141
alloy-transport = { version = "1.0.37", default-features = false }
142142

143143
# scroll-alloy
144-
scroll-alloy-consensus = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
145-
scroll-alloy-hardforks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
146-
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
147-
scroll-alloy-provider = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
148-
scroll-alloy-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
149-
scroll-alloy-rpc-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
150-
scroll-alloy-rpc-types-engine = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
144+
scroll-alloy-consensus = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
145+
scroll-alloy-hardforks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
146+
scroll-alloy-network = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
147+
scroll-alloy-provider = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
148+
scroll-alloy-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
149+
scroll-alloy-rpc-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
150+
scroll-alloy-rpc-types-engine = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
151151

152152
# reth
153-
reth-chainspec = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
154-
reth-e2e-test-utils = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91" }
155-
reth-eth-wire = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
156-
reth-eth-wire-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
157-
reth-network = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
158-
reth-network-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
159-
reth-network-p2p = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
160-
reth-network-peers = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
161-
reth-network-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
162-
reth-node-builder = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
163-
reth-node-core = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
164-
reth-node-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
165-
reth-node-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
166-
reth-payload-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
167-
reth-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
168-
reth-primitives-traits = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
169-
reth-provider = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
170-
reth-rpc-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
171-
reth-rpc-eth-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
172-
reth-rpc-eth-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
173-
reth-rpc-layer = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
174-
reth-rpc-server-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
175-
reth-storage-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
176-
reth-tasks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
177-
reth-tokio-util = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
178-
reth-tracing = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
179-
reth-transaction-pool = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
180-
reth-trie-db = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
181-
reth-testing-utils = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
182-
reth-revm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
183-
reth-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
184-
reth-engine-local = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
185-
reth-cli-util = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
153+
reth-chainspec = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
154+
reth-e2e-test-utils = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1" }
155+
reth-eth-wire = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
156+
reth-eth-wire-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
157+
reth-network = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
158+
reth-network-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
159+
reth-network-p2p = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
160+
reth-network-peers = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
161+
reth-network-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
162+
reth-node-builder = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
163+
reth-node-core = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
164+
reth-node-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
165+
reth-node-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
166+
reth-payload-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
167+
reth-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
168+
reth-primitives-traits = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
169+
reth-provider = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
170+
reth-rpc-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
171+
reth-rpc-eth-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
172+
reth-rpc-eth-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
173+
reth-rpc-layer = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
174+
reth-rpc-server-types = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
175+
reth-storage-api = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
176+
reth-tasks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
177+
reth-tokio-util = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
178+
reth-tracing = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
179+
reth-transaction-pool = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
180+
reth-trie-db = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
181+
reth-testing-utils = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
182+
reth-revm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
183+
reth-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
184+
reth-engine-local = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
185+
reth-cli-util = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
186186

187187
# reth-scroll
188-
reth-scroll-chainspec = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
189-
reth-scroll-consensus = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
190-
reth-scroll-cli = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
191-
reth-scroll-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
192-
reth-scroll-rpc = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
193-
reth-scroll-engine-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
194-
reth-scroll-forks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
195-
reth-scroll-node = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
196-
reth-scroll-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91", default-features = false }
188+
reth-scroll-chainspec = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
189+
reth-scroll-consensus = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
190+
reth-scroll-cli = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
191+
reth-scroll-evm = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
192+
reth-scroll-rpc = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
193+
reth-scroll-engine-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
194+
reth-scroll-forks = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
195+
reth-scroll-node = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
196+
reth-scroll-primitives = { git = "https://github.com/scroll-tech/reth.git", tag = "scroll-v91.1", default-features = false }
197197

198198
# rollup node
199199
rollup-node = { path = "crates/node" }
@@ -225,6 +225,7 @@ metrics = "0.24.0"
225225
metrics-derive = "0.1"
226226
parking_lot = "0.12"
227227
rand = { version = "0.9" }
228+
rayon = "1.7"
228229
reqwest = "0.12"
229230
serde = { version = "1.0" }
230231
serde_json = { version = "1.0" }

crates/chain-orchestrator/src/consolidation.rs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,14 @@ pub(crate) async fn reconcile_batch<L2P: Provider<Scroll>>(
3838

3939
// The block matches the derived attributes and the block is below or equal to the
4040
// safe current safe head.
41-
if attributes.block_number <= fcs.safe_block_info().number {
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+
{
4245
Ok::<_, ChainOrchestratorError>(BlockConsolidationAction::Skip(block_info))
4346
} else {
4447
// The block matches the derived attributes, no action is needed.
45-
Ok::<_, ChainOrchestratorError>(BlockConsolidationAction::UpdateSafeHead(
46-
block_info,
47-
))
48+
Ok::<_, ChainOrchestratorError>(BlockConsolidationAction::UpdateFcs(block_info))
4849
}
4950
} else {
5051
// The block does not match the derived attributes, a reorg is needed.
@@ -81,7 +82,7 @@ impl BatchReconciliationResult {
8182
for next in &self.actions {
8283
if let Some(last) = actions.last_mut() {
8384
match (last, next) {
84-
(last, next) if last.is_update_safe_head() && next.is_update_safe_head() => {
85+
(last, next) if last.is_update_fcs() && next.is_update_fcs() => {
8586
*last = next.clone();
8687
}
8788
_ => {
@@ -128,8 +129,8 @@ pub(crate) struct AggregatedBatchConsolidationActions {
128129
/// An action that must be performed on the L2 chain to consolidate a block.
129130
#[derive(Debug, Clone)]
130131
pub(crate) enum BlockConsolidationAction {
131-
/// Update the safe head to the given block.
132-
UpdateSafeHead(L2BlockInfoWithL1Messages),
132+
/// Update the fcs to the given block.
133+
UpdateFcs(L2BlockInfoWithL1Messages),
133134
/// The derived attributes match the L2 chain and the safe head is already at or beyond the
134135
/// block, so no action is needed.
135136
Skip(L2BlockInfoWithL1Messages),
@@ -138,9 +139,9 @@ pub(crate) enum BlockConsolidationAction {
138139
}
139140

140141
impl BlockConsolidationAction {
141-
/// Returns true if the action is to update the safe head.
142-
pub(crate) const fn is_update_safe_head(&self) -> bool {
143-
matches!(self, Self::UpdateSafeHead(_))
142+
/// Returns true if the action is to update the fcs.
143+
pub(crate) const fn is_update_fcs(&self) -> bool {
144+
matches!(self, Self::UpdateFcs(_))
144145
}
145146

146147
/// Returns true if the action is to skip the block.
@@ -157,7 +158,7 @@ impl BlockConsolidationAction {
157158
/// skip, returns None for reorg.
158159
pub(crate) fn into_block_info(self) -> Option<L2BlockInfoWithL1Messages> {
159160
match self {
160-
Self::UpdateSafeHead(info) | Self::Skip(info) => Some(info),
161+
Self::UpdateFcs(info) | Self::Skip(info) => Some(info),
161162
Self::Reorg(_attrs) => None,
162163
}
163164
}
@@ -166,7 +167,7 @@ impl BlockConsolidationAction {
166167
impl std::fmt::Display for BlockConsolidationAction {
167168
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
168169
match self {
169-
Self::UpdateSafeHead(info) => {
170+
Self::UpdateFcs(info) => {
170171
write!(f, "UpdateSafeHead to block {}", info.block_info.number)
171172
}
172173
Self::Skip(info) => write!(f, "Skip block {}", info.block_info.number),

crates/chain-orchestrator/src/lib.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ impl<
454454
BlockConsolidationAction::Skip(_) => {
455455
unreachable!("Skip actions have been filtered out in aggregation")
456456
}
457-
BlockConsolidationAction::UpdateSafeHead(block_info) => {
457+
BlockConsolidationAction::UpdateFcs(block_info) => {
458458
tracing::info!(target: "scroll::chain_orchestrator", ?block_info, "Updating safe head to consolidated block");
459459
let finalized_block_info = batch_reconciliation_result
460460
.target_status
@@ -650,7 +650,7 @@ impl<
650650
.get_block_by_number(block_number.into())
651651
.full()
652652
.await?
653-
.expect("L2 head block must exist")
653+
.ok_or(ChainOrchestratorError::L2BlockNotFoundInL2Client(block_number))?
654654
.header
655655
.hash_slow();
656656

@@ -841,7 +841,10 @@ impl<
841841
.await?;
842842

843843
// Update the forkchoice state to the new safe block.
844-
self.engine.update_fcs(None, Some(safe_block_info), None).await?;
844+
if self.sync_state.is_synced() {
845+
tracing::info!(target: "scroll::chain_orchestrator", ?safe_block_info, "Updating safe head to block after batch revert");
846+
self.engine.update_fcs(None, Some(safe_block_info), None).await?;
847+
}
845848

846849
Ok(Some(ChainOrchestratorEvent::BatchReverted { batch_info, safe_head: safe_block_info }))
847850
}
@@ -1015,7 +1018,9 @@ impl<
10151018
.get_block_by_number(current_head_block_number.into())
10161019
.full()
10171020
.await?
1018-
.expect("current head block must exist");
1021+
.ok_or(ChainOrchestratorError::L2BlockNotFoundInL2Client(
1022+
current_head_block_number,
1023+
))?;
10191024

10201025
// If the timestamp of the received block is less than or equal to the current head,
10211026
// we ignore it.
@@ -1077,7 +1082,7 @@ impl<
10771082
.get_block_by_number(header.number.into())
10781083
.full()
10791084
.await?
1080-
.expect("block must exist")
1085+
.ok_or(ChainOrchestratorError::L2BlockNotFoundInL2Client(header.number))?
10811086
.into_consensus()
10821087
.map_transactions(|tx| tx.inner.into_inner());
10831088

crates/database/db/src/db.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,20 @@ impl DatabaseWriteOperations for Database {
505505
)
506506
}
507507

508+
async fn insert_signatures(
509+
&self,
510+
signatures: Vec<(B256, Signature)>,
511+
) -> Result<(), DatabaseError> {
512+
metered!(
513+
DatabaseOperation::InsertSignatures,
514+
self,
515+
tx_mut(move |tx| {
516+
let signatures = signatures.clone();
517+
async move { tx.insert_signatures(signatures).await }
518+
})
519+
)
520+
}
521+
508522
async fn insert_signature(
509523
&self,
510524
block_hash: B256,

crates/database/db/src/metrics.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ pub(crate) enum DatabaseOperation {
5050
PurgeL1MessageToL2BlockMappings,
5151
InsertBatchConsolidationOutcome,
5252
Unwind,
53+
InsertSignatures,
5354
InsertSignature,
5455
// Read operations
5556
GetBatchByIndex,
@@ -118,6 +119,7 @@ impl DatabaseOperation {
118119
Self::PurgeL1MessageToL2BlockMappings => "purge_l1_message_to_l2_block_mappings",
119120
Self::InsertBatchConsolidationOutcome => "insert_batch_consolidation_outcome",
120121
Self::Unwind => "unwind",
122+
Self::InsertSignatures => "insert_signatures",
121123
Self::InsertSignature => "insert_signature",
122124
Self::GetBatchByIndex => "get_batch_by_index",
123125
Self::GetBatchByHash => "get_batch_by_hash",

0 commit comments

Comments
 (0)