|
1 | 1 | use dep::aztec::{ |
2 | 2 | context::{PrivateContext, PublicContext}, |
3 | | - encrypted_logs::log_assembly_strategies::default_aes128, |
| 3 | + encrypted_logs::{log_assembly_strategies::default_aes128, log_type::PARTIAL_NOTE_LOG_TYPE_ID}, |
4 | 4 | keys::getters::{get_nsk_app, get_public_keys}, |
5 | 5 | macros::notes::custom_note, |
6 | 6 | note::note_interface::{NoteHash, NoteType}, |
@@ -113,7 +113,7 @@ impl NFTNote { |
113 | 113 | /// Each partial note should only be used once, since otherwise multiple notes would be linked together and known to |
114 | 114 | /// belong to the same owner. |
115 | 115 | /// |
116 | | - /// As part of the partial note cration process, a log will be sent to `recipient` from `sender` so that they can |
| 116 | + /// As part of the partial note creation process, a log will be sent to `recipient` from `sender` so that they can |
117 | 117 | /// discover the note. `recipient` will typically be the same as `owner`. |
118 | 118 | pub fn partial( |
119 | 119 | owner: AztecAddress, |
@@ -189,15 +189,15 @@ struct PrivateNFTPartialNotePrivateLogContent { |
189 | 189 |
|
190 | 190 | impl NoteType for PrivateNFTPartialNotePrivateLogContent { |
191 | 191 | fn get_id() -> Field { |
192 | | - // We abuse the fact that note type ids are 7 bits long to use the 8th bit indicate the log corresponds to a |
193 | | - // partial note. Ideally we'd use proper events with selectors, but those are not handled well at the moment. |
194 | | - NFTNote::get_id() + 128 |
| 192 | + // The log type id is 1 to indicate this is a partial note log, and the log metadata is the note type id |
| 193 | + // TODO: Mixing the log type id and note type id here is a hack and should be separated. |
| 194 | + (PARTIAL_NOTE_LOG_TYPE_ID * 2.pow_32(64)) + NFTNote::get_id() |
195 | 195 | } |
196 | 196 | } |
197 | 197 |
|
198 | 198 | /// A partial instance of a NFTNote. This value represents a private commitment to the owner, randomness and storage |
199 | 199 | /// slot, but the token id field has not yet been set. A partial note can be completed in public with the `complete` |
200 | | -/// function (revealing the tolken id to the public), resulting in a NFTNote that can be used like any other one (except |
| 200 | +/// function (revealing the token id to the public), resulting in a NFTNote that can be used like any other one (except |
201 | 201 | /// of course that its token id is known). |
202 | 202 | #[derive(Packable, Serialize, Deserialize)] |
203 | 203 | pub struct PartialNFTNote { |
@@ -307,7 +307,7 @@ mod test { |
307 | 307 | partial_note.compute_note_completion_log(token_id)[0], |
308 | 308 | ); |
309 | 309 |
|
310 | | - // Then we exctract all fields except the first of both logs (i.e. the public log tag), and combine them to |
| 310 | + // Then we extract all fields except the first of both logs (i.e. the public log tag), and combine them to |
311 | 311 | // produce the note's packed representation. This requires that the members of the intermediate structs are in |
312 | 312 | // the same order as in NFTNote. |
313 | 313 | let private_log_without_public_tag: [_; 2] = subarray(private_log_content.pack(), 1); |
|
0 commit comments