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(tee): Introduce a 1 second delay in the batch poll #2398

Merged
merged 5 commits into from
Jul 8, 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
14 changes: 10 additions & 4 deletions core/bin/zksync_tee_prover/src/tee_prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl Task for TeeProver {
return Ok(());
}
let result = self.step().await;
match result {
let need_to_sleep = match result {
Ok(batch_number) => {
retries = 1;
backoff = self.config.initial_retry_backoff;
Expand All @@ -191,6 +191,9 @@ impl Task for TeeProver {
METRICS
.last_batch_number_processed
.set(batch_number.0 as u64);
false
} else {
true
}
}
Err(err) => {
Expand All @@ -200,14 +203,17 @@ impl Task for TeeProver {
}
retries += 1;
tracing::warn!(%err, "Failed TEE prover step function {retries}/{}, retrying in {} milliseconds.", self.config.max_retries, backoff.as_millis());
tokio::time::timeout(backoff, stop_receiver.0.changed())
.await
.ok();
backoff = std::cmp::min(
backoff.mul_f32(self.config.retry_backoff_multiplier),
self.config.max_backoff,
);
true
}
};
if need_to_sleep {
tokio::time::timeout(backoff, stop_receiver.0.changed())
.await
.ok();
}
}
}
Expand Down
Loading