Skip to content

Commit 7761a3a

Browse files
committed
Saffron/Storage/Test: also check consistency with Commitment::update produced commitment
1 parent 632e703 commit 7761a3a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

saffron/src/storage.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ mod tests {
185185
Commitment::eq(&data_comm, &read_data_comm)
186186
};
187187

188-
let (data_updated, update_consistency) = {
188+
let (data_updated, update_consistency, diff_comm_consistency) = {
189189
let diff = {
190190
// The number of updates is proportional to the data length,
191191
// but we make sure to have at least one update if the data is
@@ -216,11 +216,15 @@ mod tests {
216216
let updated_read_data = storage::read(path).unwrap();
217217
let updated_read_data_comm = updated_read_data.to_commitment(&srs);
218218

219+
let updated_diff_data_comm = data_comm.update(&srs, diff);
220+
219221
(
220222
// True if the data have changed because of the update
221223
Commitment::ne(&updated_data_comm, &data_comm),
222224
// True if read data from updated file are the same as updated data
223225
Commitment::eq(&updated_data_comm, &updated_read_data_comm),
226+
// True if the commitments are the same as the commitment obtained by direct diff application
227+
Commitment::eq(&updated_diff_data_comm, &updated_data_comm),
224228
)
225229
};
226230

@@ -229,5 +233,6 @@ mod tests {
229233
assert!(read_consistency);
230234
assert!(data_updated);
231235
assert!(update_consistency);
236+
assert!(diff_comm_consistency);
232237
}
233238
}

0 commit comments

Comments
 (0)