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

Update AZTEC note ABI to include a note type #71

Closed
zac-williamson opened this Issue Mar 19, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@zac-williamson
Copy link
Collaborator

zac-williamson commented Mar 19, 2019

The problem space

Currently we only support one type of AZTEC note, an UXTO-style AZTEC commitment. However, over time we will want to support different 'types' of AZTEC note.

For example, in our short-term roadmap we will be implementing El-Gamal treasury notes. These notes, and others, will need to be able to be distinguished from one another.

Solution

When computing a note's hash, we should integrate a 'type' variable into the hash, with different values mapping to different kinds of AZTEC notes.

In addition, we should change the note ABI encoding to include the note type. This shouldn't be too painful as we don't need to change any ABI encodings for the inputs to our validator contracts (the note type is implicit - a given proof only works with one type of note).

Updating the ABI encoding to contain the noteType

Old ABI encoding:

Offset Length Name Type Description
0x00 0x20 owner uint owner of note
0x20 0x20 noteHash bytes32 hash of note public key
0x40 - noteData bytes public key data + note metadata

New ABI encoding:

Offset Length Name Type Description
0x00 0x20 noteType uint type identifier of note
0x20 0x20 owner uint owner of note
0x40 0x20 noteHash bytes32 hash of note public key + noteType
0x40 - noteData bytes public key data + note metadata

Work to be done

  1. Update ABI encoding of JoinSplit output notes to include noteType variable
  2. Update ABI encoding of BilateralSwap output notes to include noteType variable
  3. Update ABI encoding of DividendComputation output notes to include noteType variable
  4. Update ABI encoding of AdjustSupply output notes to include noteType variable
  5. Update aztec.js abiEncoder module to use noteType variable when encoding/decoding notes

Initial list of note types

NoteType Name Description
1 UXTO Standard AZTEC note
2 TREASURY ElGamal treasury note

@PaulRBerg PaulRBerg added the feature label Mar 19, 2019

@ArnSch

This comment has been minimized.

Copy link
Contributor

ArnSch commented Mar 30, 2019

Done in #79

@ArnSch ArnSch closed this Mar 30, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.