Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(listener): last window calculation + don't send empty proofs #2369

Merged
merged 1 commit into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions crates/chain-listener/src/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,8 @@ impl ChainListener {
fn is_epoch_ending(&self) -> bool {
let window = Uint::from(self.listener_config.epoch_end_window.as_secs());
let next_epoch_start =
self.init_timestamp + self.epoch_duration * (self.current_epoch + Uint::from(1));
self.init_timestamp + self.epoch_duration * (self.current_epoch - Uint::from(1));
tracing::debug!(target: "chain-listener", "Next epoch start: {}, last observed block timestamp: {}", next_epoch_start, self.last_observed_block_timestamp);
next_epoch_start - self.last_observed_block_timestamp < window
}

Expand Down Expand Up @@ -1190,12 +1191,15 @@ impl ChainListener {

tracing::info!(target: "chain-listener", "Found {} proofs in {} batches from polling, skipped {} proofs", result_hashes.len(), batch_count, skipped_proofs_count);

self.submit_proofs(unit_ids, local_nonces, result_hashes)
.await?;
if !result_hashes.is_empty() {
self.submit_proofs(unit_ids, local_nonces, result_hashes)
.await?;
}
} else {
tracing::debug!(target: "chain-listener", "No proofs found from polling");
}
}

Ok(())
}

Expand Down
Loading