From aaff6c9f65d60fba2228f65768ac5c6504646d77 Mon Sep 17 00:00:00 2001 From: Ameer Ghani Date: Fri, 26 Jan 2024 13:07:52 -0500 Subject: [PATCH] 0.6 specific fixes Don't change existing schema --- aggregator/src/aggregator.rs | 17 +++++++---------- db/00000000000001_initial_schema.down.sql | 1 - db/00000000000001_initial_schema.up.sql | 20 -------------------- 3 files changed, 7 insertions(+), 31 deletions(-) diff --git a/aggregator/src/aggregator.rs b/aggregator/src/aggregator.rs index 16432d2ef..195b1c77e 100644 --- a/aggregator/src/aggregator.rs +++ b/aggregator/src/aggregator.rs @@ -3889,7 +3889,7 @@ mod tests { // Try to upload the report, verify that we get the expected error. let error = aggregator - .handle_upload(task.id(), &report.get_encoded().unwrap()) + .handle_upload(task.id(), &report.get_encoded()) .await .unwrap_err(); assert_matches!( @@ -3945,7 +3945,7 @@ mod tests { // Try to upload the report, verify that we get the expected error. let error = aggregator - .handle_upload(task.id(), &report.get_encoded().unwrap()) + .handle_upload(task.id(), &report.get_encoded()) .await .unwrap_err(); assert_matches!( @@ -4001,7 +4001,7 @@ mod tests { // Try to upload the report, verify that we get the expected error. let error = aggregator - .handle_upload(task.id(), &report.get_encoded().unwrap()) + .handle_upload(task.id(), &report.get_encoded()) .await .unwrap_err(); assert_matches!( @@ -4056,7 +4056,7 @@ mod tests { // Try to upload the report, verify that we get the expected error. let error = aggregator - .handle_upload(task.id(), &report.get_encoded().unwrap()) + .handle_upload(task.id(), &report.get_encoded()) .await .unwrap_err(); assert_matches!( @@ -4108,16 +4108,13 @@ mod tests { task.current_hpke_key().config(), &HpkeApplicationInfo::new(&Label::InputShare, &Role::Client, &Role::Leader), // Some obviously wrong payload. - &PlaintextInputShare::new(Vec::new(), vec![0; 100]) - .get_encoded() - .unwrap(), + &PlaintextInputShare::new(Vec::new(), vec![0; 100]).get_encoded(), &InputShareAad::new( *task.id(), report.metadata().clone(), report.public_share().to_vec(), ) - .get_encoded() - .unwrap(), + .get_encoded(), ) .unwrap(), report.helper_encrypted_input_share().clone(), @@ -4125,7 +4122,7 @@ mod tests { // Try to upload the report, verify that we get the expected error. let error = aggregator - .handle_upload(task.id(), &report.get_encoded().unwrap()) + .handle_upload(task.id(), &report.get_encoded()) .await .unwrap_err(); assert_matches!( diff --git a/db/00000000000001_initial_schema.down.sql b/db/00000000000001_initial_schema.down.sql index d2d870567..6a1156840 100644 --- a/db/00000000000001_initial_schema.down.sql +++ b/db/00000000000001_initial_schema.down.sql @@ -25,7 +25,6 @@ DROP INDEX client_reports_task_and_timestamp_unaggregated_index CASCADE; DROP TABLE client_reports CASCADE; DROP TABLE task_hpke_keys CASCADE; DROP INDEX task_id_index CASCADE; -DROP TABLE task_upload_counters CASCADE; DROP TABLE tasks CASCADE; DROP TABLE taskprov_aggregator_auth_tokens; DROP TABLE taskprov_collector_auth_tokens; diff --git a/db/00000000000001_initial_schema.up.sql b/db/00000000000001_initial_schema.up.sql index 8ffa65dd7..3b9f203c7 100644 --- a/db/00000000000001_initial_schema.up.sql +++ b/db/00000000000001_initial_schema.up.sql @@ -133,26 +133,6 @@ CREATE TABLE tasks( ); CREATE INDEX task_id_index ON tasks(task_id); --- Per task report upload counters. -CREATE TABLE task_upload_counters( - id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, -- artificial ID, internal-only - task_id BIGINT NOT NULL, - - interval_collected BIGINT NOT NULL DEFAULT 0, -- Reports submitted for an interval that was already collected. - report_decode_failure BIGINT NOT NULL DEFAULT 0, -- Reports which failed to decode. - report_decrypt_failure BIGINT NOT NULL DEFAULT 0, -- Reports which failed to decrypt. - report_expired BIGINT NOT NULL DEFAULT 0, -- Reports that were older than the task's report_expiry_age. - report_outdated_key BIGINT NOT NULL DEFAULT 0, -- Reports that were encrypted with an unknown or outdated HPKE key. - report_success BIGINT NOT NULL DEFAULT 0, -- Reports that were successfully uploaded. - report_too_early BIGINT NOT NULL DEFAULT 0, -- Reports whose timestamp is too far in the future. - task_expired BIGINT NOT NULL DEFAULT 0, -- Reports sent to the task while it is expired. - - ord BIGINT NOT NULL, -- Index of this task_upload_counters shard. - - CONSTRAINT fk_task_id FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE, - CONSTRAINT task_upload_counters_unique UNIQUE(task_id, ord) -); - -- The HPKE public keys (aka configs) and private keys used by a given task. CREATE TABLE task_hpke_keys( id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, -- artificial ID, internal-only