Skip to content

Commit

Permalink
chore(papyrus_sync): fix SYNC_PROCESSED_TRANSACTIONS u64 conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
noamsp-starkware committed Mar 4, 2025
1 parent c929857 commit 73d8719
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions crates/papyrus_sync/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,8 @@ impl<

debug!("Storing block.");
trace!("Block data: {block:#?}, signature: {signature:?}");
let num_txs = block.body.transactions.len();
let num_txs =
block.body.transactions.len().try_into().expect("Failed to convert usize to u64");
self.writer
.begin_rw_txn()?
.append_header(block_number, &block.header)?
Expand All @@ -452,10 +453,7 @@ impl<
.commit()?;
SYNC_HEADER_MARKER.set(block_number.unchecked_next().0 as f64);
SYNC_BODY_MARKER.set(block_number.unchecked_next().0 as f64);
SYNC_PROCESSED_TRANSACTIONS.increment(num_txs.try_into().unwrap_or_else(|err| {
error!("Failed to convert number of transactions to u64: {}", err);
0
}));
SYNC_PROCESSED_TRANSACTIONS.increment(num_txs);
let time_delta = Utc::now()
- Utc
.timestamp_opt(block.header.block_header_without_hash.timestamp.0 as i64, 0)
Expand Down

0 comments on commit 73d8719

Please sign in to comment.