Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checking that a transaction does not consume two identical notes #775

Open
bobbinth opened this issue Jun 29, 2024 · 0 comments
Open

Checking that a transaction does not consume two identical notes #775

bobbinth opened this issue Jun 29, 2024 · 0 comments
Labels
kernels Related to transaction, batch, or block kernels
Milestone

Comments

@bobbinth
Copy link
Contributor

All input notes into the transaction must be unique (i.e., have unique note IDs). Currently, we are not checking this because we assume that if some transaction tries to consume the same not twice, it will output two identical nullifiers, and thus, we will catch this in the block kernel (where we update the nullifier tree). But, there are two important considerations:

  • By the time we get to the block kernel, we already would have done a bunch of work (e.g., including transaction into a batch), and ideally, we should catch and discard such transactions much sooner.
  • There are might be some nuances of how this works for notes with delayed authentication (I haven't thought through all potential implications).

There are couple of options to address this:

  1. Check input note uniqueness in the transaction kernel. This has a nice guarantee that for every transaction, if the proof verifies, we know all input notes were unique. There is, of course, the cost associated with performing these checks and the question is whether we want the transaction kernel to bear this cost.
  2. Check input note uniqueness in the batch kernel. The overhead of this in Miden VM would probably be the same, but we'd be pushing this complexity down the line expecting that batch kernels would usually be generated on more powerful machines. We can also update TransactionVerifier to perform these checks in Rust to filter out malicious notes.
    a. As a side comment, the batch kernel will still need to deal with "cross-transaction" input note uniqueness - i.e., to avoid a situation when some transaction produces a note and two transactions try to consume the same note as unauthenticated note.

My preliminary thinking is that the first approach is better as it is more robust - but this requires more consideration.

@bobbinth bobbinth added the kernels Related to transaction, batch, or block kernels label Jun 29, 2024
@bobbinth bobbinth added this to the v0.5 milestone Jul 1, 2024
@Dominik1999 Dominik1999 assigned polydez and unassigned polydez Aug 26, 2024
@bobbinth bobbinth modified the milestones: v0.5, v0.6 Aug 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernels Related to transaction, batch, or block kernels
Projects
Status: No status
Development

No branches or pull requests

2 participants