1
1
use dep::protocol_types:: {
2
- address::AztecAddress , constants::GENERATOR_INDEX__SYMMETRIC_KEY ,
2
+ address::AztecAddress , constants::GENERATOR_INDEX__SYMMETRIC_KEY , public_keys::AddressPoint ,
3
3
hash::poseidon2_hash_with_separator , point::Point , public_keys::OvpkM , scalar::Scalar ,
4
4
};
5
5
use std:: {
@@ -9,10 +9,10 @@ use std::{
9
9
10
10
use crate:: {
11
11
encrypted_logs::header::EncryptedLogHeader ,
12
- keys::point_to_symmetric_key::point_to_symmetric_key , oracle::random::random ,
12
+ keys::point_to_symmetric_key::point_to_symmetric_key , oracle:: { random::random , notes:: { get_app_tagging_secret , increment_app_tagging_secret }} ,
13
13
utils::point:: point_to_bytes ,
14
14
};
15
- use protocol_types::public_keys::AddressPoint ;
15
+ use protocol_types::hash::poseidon2_hash ;
16
16
17
17
fn compute_private_log_payload <let P : u32 , let M : u32 >(
18
18
contract_address : AztecAddress ,
@@ -39,7 +39,21 @@ fn compute_private_log_payload<let P: u32, let M: u32>(
39
39
let mut offset = if include_public_values_prefix { 1 } else { 0 };
40
40
41
41
let mut encrypted_bytes : [u8 ; M ] = [0 ; M ];
42
- // @todo We ignore the tags for now
42
+
43
+ let tagging_secret = unsafe {
44
+ get_app_tagging_secret (sender , recipient )
45
+ };
46
+
47
+ unsafe {
48
+ increment_app_tagging_secret (sender , recipient );
49
+ };
50
+
51
+ let tag = poseidon2_hash ([tagging_secret .secret , recipient .to_field (), tagging_secret .index as Field ]);
52
+ let tag_bytes : [u8 ; 32 ] = tag .to_be_bytes ();
53
+
54
+ for i in 0 ..32 {
55
+ encrypted_bytes [offset + i ] = tag_bytes [i ];
56
+ }
43
57
offset += 32 ;
44
58
45
59
let eph_pk_bytes = point_to_bytes (eph_pk );
0 commit comments