Skip to content

Commit

Permalink
0.6 specific fixes
Browse files Browse the repository at this point in the history
Don't change existing schema
  • Loading branch information
inahga committed Feb 5, 2024
1 parent 82588e0 commit aaff6c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 31 deletions.
17 changes: 7 additions & 10 deletions aggregator/src/aggregator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down Expand Up @@ -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!(
Expand Down Expand Up @@ -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!(
Expand Down Expand Up @@ -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!(
Expand Down Expand Up @@ -4108,24 +4108,21 @@ 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(),
);

// 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!(
Expand Down
1 change: 0 additions & 1 deletion db/00000000000001_initial_schema.down.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 0 additions & 20 deletions db/00000000000001_initial_schema.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aaff6c9

Please sign in to comment.