From 47d061d81a13f423a3de42ce35a683c4c1996455 Mon Sep 17 00:00:00 2001 From: Lech <88630083+Artemka374@users.noreply.github.com> Date: Thu, 30 May 2024 12:55:24 +0300 Subject: [PATCH 1/2] fix null protocol version error --- .../prover_dal/src/fri_proof_compressor_dal.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/prover/prover_dal/src/fri_proof_compressor_dal.rs b/prover/prover_dal/src/fri_proof_compressor_dal.rs index 793a15a19dc9..b9a2af59e004 100644 --- a/prover/prover_dal/src/fri_proof_compressor_dal.rs +++ b/prover/prover_dal/src/fri_proof_compressor_dal.rs @@ -275,13 +275,16 @@ impl FriProofCompressorDal<'_, '_> { .await .unwrap() .into_iter() - .map(|row| { - let key = ProtocolVersionId::try_from(row.protocol_version.unwrap() as u16).unwrap(); - let value = JobCountStatistics { - queued: row.queued.unwrap() as usize, - in_progress: row.in_progress.unwrap() as usize, - }; - (key, value) + .map(|row| match row.protocol_version { + Some(protocol_version) => { + let key = ProtocolVersionId::try_from(protocol_version as u16).unwrap(); + let value = JobCountStatistics { + queued: row.queued.unwrap() as usize, + in_progress: row.in_progress.unwrap() as usize, + }; + (key, value) + } + None => {} }) .collect() } From baea51271f73f6a0a948db5054df76b460b1de22 Mon Sep 17 00:00:00 2001 From: Lech <88630083+Artemka374@users.noreply.github.com> Date: Thu, 30 May 2024 13:04:32 +0300 Subject: [PATCH 2/2] use in-query check --- ...9a125f4fdc7e678e191be140bb3177b5a65f.json} | 4 ++-- .../src/fri_proof_compressor_dal.rs | 19 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) rename prover/prover_dal/.sqlx/{query-9cc6cb602bb0752b51238cfbd568355ae88264eacd2a0c09b116159e76823401.json => query-001cff1d4caf69caa33dfeb1713f9a125f4fdc7e678e191be140bb3177b5a65f.json} (76%) diff --git a/prover/prover_dal/.sqlx/query-9cc6cb602bb0752b51238cfbd568355ae88264eacd2a0c09b116159e76823401.json b/prover/prover_dal/.sqlx/query-001cff1d4caf69caa33dfeb1713f9a125f4fdc7e678e191be140bb3177b5a65f.json similarity index 76% rename from prover/prover_dal/.sqlx/query-9cc6cb602bb0752b51238cfbd568355ae88264eacd2a0c09b116159e76823401.json rename to prover/prover_dal/.sqlx/query-001cff1d4caf69caa33dfeb1713f9a125f4fdc7e678e191be140bb3177b5a65f.json index 229d79f74c17..fd2b8872cf1a 100644 --- a/prover/prover_dal/.sqlx/query-9cc6cb602bb0752b51238cfbd568355ae88264eacd2a0c09b116159e76823401.json +++ b/prover/prover_dal/.sqlx/query-001cff1d4caf69caa33dfeb1713f9a125f4fdc7e678e191be140bb3177b5a65f.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n protocol_version,\n COUNT(*) FILTER (\n WHERE\n status = 'queued'\n ) AS queued,\n COUNT(*) FILTER (\n WHERE\n status = 'in_progress'\n ) AS in_progress\n FROM\n proof_compression_jobs_fri\n GROUP BY\n status,\n protocol_version\n ", + "query": "\n SELECT\n protocol_version,\n COUNT(*) FILTER (\n WHERE\n status = 'queued'\n ) AS queued,\n COUNT(*) FILTER (\n WHERE\n status = 'in_progress'\n ) AS in_progress\n FROM\n proof_compression_jobs_fri\n WHERE\n protocol_version IS NOT NULL\n GROUP BY\n status,\n protocol_version\n ", "describe": { "columns": [ { @@ -28,5 +28,5 @@ null ] }, - "hash": "9cc6cb602bb0752b51238cfbd568355ae88264eacd2a0c09b116159e76823401" + "hash": "001cff1d4caf69caa33dfeb1713f9a125f4fdc7e678e191be140bb3177b5a65f" } diff --git a/prover/prover_dal/src/fri_proof_compressor_dal.rs b/prover/prover_dal/src/fri_proof_compressor_dal.rs index b9a2af59e004..138a6b59b266 100644 --- a/prover/prover_dal/src/fri_proof_compressor_dal.rs +++ b/prover/prover_dal/src/fri_proof_compressor_dal.rs @@ -266,6 +266,8 @@ impl FriProofCompressorDal<'_, '_> { ) AS in_progress FROM proof_compression_jobs_fri + WHERE + protocol_version IS NOT NULL GROUP BY status, protocol_version @@ -275,16 +277,13 @@ impl FriProofCompressorDal<'_, '_> { .await .unwrap() .into_iter() - .map(|row| match row.protocol_version { - Some(protocol_version) => { - let key = ProtocolVersionId::try_from(protocol_version as u16).unwrap(); - let value = JobCountStatistics { - queued: row.queued.unwrap() as usize, - in_progress: row.in_progress.unwrap() as usize, - }; - (key, value) - } - None => {} + .map(|row| { + let key = ProtocolVersionId::try_from(row.protocol_version.unwrap() as u16).unwrap(); + let value = JobCountStatistics { + queued: row.queued.unwrap() as usize, + in_progress: row.in_progress.unwrap() as usize, + }; + (key, value) }) .collect() }