Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pbeza committed Nov 29, 2024
1 parent 17977dc commit 464b5d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
5 changes: 0 additions & 5 deletions core/lib/dal/src/models/storage_tee_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ pub struct StorageTeeProof {
pub attestation: Option<Vec<u8>>,
}

#[derive(Debug, Clone, sqlx::FromRow)]
pub struct StorageBatch {
pub l1_batch_number: i64,
}

#[derive(Debug, Clone, sqlx::FromRow)]
pub struct StorageLockedBatch {
pub l1_batch_number: i64,
Expand Down
10 changes: 5 additions & 5 deletions core/lib/dal/src/tee_proof_generation_dal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use zksync_db_connection::{
use zksync_types::{tee_types::TeeType, L1BatchNumber};

use crate::{
models::storage_tee_proof::{StorageBatch, StorageLockedBatch, StorageTeeProof},
models::storage_tee_proof::{StorageLockedBatch, StorageTeeProof},
Core,
};

Expand Down Expand Up @@ -65,8 +65,7 @@ impl TeeProofGenerationDal<'_, '_> {
let processing_timeout = pg_interval_from_duration(processing_timeout);
let min_batch_number = i64::from(min_batch_number.0);
let mut transaction = self.storage.start_transaction().await?;
let batch_number = sqlx::query_as!(
StorageBatch,
let batch_number = sqlx::query!(
r#"
SELECT
p.l1_batch_number
Expand All @@ -90,7 +89,9 @@ impl TeeProofGenerationDal<'_, '_> {
AND tee.prover_taken_at < NOW() - $4::INTERVAL
)
)
FETCH FIRST ROW ONLY
LIMIT 1
FOR UPDATE OF p
SKIP LOCKED
"#,
tee_type.to_string(),
TeeProofGenerationJobStatus::PickedByProver.to_string(),
Expand All @@ -108,7 +109,6 @@ impl TeeProofGenerationDal<'_, '_> {
let batch_number = match batch_number {
Some(batch) => batch.l1_batch_number,
None => {
transaction.commit().await?;
return Ok(None);
}
};
Expand Down

0 comments on commit 464b5d4

Please sign in to comment.