Skip to content
This repository has been archived by the owner on Mar 16, 2023. It is now read-only.

Update AZTEC note ABI to include a note type #71

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

Update AZTEC note ABI to include a note type #71

zac-williamson opened this issue Mar 19, 2019 · 1 comment
Labels
feature Add new functionality

Comments

@zac-williamson
Copy link
Collaborator

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 Add new functionality label Mar 19, 2019
@ArnSch
Copy link
Contributor

ArnSch commented Mar 30, 2019

Done in #79

@ArnSch ArnSch closed this as completed Mar 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Add new functionality
Projects
None yet
Development

No branches or pull requests

3 participants