Skip to content

Compute attachment_size during output_note::set_attachment #2266

@PhilippGackstatter

Description

@PhilippGackstatter

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feesRelated to fees.kernelsRelated to transaction, batch, or block kernels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions