Skip to content

Commit

Permalink
feat: adds more debugging statements to the finalizer loop 3 (#71)
Browse files Browse the repository at this point in the history
* feat: adds more debugging statements to the finalizer loop 3

* fix sqlx
  • Loading branch information
montekki committed Aug 2, 2023
1 parent 2f09244 commit c7906b5
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 3 deletions.
10 changes: 10 additions & 0 deletions chain-events/src/block_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,16 @@ impl BlockEvents {
.number
.expect("last block always has a number; qed");

vlog::info!(
"Filtering logs from {} to {}",
from_block
.into()
.as_number()
.expect("always starting from a numbered block; qed")
.as_u64(),
latest_block.as_u64(),
);

let past_filter = Filter::new()
.from_block(from_block)
.to_block(latest_block)
Expand Down
12 changes: 12 additions & 0 deletions finalizer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,12 @@ where
// * erc20 has denied a tx for some internal reasons.
async fn process_unsuccessful(&mut self) -> Result<()> {
if self.unsuccessful.is_empty() {
vlog::debug!("no unsuccessful withdrawals");
return Ok(());
}

let predicted = std::mem::take(&mut self.unsuccessful);
vlog::debug!("requesting finalization status of withdrawals");
let are_finalized = self.get_finalized_withdrawals(&predicted).await?;

let mut already_finalized = vec![];
Expand All @@ -299,10 +301,20 @@ where
}
}

vlog::debug!(
"setting unsuccessful finalization attempts to {} withdrawals",
unsuccessful.len()
);

// Either finalization tx has failed for these, or they were
// predicted to fail.
storage::inc_unsuccessful_finalization_attempts(&self.pgpool, &unsuccessful).await?;

vlog::debug!(
"setting already finalized status to {} withdrawals",
already_finalized.len()
);

// if the withdrawal has already been finalized set its
// finalization transaction to zero which is signals exactly this
// it is known that withdrawal has been fianlized but not known
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ pub async fn get_withdrawals_with_no_data(
max_committed,
max_seen
WHERE
id >= coalesce(max_seen.max, 1)
id > coalesce(max_seen.max, 1)
AND l2_block_number <= max_committed.max
ORDER BY
l2_block_number
Expand Down

0 comments on commit c7906b5

Please sign in to comment.