Skip to content

Commit ffb9962

Browse files
committed
prefixing_with_tag test
1 parent efb012d commit ffb9962

File tree

1 file changed

+31
-0
lines changed
  • noir-projects/aztec-nr/aztec/src/encrypted_logs/log_assembly_strategies/default_aes128

1 file changed

+31
-0
lines changed

noir-projects/aztec-nr/aztec/src/encrypted_logs/log_assembly_strategies/default_aes128/note.nr

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,34 @@ where
150150
context.emit_raw_note_log(encrypted_log, note_hash_counter);
151151
}
152152
}
153+
154+
mod test {
155+
use super::prefix_with_tag;
156+
use protocol_types::{
157+
address::AztecAddress,
158+
indexed_tagging_secret::IndexedTaggingSecret,
159+
traits::{FromField, Serialize},
160+
};
161+
use std::test::OracleMock;
162+
163+
#[test]
164+
unconstrained fn prefixing_with_tag() {
165+
let sender = AztecAddress::from_field(1);
166+
let recipient = AztecAddress::from_field(2);
167+
168+
let indexed_tagging_secret = IndexedTaggingSecret { app_tagging_secret: 42, index: 5 };
169+
170+
// Mock the tagging oracles
171+
let _ = OracleMock::mock("getIndexedTaggingSecretAsSender").returns(indexed_tagging_secret
172+
.serialize());
173+
let _ = OracleMock::mock("incrementAppTaggingSecretIndexAsSender").returns(());
174+
175+
let log_without_tag = [1, 2, 3];
176+
let log_with_tag = prefix_with_tag(log_without_tag, sender, recipient);
177+
178+
let expected_result = [indexed_tagging_secret.compute_tag(recipient), 1, 2, 3];
179+
180+
// Check tag was prefixed correctly
181+
assert_eq(log_with_tag, expected_result, "Tag was not prefixed correctly");
182+
}
183+
}

0 commit comments

Comments
 (0)