This is a follow-up to #2109.
In order to later calculate fees for note attachments, a basic component is the attachment_size, which depends on NoteAttachmentContent variant:
None: size 0, incurs no cost
Word: size 4 (one Word)
Array(elements): size elements.len()
For array attachments, this means the tx kernel needs to validate that the ATTACHMENT provided to set_attachment matches the commitment of the corresponding advice map entry. From that advice map entry, the number of elements pushed with adv.push_mapvaln is the attachment_size.
So, the task here is to change $kernel::output_note::validate_attachment to return attachment_size (which implies validating array attachments).
We will then likely need to store the size of each output note's attachment in its kernel memory section, so it can be accessed in $kernel::epilogue::compute_fee.
This is a follow-up to #2109.
In order to later calculate fees for note attachments, a basic component is the
attachment_size, which depends onNoteAttachmentContentvariant:None: size 0, incurs no costWord: size 4 (oneWord)Array(elements): sizeelements.len()For array attachments, this means the tx kernel needs to validate that the
ATTACHMENTprovided toset_attachmentmatches the commitment of the corresponding advice map entry. From that advice map entry, the number of elements pushed withadv.push_mapvalnis theattachment_size.So, the task here is to change
$kernel::output_note::validate_attachmentto returnattachment_size(which implies validating array attachments).We will then likely need to store the size of each output note's attachment in its kernel memory section, so it can be accessed in
$kernel::epilogue::compute_fee.