Skip to content

Commit

Permalink
chore: don't panic on missing l2 batch number
Browse files Browse the repository at this point in the history
  • Loading branch information
zeapoz committed Jul 29, 2024
1 parent 4c4211d commit 8b2eb41
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/processor/snapshot/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl SnapshotExporter {
let l2_batch_number = self
.database
.get_latest_l2_batch_number()?
.expect("db contains no l2 batch number");
.unwrap_or_default();

This comment has been minimized.

Copy link
@vbar

vbar Jul 29, 2024

Collaborator

but, why would you want to remove error handling? Surely 0 isn't a valid batch number value, and the process will just fail later (potentially during import to Era)? export_snapshot already returns Result - why can't it return a "missing l2 batch number" error?

let l2_block_number = self.database.get_latest_l2_block_number()?.unwrap_or({
tracing::warn!("WARNING: the database contains no l2 block number entry and will not be compatible with the ZKSync External Node! To export a compatible snapshot, please let the prepare-snapshot command run until an l2 block number can be found.");
U64::from(0)
Expand Down

0 comments on commit 8b2eb41

Please sign in to comment.